Skip to content

Type-safe BuilderIndex #8676

@michaelsproul

Description

@michaelsproul

Description

The BuilderIndex in the spec is just a u64, but the max value (u64::MAX) is used to encode self-building.

If self-building sticks around, it might be nice to use the type system to keep track of "raw" builder indices (which may be u64::MAX), vs sanitised ones. There could be a method on raw builder index to convert to a clean one.

impl RawBuilderIndex {
    fn builder_index(self, proposer_index: u64) -> u64 {
        if self == u64::MAX { proposer_index } else { self }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions