Repository navigation
On-Chain Epoch Stakes #511
Replies: 17 comments 52 replies
|
Preliminary implementation can be found here: https://github.com/anza-xyz/agave/compare/master...sam0x17:agave:simd-leader-schedule?expand=1 |
|
i'll ask again. why do we want this instead of epoch stakes? epoch stakes is infinitely more valuable and the leader schedule can be calculated directly from it |
|
If "epoch stakes" means what I think it means, that does sound more valuable. Are there any links to that proposal? |
|
I don't think it fundamentally fix any issue in real system. Yes I would get change while I subscribe to geyser, but if im not connected while this updates comes in, I still have to do a rpc call somewhere else the get the current epoch schedule. What might be more useful could be streaming out gossip info change via a sysaccount update. |
can you elaborate the proposed seeds? |
|
If we put the epoch stakes on-chain does that mean we can completely remove them from the snapshot manifest? @brooksprumo |
|
Couple thoughts as I read through:
|
|
+1 from the dev side. For any tooling that correlates per-leader data the current pattern is always the same: subscribe to geyser, then poll getLeaderSchedule / getSlotLeaders separately to tag slots with their leader, then re-poll at each epoch boundary. Every tool ends up reimplementing it. Having the schedule as an account collapses all that to a single geyser subscription, which is a big quality-of-life win. Also opens up on-chain use cases where you want a program to reason about the current or past leader directly without off-chain lookups, which isn't really something you can do cleanly today. Happy to support the follow-up SIMD for streaming gossip contact info via geyser once this one lands. |
Pivot: Scope Narrowed to Epoch Stakes OnlyAfter discussion with Brennan and others, we are narrowing the scope of this SIMD to epoch stakes only. The on-chain leader schedule has been split out into a separate, future SIMD. The SIMD itself, the reference implementation, and this initial post have all been updated accordingly. Why Narrow
What This SIMD Now DoesOne account per epoch at Two Planned Sidecar SIMDsThese are out of scope for this proposal but are on the roadmap:
Updated DraftFull SIMD with detailed binary format, size analysis, alternatives considered, and security considerations: Reference implementation in the Agave branch has been updated to match: leader schedule binary format removed, native program crate renamed from Feedback Welcome
|
|
ACK. I support advancing this from SIMD Discussion --> SIMD (and review) |
|
I think we still need to consider whether this is worth doing. Is this a priority? What does this unlock? There are a few motivations mentioned - what's the biggest win here? We should make sure that this change is worth the time investment. |
|
the wins are basically everything else is dubious/speculative i'm also in favor of advancing to simd. unclear where i'd prioritize atm |
|
I had a look at what it would take to remove the Per-vote account:
And then for each stake delegation:
|
|
Putting this onchain would also make it possible to expose Alpenglow validator rank through the read layer without too much surgery. Are we ready to promote to SIMD? Anything else that needs to be settled first? |
|
I think it's ready to promote. I refreshed the draft and implementation against current master, including the vote-state v4 fields, Alpenglow BLS keys, and the canonical validator rank. SIMD-0558 doesn't conflict with this. It exposes leader lookup through a syscall, while this provides the underlying epoch stake data. The only thing I'd still like feedback on is whether these accounts should stay around forever or use a bounded retention window, but I don't think that needs to block SIMD review. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Idea
Publish the epoch stake snapshot as bank-hashed account state. The runtime writes one account per epoch at
PDA(program_id, [b"epoch_stakes", epoch.to_le_bytes()]), owned by a native program that rejects instructions.Each account carries the vote-account stake mapping, vote account v4 reward fields, compressed Alpenglow BLS key, and canonical Alpenglow validator rank. This gives programs and read-layer consumers one deterministic source without making them reproduce the runtime's eligibility and deduplication rules.
Why
Proposed approach
EpochStakes11111111111111111111111111111111.u16::MAXwhen the validator is not in the active setPer-stake-delegation data is intentionally excluded. Agave no longer serializes it in
epoch_stakes, and it can be recovered from stake accounts.Relationship to SIMD-0558
SIMD-0558 exposes current and next leader lookup through a syscall. This proposal publishes the underlying epoch stake and rank data. The two do not share an account or ABI: programs needing a leader lookup can use SIMD-0558, while read-layer and off-chain consumers can use this account directly or derive a full schedule.
SIMD-0180 also fits this design because both use vote-account keys.
Open question
The draft keeps one immutable account per epoch. A bounded retention window, such as the three recent epochs proposed during the earlier review, would avoid permanent state growth. The epoch-keyed address scheme supports either policy, so this can be settled during SIMD review without changing the schema.
Draft and implementation
All reactions