Skip to content

Fork choice Store contains objects cross the spec versions #2333

Open
@hwwhww

Description

@hwwhww

Fork choice Store.blocks and Store.states

  • The Store storage is an abstract data structure that clients can design their own implementations.
    • The Store.blocks filed is type of Dict[Root, BeaconBlock].
  • In our spec presentation, BeaconBlock means the BeaconBlock of each spec.
    • However, right after the fork boundary, store contains both phase0.BeaconBlock and altair.BeaconBlock.
  • In the view of implementation, there should be only one head store object.
    • p.s. pyspec tests could choose to execute phase0.on_block or altair.on_block by the given block slot. Both with Altair store.

Proposed solution

  1. Define "Union" SignedBeaconBlock and BeaconBlock. Since it's fork choice storage and not consensus container, it's not necessary to be the SSZ Union type. Python Union might be fine enough.
  2. Add upgrade_to_altair_store(store: phase0.Store) -> altair.Store helper to handle the fork boundary transition.

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