feat: load epoch schedule from genesis.bin for warmup-aware epoch math - #51
feat: load epoch schedule from genesis.bin for warmup-aware epoch math#51Mctursh wants to merge 6 commits into
Conversation
| ))) | ||
| } | ||
|
|
||
| pub async fn load_epoch_schedule(&self) -> EpochSchedule { |
There was a problem hiding this comment.
Instead of storing this in the databases, couldn't this be loaded from a genesis.bin file? If you want to have epoch schedule calculations you can add genesis.bin to the config file of superbank?
Otherwise we add a full schema for just a single row that never changes.
There was a problem hiding this comment.
Agreed. genesis.bin would provide us a more SVM generic interface that can support a wider range of chains/networks.
It's also going to be needed for the superbank-verify PoH workflows, so will serve multiple purposes if it's included.
There was a problem hiding this comment.
Makes sense, agreed with both of you. I'll rework the PR to load the schedule from a genesis.bin path in the config instead of the ClickHouse table.
There was a problem hiding this comment.
Pushed the rework. The epoch_schedule ClickHouse table and the ingestor fetch are gone. The RPC now loads the schedule from a genesis.bin (``--genesis-path/GENESIS_PATH`) at startup. No path set falls back to the standard no-warmup schedule, which is what mainnet and devnet actually return (checked against live RPC); testnet runs a warmup schedule, so point `--genesis-path` at its genesis there. A set-but-unreadable path fails boot instead of silently guessing.
Kept the genesis loading in its own module so it's easy to reuse for the superbank-verify PoH work later. getInflationReward reads the schedule from state the same way, just populated from genesis now.
…ch-schedule-ingest-store # Conflicts: # Cargo.lock # crates/superbank-rpc/src/clickhouse/blocks.rs
|
GoReleaser hit File exists (os error 17) after every crate built. It passed on the parent commit 919cb87, and the only change since is a two-line doc edit, so it's not from this PR. |
Loads the cluster's epoch schedule from a
genesis.binfile so warmup-aware epoch math (getInflationReward) uses the real network schedule instead of a hardcoded constant.Per review, this moved from storing the schedule in a ClickHouse table to reading it from
genesis.bin, the canonical per-network source, so there's no full schema for one immutable row.How it works
--genesis-path/GENESIS_PATH(optional): path to the cluster'sgenesis.bin; the RPC reads theEpochSchedulefrom it once at startup intoAppState.--genesis-paththere.What changed
epoch_scheduleClickHouse table (local/cluster/replicated DDL + the k8s apply step) and the ingestor-sidegetEpochSchedulefetch.getInflationRewardreads the schedule fromAppState(genesis or the fallback); its query path is otherwise unchanged.superbank-verifyPoH work can reuse it.Testing
Unit tests cover the genesis decode (round-trip + malformed + file-not-found) and the epoch-bounds math (mainnet-matches-old vs warmup-differs).
getEpochSchedule(#36) still returns a hardcoded schedule; wiring that to this shared schedule is the follow-up, along withgetEpochInfo(#30) once it lands.Closes #47.