[go: up one dir, main page]

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

remove proptest specific encoding logic #6503

Merged
merged 22 commits into from
Feb 28, 2024

Conversation

supernovahs
Copy link
Contributor

closes #6329

@supernovahs
Copy link
Contributor Author

Getting compiler error

error: local ambiguity when calling macro `prop_compose`: multiple parsing options: built-in NTs tt ('arg') or 1 other option.
   --> crates/primitives/src/header.rs:947:49
    |
947 |                 eip_4844_active in any::<bool>(),

Any idea why ?

@Rjected
Copy link
Member
Rjected commented Feb 9, 2024

Getting compiler error

error: local ambiguity when calling macro `prop_compose`: multiple parsing options: built-in NTs tt ('arg') or 1 other option.
   --> crates/primitives/src/header.rs:947:49
    |
947 |                 eip_4844_active in any::<bool>(),

Any idea why ?

This looks like an internal proptest macro thing, I'd start by either changing how compose is being used, check syntax with the proptest_compose source code, or if none of that works, just use something other than proptest_compose.

@supernovahs
Copy link
Contributor Author

I think I have to change this value for the tests to pass

const BLOCK_RLP: [u8; 610] = hex!("f9025ff901f7a0c86e8cc0310ae7c531c758678ddbfd16fc51c8cef8cec650b032de9869e8b94fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa050554882fbbda2c2fd93fdc466db9946ea262a67f7a76cc169e714f105ab583da00967f09ef1dfed20c0eacfaa94d5cd4002eda3242ac47eae68972d07b106d192a0e3c8b47fbfc94667ef4cceb17e5cc21e3b1eebd442cebb27f07562b33836290db90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001830f42408238108203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f862f860800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba072ed817487b84ba367d15d2f039b5fc5f087d0a8882fbdf73e8cb49357e1ce30a0403d800545b8fc544f92ce8124e2255f8c3c6af93f28243a120585d4c4c6a2a3c0");

@Rjected
Copy link
Member
Rjected commented Feb 13, 2024

I think I have to change this value for the tests to pass

const BLOCK_RLP: [u8; 610] = hex!("f9025ff901f7a0c86e8cc0310ae7c531c758678ddbfd16fc51c8cef8cec650b032de9869e8b94fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa050554882fbbda2c2fd93fdc466db9946ea262a67f7a76cc169e714f105ab583da00967f09ef1dfed20c0eacfaa94d5cd4002eda3242ac47eae68972d07b106d192a0e3c8b47fbfc94667ef4cceb17e5cc21e3b1eebd442cebb27f07562b33836290db90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001830f42408238108203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f862f860800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba072ed817487b84ba367d15d2f039b5fc5f087d0a8882fbdf73e8cb49357e1ce30a0403d800545b8fc544f92ce8124e2255f8c3c6af93f28243a120585d4c4c6a2a3c0");

no, that should not be changed unless it contains some of the "fake" values from the previous encoding impl. you'd have to manually check that the rlp string is correct

Copy link
Member
@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

some questions about derive_arbitrary impls, also looks like lints need to be fixed

crates/net/eth-wire/src/types/broadcast.rs Show resolved Hide resolved
Comment on lines 1075 to 922
// Set fields based on EIP-1559 activation
if header.base_fee_per_gas.is_none() {
// EIP-1559 not active, clear related fields
header.withdrawals_root = None;
header.blob_gas_used = None;
header.excess_blob_gas = None;
header.parent_beacon_block_root = None;
} else {
// 4895 is not active
if header.withdrawals_root.is_none() {
header.blob_gas_used = None;
header.excess_blob_gas = None;
header.parent_beacon_block_root = None;
} else {
// 4895 is active
if eip_4844_active {
// EIP-4844 is active
header.blob_gas_used = Some(blob_gas_used);
header.excess_blob_gas = Some(excess_blob_gas);
header.parent_beacon_block_root = Some(parent_beacon_block_root);
} else {
// EIP-4844 is not active
header.blob_gas_used = None;
header.excess_blob_gas = None;
header.parent_beacon_block_root = None;
};
Copy link
Member

Choose a reason for hiding this comment

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

I would try to flatten this if possible

crates/primitives/src/block.rs Show resolved Hide resolved
@supernovahs
Copy link
Contributor Author

I think I have to change this value for the tests to pass

const BLOCK_RLP: [u8; 610] = hex!("f9025ff901f7a0c86e8cc0310ae7c531c758678ddbfd16fc51c8cef8cec650b032de9869e8b94fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347942adc25665018aa1fe0e6bc666dac8fc2697ff9baa050554882fbbda2c2fd93fdc466db9946ea262a67f7a76cc169e714f105ab583da00967f09ef1dfed20c0eacfaa94d5cd4002eda3242ac47eae68972d07b106d192a0e3c8b47fbfc94667ef4cceb17e5cc21e3b1eebd442cebb27f07562b33836290db90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001830f42408238108203e800a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f862f860800a83061a8094095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba072ed817487b84ba367d15d2f039b5fc5f087d0a8882fbdf73e8cb49357e1ce30a0403d800545b8fc544f92ce8124e2255f8c3c6af93f28243a120585d4c4c6a2a3c0");

no, that should not be changed unless it contains some of the "fake" values from the previous encoding impl. you'd have to manually check that the rlp string is correct

yeah this encoding turned out to be correct after I checked manually

@supernovahs
Copy link
Contributor Author

lololol
I implemented manual impls for SealedHeader, not Header 🤣

@Rjected
Copy link
Member
Rjected commented Feb 16, 2024

hey @supernovahs any updates here?

@emhane emhane added C-enhancement New feature or request C-test A change that impacts how or what we test labels Feb 17, 2024
@supernovahs
Copy link
Contributor Author

@Rjected Are you ok with the current way of implementing manual impls for SealedHeader or do you want the Header Aribtrary impls to be implemented manually instead?
The latter also have some complexity of since it involves removing main_codec from many structs .

@Rjected
Copy link
Member
Rjected commented Feb 21, 2024

@Rjected Are you ok with the current way of implementing manual impls for SealedHeader or do you want the Header Aribtrary impls to be implemented manually instead? The latter also have some complexity of since it involves removing main_codec from many structs .

@supernovahs we should not remove main_codec, so implementing on sealedheader here is fine

@supernovahs
Copy link
Contributor Author

Looking

@supernovahs supernovahs marked this pull request as ready for review February 23, 2024 09:47
@supernovahs
Copy link
Contributor Author

ci issue i think

@mattsse mattsse requested a review from Rjected February 23, 2024 17:04
Copy link
Member
@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

a few comments and style nits, great progress!

crates/primitives/src/block.rs Show resolved Hide resolved
crates/primitives/src/block.rs Outdated Show resolved Hide resolved
crates/primitives/src/header.rs Outdated Show resolved Hide resolved
crates/primitives/src/header.rs Outdated Show resolved Hide resolved
crates/primitives/src/header.rs Show resolved Hide resolved
crates/net/eth-wire/src/types/blocks.rs Show resolved Hide resolved
crates/primitives/src/block.rs Outdated Show resolved Hide resolved
crates/primitives/src/header.rs Outdated Show resolved Hide resolved
crates/primitives/src/block.rs Outdated Show resolved Hide resolved
crates/primitives/src/block.rs Outdated Show resolved Hide resolved
crates/net/eth-wire/src/types/blocks.rs Outdated Show resolved Hide resolved
crates/primitives/src/block.rs Outdated Show resolved Hide resolved
@onbjerg
Copy link
Member
onbjerg commented Feb 26, 2024

few nits, looks great :)

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.

@Rjected please wrap up here

@Rjected Rjected self-requested a review February 28, 2024 21:32
Copy link
Member
@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

did a lot of cleanup, @onbjerg bump for review

@mattsse mattsse added this pull request to the merge queue Feb 28, 2024
Merged via the queue into paradigmxyz:main with commit 3519270 Feb 28, 2024
29 checks passed
fgimenez pushed a commit to fgimenez/reth that referenced this pull request Feb 29, 2024
Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remove proptest-specific encoding logic from Header
5 participants