Skip to content

Conversation

@rrazvan1
Copy link
Contributor

@rrazvan1 rrazvan1 commented Jan 8, 2026

Changes:

  • Period can be changed mid-cycle
  • Excess above MaxStakeLimit is withdrawn
  • Auto-restaking happens only if the validator is eligible for rewards
  • UTXOs clarification
  • Improve naming

@rrazvan1 rrazvan1 force-pushed the acp-236/continuous-staking-iteration-2 branch 2 times, most recently from a886a51 to d33f626 Compare January 8, 2026 12:55
…awn, auto-restaking only if eligible for rewards
@rrazvan1 rrazvan1 force-pushed the acp-236/continuous-staking-iteration-2 branch from d33f626 to 3cf6474 Compare January 9, 2026 12:59
@rrazvan1 rrazvan1 marked this pull request as ready for review January 14, 2026 11:55
Continuous staking introduces a mechanism that allows validators to remain staked indefinitely, without having to manually submit new staking transactions at the end of each period.

Instead of committing to a fixed endtime upfront, validators specify a cycle duration (period) and an `AutoRenewRewardsShares` value when they submit an `AddContinuousValidatorTx`. At the end of each cycle, the validator is automatically restaked for a new cycle of the same duration, unless the validator submits a `SetAutoRenewPolicyTx` with `AutoRenewRewardsShares` set to the sentinel value `MaxUint64`. If a validator submits such a `SetAutoRenewPolicyTx` during a cycle, the validator will continue validating until the end of the current cycle, at which point the validator exits and the funds are unlocked. Both `AddContinuousValidatorTx` and `SetAutoRenewPolicyTx` include the `AutoRenewRewardsShares` field, which controls the automatic restaking or withdrawal behavior of the rewards at the end of each cycle. The minimum and maximum cycle lengths follow the same protocol parameters as before (`MinStakeDuration` and `MaxStakeDuration`).
Instead of committing to a fixed endtime upfront, validators specify a cycle duration (period) and an `AutoRestakeShares` value when they submit an `AddContinuousValidatorTx`. At the end of each cycle, the validator is automatically restaked for a new cycle. The validator (via `Owner`) may update the the auto-restake config at any time during a cycle; such updates take effect only at the end of the current cycle. To stop validating, the validator signals intent to exit by updating the next cycle’s period to `0`; this causes the validator to exit at the end of the current cycle and unlock the funds. The minimum and maximum cycle lengths follow the same protocol parameters as before (`MinStakeDuration` and `MaxStakeDuration`), and any updated period must also respect these limits (except the special value `0`, which means “stop”).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validator (via Owner) may update the the auto-restake config at any time during a cycle; such updates take effect only at the end of the current cycle.

A valuable question to answer would be " What if AutoRestakeShares is updated after uptime failure but before cycle end?"

Obviously it wouldn't have any effect since the validator will be forcefully exited at the end of the current cycle, but would this txn fail?

Copy link
Contributor Author

@rrazvan1 rrazvan1 Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That transaction will be executed successfully.
Rewards eligibility, as it is implemented right now, based on uptime, it's a subjective observation of a node, making it a non-deterministic check, that can not be included in a in TX validation.

Also, this is just a small UX improvement that would've added extra complexity.

@meaghanfitzgerald
Copy link
Contributor

Most of my comments are for clarity, including the differentiation of a planned graceful exit and a forced exit from the validator set. Also included a question about what would happen if someone tries to update their renewal rules if they already fail to meet uptime requirements for the current cycle

// 1_000_000 = restake 100% of rewards; withdraw 0%
// Sentinel value MaxUint64 indicates "stop at the end of current cycle".
AutoRenewRewardsShares uint32 `serialize:"true" json:"autoRenewRewardsShares"`
AutoRestakeShares uint32 `serialize:"true" json:"autoRestakeShares"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it would make more sense to use basis points (bips) here (1/10,000), which is an established way of representing percentages. It is slightly less precise, but 0.01% granularity should be more than enough.

Suggested change
AutoRestakeShares uint32 `serialize:"true" json:"autoRestakeShares"`
AutoRestakeRewardsBips uint32 `serialize:"true" json:"autoRestakeRewardsBips"`

Copy link
Contributor Author

@rrazvan1 rrazvan1 Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avalanchego codebase is already using a 1/1,000,000 denominator for delegation fee, because of which there are existing helper functions.

Thus, using the same denominator for the autorestake percentage keeps the codebase cleaner and easier to maintain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! I didn't know that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants