Repository navigation
Vote Account v5: effective commission in vote state #687
Replies: 4 comments 16 replies
|
@buffalojoec @AshwinSekar i saw the V5 discussion in #development today. Two of the questions i had asked here are getting answered there itself, which fields to remove ( One thing which is not coming up in that thread is the commission lookup. As of now the rate for epoch E is sitting in the epoch stakes snapshots, which runtime is keeping outside of the accounts db only. #677 brings it inside the account, vote program writes If you guys are doing one single V5 SIMD then this section should go in the same and i can contribute that part. Otherwise #677 remains as the commission SIMD on top of your V5 and i will rebase once your layout is finalised. Only one design question i want to close first, effective rate should come from vote state or from the epoch stakes account in SIMD-0511? |
|
Here's my proposed layout for Vote State V5. I believe it meets all the different use-cases. It's 4-byte aligned and can be zero-copy accessed, as everything is statically laid out. | Offset | Size | Field | Type |
|-------:|-----:|-------|------|
| 0 | 4 | discriminant | `u32` = `4` |
| 4 | 32 | node_pubkey | `Pubkey` |
| 36 | 32 | authorized_withdrawer | `Pubkey` |
| 68 | 32 | inflation_rewards_collector | `Pubkey` |
| 100 | 32 | block_revenue_collector | `Pubkey` |
| 132 | 2 | inflation_rewards_commission_bps | `u16` |
| 134 | 2 | block_revenue_commission_bps | `u16` |
| 136 | 8 | pending_delegator_rewards | `u64` |
| 144 | 12 | location | `x: i32, y: i32, z: i32` |
| 156 | 48 | bls_pubkey_compressed | `[u8; 48]` |
| 204 | 8 | latest_vote | `u64` |
| 212 | 8 | root_slot | `u64`, `u64::MAX` = none |
| 220 | 8 | authorized_voters_len | `u64`, at most 4 |
| 228 | 160 | authorized_voters | `[(epoch: u64, pubkey: Pubkey); 4]` |
| 388 | 8 | epoch_credits_len | `u64`, at most 64 |
| 396 | 1536 | epoch_credits | `[(epoch: u64, credits: u64, prev_credits: u64); 64]` |
| 1932 | 16 | last_timestamp | `(slot: u64, timestamp: i64)` |If this looks good to everyone I'll open a new SIMD. |
|
We found some perf regressions in replay times because with Alpenglow we are updating vote accounts of all active validators each slot. On mainnet, that is around 700 and in the worst case, that can be 2k. We recently worked on various optimisations to alleviate the situation in a way that is backwards compatible. Currently, the Moving forward, I want to propose that these fields for all the vote accounts be stored in a single PDA on chain. I haven't fully worked out the details but essentially, we would remove This way, we should be able to get away with updating just a single account each slot instead of vote accounts of every active validator. |
|
i think the title of this discussion is no longer descriptive of the initiative? i find redescribing the epoch assignments here unnecessary. what we want is for changes to commission, authorized voter (bls now?) key, (and collectors?) to be latched to the epoch for which they are first applied to the vat quorum and leader schedule. then there is no need to retain beyond rewards distribution for the corresponding epoch, though i don't believe there is any need to clean these up or perpetuate them into future epochs. just let them fall off as the operator makes changes i'm opposed to any onchain data retention beyond what the protocol requires. read layer convenience does not belong under consensus some other things that we've historically discussed adding to vote state
of lessor confidence that recording state would add a benefit over a pure logic implementation
|
Uh oh!
There was an error while loading. Please reload this page.
This is the discussion thread for SIMD-0677 (#677). The PR went up without one, which was my mistake. It is back in draft until this settles.
Problem
SIMD-0249 delays commission updates: rewards earned in epoch
Euse the commission from vote state at the start ofE - 1, and SIMD-0123 does the same for block revenue. So the rate that applies to an epoch is not in the vote account. The account shows the rate that applies two epoch boundaries from now, and the rate in force comes from epoch-boundary state kept outside the accounts database, as raised in #583. An on-chain program cannot read the rate in force at all. @joncinque noted in #583 that fixing this for commission needs new vote state.Separately, SIMD-0674 (#674) needs a new vote state version for its location field, and @buffalojoec suggested one V5 SIMD covering both, plus cleanup of unused fields.
Proposal
Vote state v5:
(effective epoch, bps)entries. The Vote program writes an entry onUpdateCommission/UpdateCommissionBpswith effective epoch = current epoch + 2. The runtime only reads: the rate for epochEis the entry with the greatest epoch not afterE, with today's lookup as the fallback for accounts that are not converted yet. Reward amounts do not change.locationfield from SIMD-0674.votes, which SIMD-0357 says stays empty under Alpenglow.Why not just current + next
An update in epoch
Xapplies fromX + 2. A validator can update inX - 1and again inX, so during epochXthe account has to hold three rates: the one in force, one effective fromX + 1and one effective fromX + 2. With two values, the second update has to replace the first pending one, and that changes what SIMD-0249 pays today.Three entries is the minimum that keeps today's behaviour. The PR text has four, the extra one keeping the previous epoch's rate readable. That one is history, and I'll cut it.
Questions
votesremoval as well, or should those stay separate?votesties V5 to the Alpenglow migration. Is that acceptable for SIMD-0674?All reactions