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 · 8 comments · May be fixed by #11956
Open

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

mattsse opened this issue Oct 17, 2024 · 8 comments · May be fixed by #11956
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?

@AlbionaHoti
Copy link

if you're not able to work on this @aroralanuk, let me know, would love to work on this

@aroralanuk
Copy link
Contributor

if you're not able to work on this @aroralanuk, let me know, would love to work on this

Hey @AlbionaHoti, give me 1 more day. Otherwise, I'll unassign myself and ping you here.

@aroralanuk aroralanuk linked a pull request Oct 22, 2024 that will close this issue
@aroralanuk aroralanuk removed their assignment Oct 24, 2024
@aroralanuk
Copy link
Contributor

@AlbionaHoti Hey, I have a hectic week ahead, so I won't be able to close this one. I'm unassigned myself if you wanna give it a go. Feel free to look at my wip PR.

@mattsse
Copy link
Collaborator Author

mattsse commented Oct 24, 2024

cool, ty!
taking this over

@DanielEmmanuel1
Copy link

Can I try solving this issue?

Background:
I am a Full-Stack Blockchain developer with ample expirience writing Rust and Solidity. I have built efficient and scalable applications and worked with libraries and frameworks, and I have a solid understanding of Rust's features and idioms.

My Proposed Solution ToTackle The Issue:

  1. Fully Qualified Paths: I'll will modify the code generation logic to use the fully qualified path for reth_codecs::Compact instead of relying on imports. This will reduce the clutter in the code.

  2. New Attribute Introduction: I'll will then design and implement a new attribute that can be used within the reth_codecs crate. This should function similarly to attributes used in the serde crate.

  3. Code Refactor: Then I will review and refactor existing code to replace all feature-gated use reth_codecs::Compact imports with the new fully qualified syntax.

  4. Testing: I will ensure that all existing tests pass and add new tests to verify that the new attribute and fully qualified paths work as expected.

  5. Documentation Update: Update the documentation to reflect these changes, including examples of how to use the new attribute.

@mattsse
Copy link
Collaborator Author

mattsse commented Oct 25, 2024

hey @AlbionaHoti do you still want to work on this?

@DanielEmmanuel1
Copy link

Can i be assigned this

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

Successfully merging a pull request may close this issue.

4 participants