Skip to content

Commit 99e70e6

Browse files
authored
chore!: depositAmount and minimumStake naming (#16148)
Addressing feedback from @benesjan. Also using his prompt idea to see how well it works. --- ## Summary This PR refactors validator staking terminology throughout the Aztec codebase to improve clarity and better reflect the purpose of key staking parameters. The main changes involve renaming `depositAmount` to `activationThreshold` and `minimumStake` to `ejectionThreshold`, along with related library and method renames. ## Key Changes ### Parameter Renames - **`depositAmount` → `activationThreshold`**: The amount of tokens required to activate a validator and join the validator set - **`minimumStake` → `ejectionThreshold`**: The minimum token balance below which a validator is ejected from the active set ### Contract & Library Updates - **Solidity Contracts**: Updated all references in `Rollup.sol`, `IStaking.sol`, `GSE.sol`, and related contracts - **Libraries**: - `UserLib` → `CheckpointedUintLib` (more descriptive name for checkpoint management) - `DelegationLib` → `StakeDelegationLib` (clearer purpose indication) - **Methods**: `finaliseHelper()` → `finaliseWithdraw()` in GSE contract for better clarity ### Configuration & Environment Variables - Updated environment variables: - `AZTEC_DEPOSIT_AMOUNT` → `AZTEC_ACTIVATION_THRESHOLD` - `AZTEC_MINIMUM_STAKE` → `AZTEC_EJECTION_THRESHOLD` - Updated all configuration files, test constants, and deployment scripts ### Documentation - Updated CLI reference documentation to reflect new parameter names - Updated all code comments to use the new terminology ## Benefits 1. **Improved Clarity**: The new names clearly indicate the purpose of each parameter - one for entering the validator set, one for being removed from it 2. **Better Developer Experience**: Developers can immediately understand what these thresholds represent without needing additional context 3. **Consistency**: Uniform terminology across the entire codebase reduces confusion 4. **Future-Proof**: The new names are more generic and adaptable to potential future staking mechanism changes ## Breaking Changes ⚠️ **This is a breaking change** that affects: 1. **Environment Variables**: Any deployment or configuration using the old environment variable names (`AZTEC_DEPOSIT_AMOUNT`, `AZTEC_MINIMUM_STAKE`) must be updated 2. **Contract Interfaces**: External systems calling `getDepositAmount()`, `getMinimumStake()`, or `finaliseHelper()` must update to use the new method names 3. **Configuration Files**: Any JSON/YAML configuration files using the old parameter names need updates 4. **Deployment Scripts**: Custom deployment scripts referencing the old names will need modification ### Migration Guide - Replace `depositAmount` with `activationThreshold` in all configurations - Replace `minimumStake` with `ejectionThreshold` in all configurations - Update contract calls: - `getDepositAmount()` → `getActivationThreshold()` - `getMinimumStake()` → `getEjectionThreshold()` - `finaliseHelper()` → `finaliseWithdraw()`
1 parent 5d75421 commit 99e70e6

78 files changed

Lines changed: 862 additions & 735 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/docs/the_aztec_network/guides/run_nodes/cli_reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,10 @@ If two subsystems can contain the same configuration option, only one needs to b
381381
--archiver.aztecProofSubmissionEpochs <value> (default: 1) ($AZTEC_PROOF_SUBMISSION_EPOCHS)
382382
The number of epochs after an epoch ends that proofs are still accepted.
383383
384-
--archiver.depositAmount <value> (default: 100000000000000000000) ($AZTEC_DEPOSIT_AMOUNT)
384+
--archiver.activationThreshold <value> (default: 100000000000000000000) ($AZTEC_ACTIVATION_THRESHOLD)
385385
The deposit amount for a validator
386386
387-
--archiver.minimumStake <value> (default: 50000000000000000000) ($AZTEC_MINIMUM_STAKE)
387+
--archiver.ejectionThreshold <value> (default: 50000000000000000000) ($AZTEC_EJECTION_THRESHOLD)
388388
The minimum stake for a validator.
389389
390390
--archiver.slashingQuorum <value> (default: 101) ($AZTEC_SLASHING_QUORUM)

l1-contracts/script/InternalGov.s.sol

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ contract GovScript is Test {
8484
emit log_named_uint(
8585
"\tNumber of attestors ", IStaking(address(rollup)).getActiveAttesterCount()
8686
);
87-
emit log_named_decimal_uint("\tMinimum stake", IStaking(address(rollup)).getDepositAmount(), 18);
87+
emit log_named_decimal_uint(
88+
"\tMinimum stake", IStaking(address(rollup)).getActivationThreshold(), 18
89+
);
8890

8991
emit log_named_address("# Governance", address(governance));
9092
Configuration memory config = governance.getConfiguration();

l1-contracts/src/core/Rollup.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ contract Rollup is IStaking, IValidatorSelection, IRollup, RollupCore {
224224
return StakingLib.getStorage().stakingAsset;
225225
}
226226

227-
function getMinimumStake() external view override(IStaking) returns (uint256) {
228-
return StakingLib.getStorage().gse.MINIMUM_STAKE();
227+
function getEjectionThreshold() external view override(IStaking) returns (uint256) {
228+
return StakingLib.getStorage().gse.EJECTION_THRESHOLD();
229229
}
230230

231-
function getDepositAmount() external view override(IStaking) returns (uint256) {
232-
return StakingLib.getStorage().gse.DEPOSIT_AMOUNT();
231+
function getActivationThreshold() external view override(IStaking) returns (uint256) {
232+
return StakingLib.getStorage().gse.ACTIVATION_THRESHOLD();
233233
}
234234

235235
function getExitDelay() external view override(IStaking) returns (Timestamp) {

l1-contracts/src/core/interfaces/IStaking.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ interface IStaking is IStakingCore {
3737
function getAttesterAtIndex(uint256 _index) external view returns (address);
3838
function getSlasher() external view returns (address);
3939
function getStakingAsset() external view returns (IERC20);
40-
function getDepositAmount() external view returns (uint256);
41-
function getMinimumStake() external view returns (uint256);
40+
function getActivationThreshold() external view returns (uint256);
41+
function getEjectionThreshold() external view returns (uint256);
4242
function getExitDelay() external view returns (Timestamp);
4343
function getGSE() external view returns (GSE);
4444
function getAttesterView(address _attester) external view returns (AttesterView memory);

l1-contracts/src/core/libraries/rollup/StakingLib.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ library StakingLib {
150150

151151
delete store.exits[_attester];
152152

153-
store.gse.finaliseHelper(exit.withdrawalId);
153+
store.gse.finaliseWithdraw(exit.withdrawalId);
154154
store.stakingAsset.transfer(exit.recipientOrWithdrawer, exit.amount);
155155

156156
emit IStakingCore.WithdrawFinalised(_attester, exit.recipientOrWithdrawer, exit.amount);
@@ -225,7 +225,7 @@ library StakingLib {
225225
StakingStorage storage store = getStorage();
226226
// We don't allow deposits, if we are currently exiting.
227227
require(!store.exits[_attester].exists, Errors.Staking__AlreadyExiting(_attester));
228-
uint256 amount = store.gse.DEPOSIT_AMOUNT();
228+
uint256 amount = store.gse.ACTIVATION_THRESHOLD();
229229

230230
store.stakingAsset.transferFrom(msg.sender, address(this), amount);
231231
store.entryQueue.enqueue(_attester, _withdrawer, _moveWithLatestRollup);
@@ -243,7 +243,7 @@ library StakingLib {
243243
store.nextFlushableEpoch <= currentEpoch, Errors.Staking__QueueAlreadyFlushed(currentEpoch)
244244
);
245245
store.nextFlushableEpoch = currentEpoch + Epoch.wrap(1);
246-
uint256 amount = store.gse.DEPOSIT_AMOUNT();
246+
uint256 amount = store.gse.ACTIVATION_THRESHOLD();
247247

248248
uint256 queueLength = store.entryQueue.length();
249249
uint256 numToDequeue = Math.min(_maxAddableValidators, queueLength);

0 commit comments

Comments
 (0)