reth icon indicating copy to clipboard operation
reth copied to clipboard

Add `Header` fields while maintaining backwards compatibility

Open joshieDo opened this issue 1 year ago • 1 comments

Describe the feature

With Prague coming up, we should take this into account.

Generally with Compact, the reader first reads a fixed size bitflag struct (eg. HeaderFlags) and uses that to read the number of bytes necessary for each field.

As long as there are bits available on this bitflag struct, we can keep adding new fields to Header under the form of Option<FIELD> while maintaing backwards compatability. Each Option<> uses one bit in the bitflag struct. However, we have reached the limit, there's only one bit left.

#[doc =
        "Fieldset that facilitates compacting the parent type. Used bytes: 4 | Unused bits: 1"]
        #[allow(clippy :: identity_op)]
        pub struct HeaderFlags {

The next Option<N> has to be something like Option<HeaderExt>. N can be whatever we want it to be. Previous instances of Header will read that bit flag as 0 and ignore that field, and the new Header changes will read that bit as 1 and decode it

Additional context

No response

joshieDo avatar Apr 23 '24 16:04 joshieDo

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] avatar May 15 '24 01:05 github-actions[bot]