-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Deduplicate primitive types and use alloy's existing types #7050
Comments
I'm open to either. I do think the Compact eth specific encoding is valuable (optimal / zero cost?) so if it's worth pulling out of reth we should do that. |
This issue is stale because it has been open for 21 days with no activity. |
hi @mattsse, have we decided which direction we should take on this one. I think alloy can benefit from this codec, we should move the codecs to alloy and reuse it in reth. |
this should be integrated in the codecs crate for alloy-eips types |
I can give it a try |
let's do this one by one, starting with:
we need compact codec tests from main, that we can use as test vectors for this I think you can use cargo expand on main and copy the trait impl to get started |
regarding the |
these should be implemented where the Compact trait is defined, we discarded the other option. we can feature gate this impls with like an alloy feature does that make sense? |
oh I see, this is definitely easier to implement. I thought we wanted to move the whole |
great! I think we can move the impls in a new alloy.rs file here reth/crates/storage/codecs/src/lib.rs Line 18 in 57e25be |
I will continue with Withdrawal, and AccessList then we can replace them in next PRs. |
cool! ty separately, we can now replace the reth_primitive::Log type in a separate pr |
Thanks @mattsse for replacing duplicate Withdrawl part, I was a bit busy. |
Describe the feature
ref alloy-rs/alloy#255
ref #5746
currently all codec traits are implemented in reth-primitives via derive macros, therefor we're duplicating types that already exists in alloy:
reth/crates/primitives/src/transaction/access_list.rs
Lines 43 to 46 in 9569692
reth/crates/primitives/src/withdrawal.rs
Lines 9 to 12 in 9569692
reth/crates/primitives/src/log.rs
Lines 6 to 9 in 9569692
In order to replace them, we need to impl all the codecs for alloy types.
This can be done in two ways:
reth/crates/storage/codecs/Cargo.toml
Line 2 in 9569692
since codecs are a reth thing, we could pursue option 2.
This however, would require implementing codecs manually, because derive is not possible
we could also spin out codecs which is just the Compact trait to it's standalone repo and make it a feature in alloy (option 1.)
reth/crates/storage/codecs/src/lib.rs
Line 36 in 9569692
wdyt @DaniPopes
Additional context
No response
The text was updated successfully, but these errors were encountered: