feat: ingest and store the epoch schedule for warmup-aware epoch math#51
Open
Mctursh wants to merge 3 commits into
Open
feat: ingest and store the epoch schedule for warmup-aware epoch math#51Mctursh wants to merge 3 commits into
Mctursh wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the epoch math use the cluster's real schedule instead of the hardcoded mainnet constant.
What it does
RPC_URLis set, fetchesgetEpochScheduleat startup and writes it to a new single-rowepoch_scheduletable. Best-effort, a failure logs and doesn't block ingestion.AppState. The read is outsidecreate_tables(), so a missing table doesn't break existing deployments. It falls back to the mainnet schedule (without_warmup) and logs which path it took.getInflationRewardderives its default epoch and slot bounds from the stored schedule.getEpochInfo(feat: implement getEpochInfo RPC method #30) andgetEpochSchedule(feat: implement getEpochSchedule RPC method #36) are still open, so those are a small follow-up once they merge.Your two calls on #47
solana-epoch-scheduleis already in the tree viasolana-sdk, so this just promotes it to a direct dep. Zero added build cost.RPC_URLinstead of the config flags you floated on Ingest and store the epoch schedule so the epoch methods are correct off mainnet #47, since the cluster already knows its own schedule. The ingestor just pulls it from whatever clusterRPC_URLpoints at (devnet/testnet/etc). Can add explicit override flags on top if you'd rather have that knob.Singleton table
First single-row table in the repo, so worth a look at the shape.
ReplacingMergeTreekeyed onslots_per_epoch, so re-ingesting the same schedule collapses to one row; cluster and replicated wrap it inDistributedlike the rest. One difference from the other tables: they all pass a version column (ReplacingMergeTree(slot)), this one doesn't, which is fine while the schedule is immutable. If you'd want a re-ingest to overwrite instead, that's a version column plus a constant key.Testing
Unit tests cover the mainnet-matches-old-math and warmup-differs cases. E2E on a local ClickHouse: ingest wrote the row, RPC loaded it, and dropping the table fell back to mainnet and still started.
Closes #47.