|
| 1 | +# Allowlist Contract |
| 2 | + |
| 3 | +The Allowlist contract replaces the TokenStaking contract, enabling governance-controlled beta staker selection without requiring token staking. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Allowlist contract maintains compatibility with the existing WalletRegistry interface while providing a simpler, governance-controlled mechanism for managing beta stakers. Instead of requiring tokens to be staked, governance directly controls which operators can participate in the network and their respective weights. |
| 8 | + |
| 9 | +## Key Features |
| 10 | + |
| 11 | +- **Governance Control**: Only the contract owner (governance) can add staking providers or modify their weights |
| 12 | +- **Weight Management**: Supports weight decrease operations with the same delay mechanism as TokenStaking |
| 13 | +- **WalletRegistry Compatible**: Implements the same interface methods used by WalletRegistry |
| 14 | +- **Beta Staker Consolidation**: Enables setting operator weights to zero for gradual consolidation |
| 15 | +- **No Token Requirements**: Removes the need for operators to stake tokens |
| 16 | + |
| 17 | +## Contract Functions |
| 18 | + |
| 19 | +### Core Management |
| 20 | + |
| 21 | +#### `addStakingProvider(address stakingProvider, uint96 weight)` |
| 22 | +- **Access**: Owner only |
| 23 | +- **Purpose**: Add a new staking provider with specified weight |
| 24 | +- **Effects**: Calls `authorizationIncreased` on WalletRegistry |
| 25 | +- **Reverts**: If provider already exists with non-zero weight |
| 26 | + |
| 27 | +#### `requestWeightDecrease(address stakingProvider, uint96 newWeight)` |
| 28 | +- **Access**: Owner only |
| 29 | +- **Purpose**: Request weight decrease for existing provider |
| 30 | +- **Effects**: Sets pending weight and calls `authorizationDecreaseRequested` on WalletRegistry |
| 31 | +- **Notes**: Can set weight to zero for consolidation |
| 32 | + |
| 33 | +#### `approveAuthorizationDecrease(address stakingProvider)` |
| 34 | +- **Access**: WalletRegistry only |
| 35 | +- **Purpose**: Approve previously requested weight decrease |
| 36 | +- **Returns**: New weight value |
| 37 | +- **Effects**: Updates provider weight and clears pending value |
| 38 | + |
| 39 | +### Compatibility Interface |
| 40 | + |
| 41 | +#### `authorizedStake(address stakingProvider, address application)` |
| 42 | +- **Access**: Public view |
| 43 | +- **Purpose**: Return current weight for the provider |
| 44 | +- **Notes**: Second parameter (application) is ignored for compatibility |
| 45 | + |
| 46 | +#### `seize(uint96 amount, uint256 rewardMultiplier, address notifier, address[] memory stakingProviders)` |
| 47 | +- **Access**: Public |
| 48 | +- **Purpose**: No-op seize operation (no tokens to seize) |
| 49 | +- **Effects**: Only emits `MaliciousBehaviorIdentified` event |
| 50 | + |
| 51 | +#### `rolesOf(address stakingProvider)` |
| 52 | +- **Access**: Public view |
| 53 | +- **Returns**: (owner, stakingProvider, address(0)) |
| 54 | +- **Purpose**: Return roles for compatibility |
| 55 | + |
| 56 | +## Deployment Process |
| 57 | + |
| 58 | +### 1. Deploy Allowlist Contract |
| 59 | +```bash |
| 60 | +npx hardhat deploy --tags Allowlist |
| 61 | +``` |
| 62 | + |
| 63 | +### 2. Initialize with Existing Beta Stakers |
| 64 | +```bash |
| 65 | +MIGRATE_ALLOWLIST_WEIGHTS=true npx hardhat deploy --tags InitializeAllowlistWeights |
| 66 | +``` |
| 67 | + |
| 68 | +### 3. Update WalletRegistry Integration |
| 69 | +Update WalletRegistry constructor to use Allowlist instead of TokenStaking. |
| 70 | + |
| 71 | +## Beta Staker Consolidation Workflow |
| 72 | + |
| 73 | +### Phase 1: Migration |
| 74 | +1. Deploy Allowlist contract |
| 75 | +2. Initialize with current beta staker weights from TokenStaking |
| 76 | +3. Verify all operators are properly migrated |
| 77 | + |
| 78 | +### Phase 2: Consolidation |
| 79 | +1. Identify redundant operators for each entity (Boar, P2P, Staked.us) |
| 80 | +2. Use weight management script to set redundant operator weights to zero |
| 81 | +3. Monitor natural fund drainage as redemptions occur |
| 82 | + |
| 83 | +### Phase 3: Cleanup |
| 84 | +1. Verify zero-weight operators have no remaining funds |
| 85 | +2. Coordinate with operators to shut down redundant nodes |
| 86 | +3. Confirm network operates correctly with ~20 operators instead of ~35 |
| 87 | + |
| 88 | +## Beta Staker Consolidation |
| 89 | + |
| 90 | +#### Execute Full Consolidation |
| 91 | +```bash |
| 92 | +# Check current status |
| 93 | +npx hardhat run scripts/consolidate_beta_stakers.ts -- status --allowlist <address> |
| 94 | + |
| 95 | +# Dry run to see what would happen |
| 96 | +npx hardhat run scripts/consolidate_beta_stakers.ts -- execute --allowlist <address> --dry-run |
| 97 | + |
| 98 | +# Execute the consolidation (18 → 3 operators) |
| 99 | +npx hardhat run scripts/consolidate_beta_stakers.ts -- execute --allowlist <address> |
| 100 | +``` |
| 101 | + |
| 102 | +## Events |
| 103 | + |
| 104 | +### `StakingProviderAdded(address indexed stakingProvider, uint96 weight)` |
| 105 | +Emitted when a new staking provider is added to the allowlist. |
| 106 | + |
| 107 | +### `WeightDecreaseRequested(address indexed stakingProvider, uint96 oldWeight, uint96 newWeight)` |
| 108 | +Emitted when a weight decrease is requested. |
| 109 | + |
| 110 | +### `WeightDecreaseFinalized(address indexed stakingProvider, uint96 oldWeight, uint96 newWeight)` |
| 111 | +Emitted when a weight decrease is approved and finalized. |
| 112 | + |
| 113 | +### `MaliciousBehaviorIdentified(address notifier, address[] stakingProviders)` |
| 114 | +Emitted by the seize function for compatibility (no actual slashing occurs). |
| 115 | + |
| 116 | +## Security Considerations |
| 117 | + |
| 118 | +1. **Owner Control**: The contract owner has complete control over the operator set |
| 119 | +2. **No Slashing**: Misbehavior cannot be punished through token slashing |
| 120 | +3. **Weight Decreases**: Include delay mechanism to prevent sudden operator removal |
| 121 | +4. **Gradual Changes**: Consolidation should be done gradually to maintain network stability |
| 122 | + |
| 123 | +## Integration Notes |
| 124 | + |
| 125 | +- WalletRegistry calls remain the same, ensuring minimal integration changes |
| 126 | +- Authorization flow maintains existing delay mechanisms |
| 127 | +- Event emissions preserve compatibility with monitoring systems |
| 128 | +- No changes required to operator client software |
0 commit comments