avalanchego
avalanchego copied to clipboard
Continuous Staking 1 - Introduce stakers update operation
Why this should be merged
Continuous staking is the upcoming feature that will allow long-term stakers to automatically restake past the specified staking period without signiging a new transaction.
The object state.Staker
is the in-memory representation of a staker in the platformvm
.
Currently state.Staker
is an immutable object that can be added/deleted/queries, but not updated.
Continuous staking requires the ability to:
- "shift a staker", that is to update
state.Staker
's time attributes (StartTIme/EndTime/NextTime). - update staker weight, to allow reward compounding across different staking periods.
This PR unlock the possibility to do so.
How this works
First off, this PR is based off:
- https://github.com/ava-labs/avalanchego/pull/1510
Added UpdateCurrentValidator/Delegator operations to P-chain staker repositories. Refactored maskedIterator implementation to allow handling of updated stakers.
How this was tested
Some more property tests for stakers update operations. Some more property tests for validators set update following stakers operations. Highlighted different behavious in state.State and state.Diff with UTs Increased state package UT coverage to 52.3%
This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen
label will cause this PR to ignore lifecycle events.