Skip to content

Dynamic Bitfield Length #6757

Open
Open
@AgeManning

Description

@AgeManning

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

Metadata

Metadata

Assignees

Labels

NetworkingconsensusAn issue/PR that touches consensus code, such as state_processing or block verification.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions