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 rlp support for sealed types #11484

Closed
Tracked by #12575
mattsse opened this issue Oct 4, 2024 · 3 comments
Closed
Tracked by #12575

Remove rlp support for sealed types #11484

mattsse opened this issue Oct 4, 2024 · 3 comments
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 4, 2024

Describe the feature

ref #11123

we have rlp support for sealed types

impl Encodable for SealedHeader {
fn encode(&self, out: &mut dyn BufMut) {
self.header.encode(out);
}
}
impl Decodable for SealedHeader {
fn decode(buf: &mut &[u8]) -> alloy_rlp::Result<Self> {
let b = &mut &**buf;
let started_len = buf.len();
// decode the header from temp buffer
let header = Header::decode(b)?;
// hash the consumed bytes, the rlp encoded header
let consumed = started_len - b.len();
let hash = keccak256(&buf[..consumed]);
// update original buffer
*buf = *b;
Ok(Self { header, hash })
}
}

this should never be used because the hash is recovered and never encoded in any payload

TODO

  • remove rlp support from sealed types, seems pointless, especially if there's a deref and the type should be created via decode + seal

Additional context

cc @greged93 @emhane

ref alloy-rs/core#754

No response

@mattsse mattsse added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Oct 4, 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 4, 2024
@edisontim
Copy link
Contributor

Hello, can I take this one ?

@mattsse
Copy link
Collaborator Author

mattsse commented Oct 4, 2024

assigned

@mattsse
Copy link
Collaborator Author

mattsse commented Oct 4, 2024

oh actually I changed my mind about this after looking at the rlpdecode impl

because this is actually nice to have

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
Archived in project
Development

No branches or pull requests

2 participants