Skip to main content

Module arithmetic

Module arithmetic 

Source
Expand description

Pure height-to-epoch arithmetic. Filled by the height_epoch_arithmetic domain (HEA-*).

§arithmetic — pure height-to-epoch mapping functions

Introduced by: STR-002 — Module hierarchy (SPEC §13).

Owners: HEA-001 through HEA-004 (Phase 4).

Spec reference: SPEC.md §5

Functions§

ensure_checkpoint_block_empty
Enforces the empty-checkpoint-block invariant.
epoch_checkpoint_height
Returns the checkpoint (last) L2 block height in the given epoch.
epoch_for_block_height
Maps an L2 block height to its epoch number.
first_height_in_epoch
Returns the first L2 block height in the given epoch.
is_checkpoint_class_block
Returns true if height is genesis or an epoch checkpoint block.
is_epoch_checkpoint_block
Returns true if height is an epoch checkpoint block (divisible by BLOCKS_PER_EPOCH).
is_first_block_after_epoch_checkpoint
Returns true if height is the first block after an epoch checkpoint.
is_genesis_checkpoint_block
Returns true if height is the genesis checkpoint block (height == GENESIS_HEIGHT).
l1_range_for_epoch
Returns the (start_l1_height, end_l1_height) for a given epoch.
last_committed_height_in_epoch
Returns the last L2 height included in this epoch’s checkpoint.