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

Dynamic Bitfield Length #6757

Open
AgeManning opened this issue Jan 7, 2025 · 0 comments
Open

Dynamic Bitfield Length #6757

AgeManning opened this issue Jan 7, 2025 · 0 comments
Assignees
Labels
consensus An issue/PR that touches consensus code, such as state_processing or block verification. Networking

Comments

@AgeManning
Copy link
Member

Description

It would be nice to have a Bitfield of dynamic length, that implements SSZ encoding/deocding. Currently we have fixed-length types, which requires the length of the object to be known at compile time. This is particularly annoying with the ENR bitfields. It means that anything that touches reads the bitfield ENR now has to have a generic which fixes the bitfield length. This typically means threading through the E: EthSpec generic.

Adjusting the length changes the merklisation of the ENR, however, to my knowledge we never merkalize an ENR and so a dynamic length bitfield should be fine and we can remove a bunch of generics in various parts of the network code.

Implementaiton

The current bitfields are here: https://github.com/sigp/ethereum_ssz/blob/main/ssz/src/bitfield.rs#L115

Making a version that is dynamic and then using this in the Lighthouse code, eg https://github.com/sigp/lighthouse/blob/stable/beacon_node/lighthouse_network/src/discovery/enr.rs#L34

@michaelsproul michaelsproul added consensus An issue/PR that touches consensus code, such as state_processing or block verification. Networking labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus An issue/PR that touches consensus code, such as state_processing or block verification. Networking
Projects
None yet
Development

No branches or pull requests

3 participants