Skip to content
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

feat: unify ReceiptWithBloom from Alloy #13088

Merged
merged 25 commits into from
Dec 6, 2024
Merged

Conversation

royvardhan
Copy link
Contributor

Closes: #12701

klkvr
klkvr previously requested changes Dec 3, 2024
crates/primitives/src/receipt.rs Outdated Show resolved Hide resolved
Comment on lines 133 to 220
self.rlp_header_with_bloom(bloom).encode(out);
self.rlp_encode_fields_with_bloom(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 is wrong, the rlp encoding should be equivalent to ReceiptWithBloomEncoder::encode_inner(... true) and EIP-2718 should be equivalent to encode_inner(..., false)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have now removed the ReceiptWithBloomEncoder struct and transferred some functions to the receipt impl. But I believe I could instead shorten the Receipt impl block as well and directly use ReceiptWithBloom encoding functions? But then this Receipt as extra fields for OP and also tx_type.. What do you say?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, shall I try removing ReceiptWithBloomRef struct as well? Looking to shorten the code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i have now removed the ReceiptWithBloomEncoder struct and transferred some functions to the receipt impl. But I believe I could instead shorten the Receipt impl block as well and directly use ReceiptWithBloom encoding functions? But then this Receipt as extra fields for OP and also tx_type.. What do you say?

no, we need to keep the current Receipt type as is, and define all encoding on it

ReceiptWithBloomRef should be removed now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Will do.

@royvardhan
Copy link
Contributor Author

@klkvr Awaiting your inputs.

@royvardhan
Copy link
Contributor Author

Thanks @klkvr 🫡

@royvardhan royvardhan marked this pull request as ready for review December 6, 2024 17:25
@royvardhan royvardhan requested a review from rkrasiuk as a code owner December 6, 2024 17:25
@@ -654,7 +471,7 @@ mod tests {
#[cfg(feature = "optimism")]
#[test]
fn decode_deposit_receipt_regolith_roundtrip() {
let data = hex!("7ef9010c0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf");
let data = hex!("b901107ef9010c0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf");
Copy link
Collaborator

Choose a reason for hiding this comment

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

had to update those tests because they were attempting to us ReceiptWithBloom::decode on EIP-2718 encoding while it expects network encoding

this was working before because the decoding impl wasn't strict enough but this kind of encoding shouldn't really happen at all as receipts are only being decoded in p2p

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

@mattsse mattsse added this pull request to the merge queue Dec 6, 2024
Merged via the queue into paradigmxyz:main with commit cd13bd9 Dec 6, 2024
42 checks passed
lean-apple pushed a commit to lean-apple/reth that referenced this pull request Dec 12, 2024
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace reth ReceiptWithBloom type with alloy's ReceiptWithBloom
3 participants