Skip to content

Conversation

@twoeths
Copy link
Collaborator

@twoeths twoeths commented Oct 9, 2025

Motivation

  • we miss Block functions, that causes us to use SignedBlock everywhere
  • this is also not consistent to lodestar
  • it'll likely a blocker for spec test

Description

  • move functions from SignedBlock to Block, ensure the functions have the same signatures to the current lodestar
  • no pointer on wrapped enums because we already have pointers in embedded enumbs
    • instead of
pub const SignedBlock = union(enum) {
   regular: *const SignedBeaconBlock,
   blinded: *const SignedBlindedBeaconBlock,
}
  • this PR changes to
pub const SignedBlock = union(enum) {
    regular: SignedBeaconBlock,
    blinded: SignedBlindedBeaconBlock,
}

because the last level already includes pointers

pub const SignedBeaconBlock = union(enum) {
    phase0: *const ssz.phase0.SignedBeaconBlock.Type,
    altair: *const ssz.altair.SignedBeaconBlock.Type,
    bellatrix: *const ssz.bellatrix.SignedBeaconBlock.Type,
    capella: *const ssz.capella.SignedBeaconBlock.Type,
    deneb: *const ssz.deneb.SignedBeaconBlock.Type,
    electra: *const ssz.electra.SignedBeaconBlock.Type,
  • no need pointer in wrapped enum types, ie use Block instead of *const Block in function signatures because we already have pointers inside the last level
pub const BeaconBlock = union(enum) {
    phase0: *const ssz.phase0.BeaconBlock.Type,
    altair: *const ssz.altair.BeaconBlock.Type,
    bellatrix: *const ssz.bellatrix.BeaconBlock.Type,
    capella: *const ssz.capella.BeaconBlock.Type,
    deneb: *const ssz.deneb.BeaconBlock.Type,
    electra: *const ssz.electra.BeaconBlock.Type,

Closes #50

@twoeths twoeths marked this pull request as ready for review October 9, 2025 08:26
@twoeths twoeths force-pushed the te/block_functions branch from 491867d to 56e5f28 Compare October 18, 2025 05:35
@twoeths twoeths mentioned this pull request Oct 21, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance Block enum

1 participant