Open
Milestone
Nov 17, 2025–Dec 31, 2025
SWRR - New Baker Selection
In depth review of other algorithms
Protocol
- Feature Flag (!19978 (merged))
-
Change the sampler to select bakers using the SWRR algorithm
- Implement SWRR (!20084 (merged))
- Implement baker selection with shift for rounds (!20084 (merged))
-
Plug in the new sampler (!20180)
- delegate_sampler for baking_rights_owner (with the feature flag)
- delegate_cycles: compute the rights for future cycles
- Update Credits for deactivated delegates at cycle end (!20180)
-
Benchmarks + optimizations
- Optimize IO accesses in SWRR algorithm (!20084 (merged))
- Cache access to selected baker list for a given cycle
- Optimize round 0 attribution for faster access (even for higher rounds)
Baker
- Rounds computation might need to be changed/optimized (through a change to the Validators RPC)
Client
Nothing to change
RPC
-
New RPCs
-
Return the current SWRR state (the remaining credits) (!20180)
- This would be useful if external tools try to reproduce the algorithm locally. This is the only state info they would need, in addition to the stake distribution
- Return the selected bakers for a given cycle (can specify the cycle, up to current + consensus_rights_delay) (!20180)
-
Return the current SWRR state (the remaining credits) (!20180)
-
Old RPC Changes
-
Validators
- Info remains consistent. However, the rounds computation might need to be optimized
-
Validators
Dissemination (tool providers, bakers…)
- Design document
- HLP
- Milestone
- Communication on the new RPC
- Communication on the other RPC changes
- Communication on the selection algorithm, upsides and downside (use Design doc as ref)
- Update Documentation and Changelog
Tests
-
RPC calls:
tezt/tests/RPC_test.ml -
Sampler
- Correct length
-
No empty value (
Signature.Public_key_hash.zero) - Craft a scenario (choose the values, number of bakers, etc...), and expect the exact result (computed by hand) (determinism test)
- Check Variance between -1 and 1 (for round 0) (number of blocks per cycle = mainnet value)
-
Credit
- Try inject value >> Int64.max in storage, run the sampler, see the result
-
get_baker-
Compare
Selected_bakersin storage withValidatorsRPC result
-
Compare
-
Deactivated delegates
- They have 0 credits (check multiple cycles)
- They don't appear in the sampler result in the storage
- Run the whole test suite with the flag on
-
Manual/Sandbox tests (checked with !20180)
- Run a baker in sandboxed mode, bake some cycles
-
Large scale tests
-
Testnet/Teztale
- Benchmark performance
-
Testnet/Teztale
Future Cleanup
- Remove alias sampler
- Remove Seed
- Remove Feature Flag
- Remove unused storages
Loading
Loading
Loading
Loading