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

use full qualified reth_codecs:: path + syntax when deriving reth_codecs::Compact #11862

Open
mattsse opened this issue Oct 17, 2024 · 1 comment
Assignees
Labels
C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented Oct 17, 2024

Describe the feature

currently we expect that Compact trait is in scope:

quote! {
impl Compact for #ident
}

hence we have a bunch of these:

#[cfg(feature = "reth-codec")]
use reth_codecs::{Compact, CompactZstd};

we can get rid of this by using the fully qualified path and syntax in the code we generate.

we also need a new attribute so that we can use this in the reth_codes crate itself, e.g.:

#[derive(Debug, Clone, PartialEq, Eq, Default, Compact)]
#[cfg_attr(test, derive(arbitrary::Arbitrary, serde::Serialize, serde::Deserialize))]
#[cfg_attr(test, crate::add_arbitrary_tests(compact))]
pub(crate) struct TxLegacy {

this should be similar to serde crate attribute

https://serde.rs/container-attrs.html#crate

so that we can use in the quote!

let reth_codecs = reth_codecs_path(); // TODO needs to check for `crate` attribute
quote!{
 impl #reth_codes::Compact ...

}

This task is done if we can remove all feature gated use reth_codecs::Compact imports

#11863 has some wip and can be taken over

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Oct 17, 2024
@mattsse mattsse added D-good-first-issue Nice and easy! A great choice to get started and removed S-needs-triage This issue needs to be labelled labels Oct 17, 2024
@aroralanuk
Copy link
Contributor

Can I take this one?

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 D-good-first-issue Nice and easy! A great choice to get started
Projects
Status: Todo
Development

No branches or pull requests

2 participants