Skip to content

feat: add support for Eth69 receipts representation #15619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

stevencartavia
Copy link
Contributor

closes #15509

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great start, but we now must also duplicate the _inner functions without the bloom

see:

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7642.md#specification

}

fn encode_2718(&self, out: &mut dyn BufMut) {
self.rlp_encode_with_bloom(&self.bloom(), out);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this impl should use the bloom, instead we need to encode all of the fields without the bloom

basically just this without the bloom:

/// RLP-encodes receipt fields with the given [`Bloom`] without an RLP header.
pub fn rlp_encode_fields(&self, bloom: &Bloom, out: &mut dyn BufMut) {
self.success.encode(out);
self.cumulative_gas_used.encode(out);
bloom.encode(out);
self.logs.encode(out);
}

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Apr 9, 2025
@mattsse mattsse added C-enhancement New feature or request A-networking Related to networking in general labels Apr 9, 2025
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@klkvr could you please check this, I can feel my IQ points drop just by looking at this -.-


impl Encodable2718 for Receipt {
fn encode_2718_len(&self) -> usize {
!self.tx_type.is_legacy() as usize + self.rlp_encoded_fields_length_without_bloom()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure this is correct because this doesn't include the rlp header

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this should be smth like

Suggested change
!self.tx_type.is_legacy() as usize + self.rlp_encoded_fields_length_without_bloom()
!self.tx_type.is_legacy() as usize + self.rlp_header_inner_without_bloom().length_with_payload()

Comment on lines 136 to 140
Self::Deposit(receipt) => {
receipt.inner.status.length() +
receipt.inner.cumulative_gas_used.length() +
receipt.inner.logs.length()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should encode deposit nonce and version, if those are present

Comment on lines 156 to 158
receipt.inner.status.encode(out);
receipt.inner.cumulative_gas_used.encode(out);
receipt.inner.logs.encode(out);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines 202 to 203
deposit_nonce: None,
deposit_receipt_version: None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thiose should be decoded and not always set to None

@stevencartavia
Copy link
Contributor Author

@klkvr updated :)


impl Encodable2718 for Receipt {
fn encode_2718_len(&self) -> usize {
self.rlp_header_inner_without_bloom().length_with_payload()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should still account for the type byte (!self.tx_type.is_legacy())

Comment on lines 170 to 175
if let Some(nonce) = receipt.deposit_nonce { nonce.length() } else { 0 } +
if let Some(version) = receipt.deposit_receipt_version {
version.length()
} else {
0
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use map_or here

let mut deposit_receipt_version = None;

// For deposit receipts, try to decode nonce and version if they exist
if tx_type == OpTxType::Deposit && buf.len() + header.payload_length < remaining {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be buf.len() + header.payload_length > remaining?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer us to have some roundtrips here to catch such stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Related to networking in general C-enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Add support for Eth69 receipts representation
3 participants