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

Support skip attribute in RlpEncodable derive macro #1102

Closed
mattsse opened this issue Jan 31, 2023 · 5 comments · Fixed by #1116
Closed

Support skip attribute in RlpEncodable derive macro #1102

mattsse opened this issue Jan 31, 2023 · 5 comments · Fixed by #1116
Assignees
Labels
A-utils Related to commonly used utilities 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 Jan 31, 2023

Describe the feature

There are use cases where being able to skip fields during rlp encoding is useful:

#1101

Currently, we don't support this in the RlpEncodable derive macro.

TODO

add rlp(skip) field attribute support for RlpEncodable macro that should work the same as serde(skip).

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started labels Jan 31, 2023
@leruaa
Copy link
Contributor

leruaa commented Jan 31, 2023

I would like to take this on

@mattsse
Copy link
Collaborator Author

mattsse commented Jan 31, 2023

I guess we'd need rlp(default) as well for the RlpDecodeable macro

@leruaa
Copy link
Contributor

leruaa commented Feb 1, 2023

Yeah, I found this:

//! This library also supports up to 1 `#[rlp(default)]` in a struct,
//! which is similar to [`#[serde(default)]`](https://serde.rs/field-attrs.html#default)
//! with the caveat that we use the `Default` value if
//! the field deserialization fails, as we don't serialize field
//! names and there is no way to tell if it is present or not.

but looks like it's not implemented at all.

Do we just need rlp(default), or also rlp(default = "path") like in Serde?

@mattsse
Copy link
Collaborator Author

mattsse commented Feb 1, 2023

yeh I believe this was not implemented before the fork.
imo rlp(default) should be sufficient, path would be nice though.

@leruaa
Copy link
Contributor

leruaa commented Feb 1, 2023

I will see how to add path, I guess #1116 can be merged in the meantime.

@onbjerg onbjerg added the A-utils Related to commonly used utilities label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-utils Related to commonly used utilities C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants