diff --git a/contracts/0.8.9/DepositSecurityModule.sol b/contracts/0.8.9/DepositSecurityModule.sol index 8929fe89b..fb5220487 100644 --- a/contracts/0.8.9/DepositSecurityModule.sol +++ b/contracts/0.8.9/DepositSecurityModule.sol @@ -167,14 +167,14 @@ contract DepositSecurityModule { /** - * Returns `MAX_DEPOSITS` (see `depositBufferedEther`). + * Returns `maxDepositsPerBlock` (see `depositBufferedEther`). */ function getMaxDeposits() external view returns (uint256) { return maxDepositsPerBlock; } /** - * Sets `MAX_DEPOSITS`. Only callable by the owner. + * Sets `maxDepositsPerBlock`. Only callable by the owner. */ function setMaxDeposits(uint256 newValue) external onlyOwner { _setMaxDeposits(newValue); @@ -386,9 +386,8 @@ contract DepositSecurityModule { * 2. INodeOperatorsRegistry.getKeysOpIndex() != keysOpIndex. * 3. The number of guardian signatures is less than getGuardianQuorum(). * 4. An invalid or non-guardian signature received. - * 5. maxDeposits > MAX_DEPOSITS - * 6. block.number - lastLidoDepositBlock < MIN_DEPOSIT_BLOCK_DISTANCE - * 7. blockhash(blockNumber) == blockHash + * 5. block.number - lastLidoDepositBlock < MIN_DEPOSIT_BLOCK_DISTANCE + * 6. blockhash(blockNumber) == blockHash * * Signatures must be sorted in ascending order by index of the guardian. Each signature must * be produced for keccak256 hash of the following message (each component taking 32 bytes): @@ -396,7 +395,6 @@ contract DepositSecurityModule { * | ATTEST_MESSAGE_PREFIX | depositRoot | keysOpIndex | blockNumber | blockHash | */ function depositBufferedEther( - uint256 maxDeposits, bytes32 depositRoot, uint256 keysOpIndex, uint256 blockNumber, @@ -409,7 +407,6 @@ contract DepositSecurityModule { require(!paused, "deposits are paused"); require(quorum > 0 && sortedGuardianSignatures.length >= quorum, "no guardian quorum"); - require(maxDeposits <= maxDepositsPerBlock, "too many deposits"); require(block.number - lastDepositBlock >= minDepositBlockDistance, "too frequent deposits"); require(blockHash != bytes32(0) && blockhash(blockNumber) == blockHash, "unexpected block hash"); @@ -424,7 +421,7 @@ contract DepositSecurityModule { sortedGuardianSignatures ); - ILido(LIDO).depositBufferedEther(maxDeposits); + ILido(LIDO).depositBufferedEther(maxDepositsPerBlock); lastDepositBlock = block.number; } diff --git a/lib/abi/DepositSecurityModule.json b/lib/abi/DepositSecurityModule.json index 8c27a1d7d..56a7cacc1 100644 --- a/lib/abi/DepositSecurityModule.json +++ b/lib/abi/DepositSecurityModule.json @@ -1 +1 @@ -[{"inputs":[{"internalType":"address","name":"_lido","type":"address"},{"internalType":"address","name":"_depositContract","type":"address"},{"internalType":"address","name":"_nodeOperatorsRegistry","type":"address"},{"internalType":"uint256","name":"_networkId","type":"uint256"},{"internalType":"uint256","name":"_maxDepositsPerBlock","type":"uint256"},{"internalType":"uint256","name":"_minDepositBlockDistance","type":"uint256"},{"internalType":"uint256","name":"_pauseIntentValidityPeriodBlocks","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"DepositsPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"DepositsUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"GuardianAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"GuardianQuorumChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"GuardianRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"MaxDepositsChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"MinDepositBlockDistanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newValue","type":"address"}],"name":"NodeOperatorsRegistryChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newValue","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"PauseIntentValidityPeriodBlocksChanged","type":"event"},{"inputs":[],"name":"ATTEST_MESSAGE_PREFIX","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSIT_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIDO","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSE_MESSAGE_PREFIX","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"addGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"addGuardians","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxDeposits","type":"uint256"},{"internalType":"bytes32","name":"depositRoot","type":"bytes32"},{"internalType":"uint256","name":"keysOpIndex","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"vs","type":"bytes32"}],"internalType":"struct DepositSecurityModule.Signature[]","name":"sortedGuardianSignatures","type":"tuple[]"}],"name":"depositBufferedEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getGuardianIndex","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGuardianQuorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGuardians","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinDepositBlockDistance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNodeOperatorsRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPauseIntentValidityPeriodBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isGuardian","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"vs","type":"bytes32"}],"internalType":"struct DepositSecurityModule.Signature","name":"sig","type":"tuple"}],"name":"pauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"removeGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setGuardianQuorum","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMaxDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMinDepositBlockDistance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"setNodeOperatorsRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPauseIntentValidityPeriodBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file +[{"inputs":[{"internalType":"address","name":"_lido","type":"address"},{"internalType":"address","name":"_depositContract","type":"address"},{"internalType":"address","name":"_nodeOperatorsRegistry","type":"address"},{"internalType":"uint256","name":"_networkId","type":"uint256"},{"internalType":"uint256","name":"_maxDepositsPerBlock","type":"uint256"},{"internalType":"uint256","name":"_minDepositBlockDistance","type":"uint256"},{"internalType":"uint256","name":"_pauseIntentValidityPeriodBlocks","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"DepositsPaused","type":"event"},{"anonymous":false,"inputs":[],"name":"DepositsUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"GuardianAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"GuardianQuorumChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"GuardianRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"MaxDepositsChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"MinDepositBlockDistanceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newValue","type":"address"}],"name":"NodeOperatorsRegistryChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newValue","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"PauseIntentValidityPeriodBlocksChanged","type":"event"},{"inputs":[],"name":"ATTEST_MESSAGE_PREFIX","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPOSIT_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LIDO","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSE_MESSAGE_PREFIX","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"addGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"addGuardians","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"canDeposit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"depositRoot","type":"bytes32"},{"internalType":"uint256","name":"keysOpIndex","type":"uint256"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"bytes32","name":"blockHash","type":"bytes32"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"vs","type":"bytes32"}],"internalType":"struct DepositSecurityModule.Signature[]","name":"sortedGuardianSignatures","type":"tuple[]"}],"name":"depositBufferedEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"getGuardianIndex","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGuardianQuorum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getGuardians","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxDeposits","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinDepositBlockDistance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNodeOperatorsRegistry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPauseIntentValidityPeriodBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"isGuardian","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"components":[{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"vs","type":"bytes32"}],"internalType":"struct DepositSecurityModule.Signature","name":"sig","type":"tuple"}],"name":"pauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"newQuorum","type":"uint256"}],"name":"removeGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setGuardianQuorum","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMaxDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMinDepositBlockDistance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"setNodeOperatorsRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPauseIntentValidityPeriodBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseDeposits","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/abi/IDepositContract.json b/lib/abi/IDepositContract.json new file mode 100644 index 000000000..bbbff4979 --- /dev/null +++ b/lib/abi/IDepositContract.json @@ -0,0 +1 @@ +[{"inputs":[],"name":"get_deposit_root","outputs":[{"internalType":"bytes32","name":"rootHash","type":"bytes32"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/abi/IETHRegistrarController.json b/lib/abi/IETHRegistrarController.json new file mode 100644 index 000000000..ea487d959 --- /dev/null +++ b/lib/abi/IETHRegistrarController.json @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"name","type":"string"},{"name":"duration","type":"uint256"}],"name":"rentPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"name","type":"string"},{"name":"owner","type":"address"},{"name":"duration","type":"uint256"},{"name":"secret","type":"bytes32"}],"name":"register","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"MIN_REGISTRATION_DURATION","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minCommitmentAge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"}],"name":"valid","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"}],"name":"available","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxCommitmentAge","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"commitment","type":"bytes32"}],"name":"commit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"name","type":"string"},{"name":"owner","type":"address"},{"name":"secret","type":"bytes32"}],"name":"makeCommitment","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/lib/abi/IInterfaceResolver.json b/lib/abi/IInterfaceResolver.json new file mode 100644 index 000000000..26db06286 --- /dev/null +++ b/lib/abi/IInterfaceResolver.json @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"node","type":"bytes32"},{"name":"interfaceID","type":"bytes4"}],"name":"interfaceImplementer","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/abi/ILido.json b/lib/abi/ILido.json new file mode 100644 index 000000000..6f7d89520 --- /dev/null +++ b/lib/abi/ILido.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"uint256","name":"maxDeposits","type":"uint256"}],"name":"depositBufferedEther","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/abi/INodeOperatorsRegistry.json b/lib/abi/INodeOperatorsRegistry.json new file mode 100644 index 000000000..49a40bbae --- /dev/null +++ b/lib/abi/INodeOperatorsRegistry.json @@ -0,0 +1 @@ +[{"inputs":[],"name":"getKeysOpIndex","outputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/abi/NodeOperatorsRegistry.json b/lib/abi/NodeOperatorsRegistry.json index 1e8a2a9ad..a0356f8b7 100644 --- a/lib/abi/NodeOperatorsRegistry.json +++ b/lib/abi/NodeOperatorsRegistry.json @@ -1 +1 @@ -[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_rewardAddress","type":"address"},{"name":"_stakingLimit","type":"uint64"}],"name":"addNodeOperator","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_quantity","type":"uint256"},{"name":"_pubkeys","type":"bytes"},{"name":"_signatures","type":"bytes"}],"name":"addSigningKeys","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_numKeys","type":"uint256"}],"name":"assignNextSigningKeys","outputs":[{"name":"pubkeys","type":"bytes"},{"name":"signatures","type":"bytes"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SIGNATURE_LENGTH","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_ADDRESS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_name","type":"string"}],"name":"setNodeOperatorName","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_totalRewardShares","type":"uint256"}],"name":"getRewardsDistribution","outputs":[{"name":"recipients","type":"address[]"},{"name":"shares","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_active","type":"bool"}],"name":"setNodeOperatorActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_NAME_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"removeSigningKey","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ADD_NODE_OPERATOR_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_quantity","type":"uint256"},{"name":"_pubkeys","type":"bytes"},{"name":"_signatures","type":"bytes"}],"name":"addSigningKeysOperatorBH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getActiveNodeOperatorsCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_operator_id","type":"uint256"}],"name":"getUnusedSigningKeyCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_rewardAddress","type":"address"}],"name":"setNodeOperatorRewardAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"},{"name":"_fullInfo","type":"bool"}],"name":"getNodeOperator","outputs":[{"name":"active","type":"bool"},{"name":"name","type":"string"},{"name":"rewardAddress","type":"address"},{"name":"stakingLimit","type":"uint64"},{"name":"stoppedValidators","type":"uint64"},{"name":"totalSigningKeys","type":"uint64"},{"name":"usedSigningKeys","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PUBKEY_LENGTH","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getNodeOperatorsCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_stakingLimit","type":"uint64"}],"name":"setNodeOperatorStakingLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getSigningKey","outputs":[{"name":"key","type":"bytes"},{"name":"depositSignature","type":"bytes"},{"name":"used","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_stoppedIncrement","type":"uint64"}],"name":"reportStoppedValidators","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_lido","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"REPORT_STOPPED_VALIDATORS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getKeysOpIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_ACTIVE_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_LIMIT_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_operator_id","type":"uint256"}],"name":"getTotalSigningKeyCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"removeSigningKeyOperatorBH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MANAGE_SIGNING_KEYS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"trimUnusedKeys","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":false,"name":"script","type":"bytes"},{"indexed":false,"name":"input","type":"bytes"},{"indexed":false,"name":"returnData","type":"bytes"}],"name":"ScriptResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"},{"indexed":false,"name":"name","type":"string"},{"indexed":false,"name":"rewardAddress","type":"address"},{"indexed":false,"name":"stakingLimit","type":"uint64"}],"name":"NodeOperatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"active","type":"bool"}],"name":"NodeOperatorActiveSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"name","type":"string"}],"name":"NodeOperatorNameSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"rewardAddress","type":"address"}],"name":"NodeOperatorRewardAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"stakingLimit","type":"uint64"}],"name":"NodeOperatorStakingLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"totalStopped","type":"uint64"}],"name":"NodeOperatorTotalStoppedValidatorsReported","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"operatorId","type":"uint256"},{"indexed":false,"name":"pubkey","type":"bytes"}],"name":"SigningKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"operatorId","type":"uint256"},{"indexed":false,"name":"pubkey","type":"bytes"}],"name":"SigningKeyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"oldKeysOpIndex","type":"uint256"},{"indexed":false,"name":"newKeysOpIndex","type":"uint256"}],"name":"KeysOpIndexSet","type":"event"}] \ No newline at end of file +[{"constant":true,"inputs":[],"name":"hasInitialized","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_quantity","type":"uint256"},{"name":"_pubkeys","type":"bytes"},{"name":"_signatures","type":"bytes"}],"name":"addSigningKeys","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_script","type":"bytes"}],"name":"getEVMScriptExecutor","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getRecoveryVault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_numKeys","type":"uint256"}],"name":"assignNextSigningKeys","outputs":[{"name":"pubkeys","type":"bytes"},{"name":"signatures","type":"bytes"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SIGNATURE_LENGTH","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_ADDRESS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"},{"name":"_amount","type":"uint256"}],"name":"removeSigningKeysOperatorBH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_name","type":"string"}],"name":"setNodeOperatorName","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_totalRewardShares","type":"uint256"}],"name":"getRewardsDistribution","outputs":[{"name":"recipients","type":"address[]"},{"name":"shares","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_active","type":"bool"}],"name":"setNodeOperatorActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_NAME_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"removeSigningKey","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"},{"name":"_amount","type":"uint256"}],"name":"removeSigningKeys","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"ADD_NODE_OPERATOR_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"token","type":"address"}],"name":"allowRecoverability","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_quantity","type":"uint256"},{"name":"_pubkeys","type":"bytes"},{"name":"_signatures","type":"bytes"}],"name":"addSigningKeysOperatorBH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"appId","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getActiveNodeOperatorsCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_name","type":"string"},{"name":"_rewardAddress","type":"address"}],"name":"addNodeOperator","outputs":[{"name":"id","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getInitializationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_operator_id","type":"uint256"}],"name":"getUnusedSigningKeyCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_rewardAddress","type":"address"}],"name":"setNodeOperatorRewardAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_id","type":"uint256"},{"name":"_fullInfo","type":"bool"}],"name":"getNodeOperator","outputs":[{"name":"active","type":"bool"},{"name":"name","type":"string"},{"name":"rewardAddress","type":"address"},{"name":"stakingLimit","type":"uint64"},{"name":"stoppedValidators","type":"uint64"},{"name":"totalSigningKeys","type":"uint64"},{"name":"usedSigningKeys","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"}],"name":"transferToVault","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_sender","type":"address"},{"name":"_role","type":"bytes32"},{"name":"_params","type":"uint256[]"}],"name":"canPerform","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getEVMScriptRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PUBKEY_LENGTH","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getNodeOperatorsCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_stakingLimit","type":"uint64"}],"name":"setNodeOperatorStakingLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"getSigningKey","outputs":[{"name":"key","type":"bytes"},{"name":"depositSignature","type":"bytes"},{"name":"used","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_id","type":"uint256"},{"name":"_stoppedIncrement","type":"uint64"}],"name":"reportStoppedValidators","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_lido","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"REPORT_STOPPED_VALIDATORS_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getKeysOpIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"kernel","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_ACTIVE_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"SET_NODE_OPERATOR_LIMIT_ROLE","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_operator_id","type":"uint256"}],"name":"getTotalSigningKeyCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPetrified","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_operator_id","type":"uint256"},{"name":"_index","type":"uint256"}],"name":"removeSigningKeyOperatorBH","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MANAGE_SIGNING_KEYS","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"trimUnusedKeys","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"executor","type":"address"},{"indexed":false,"name":"script","type":"bytes"},{"indexed":false,"name":"input","type":"bytes"},{"indexed":false,"name":"returnData","type":"bytes"}],"name":"ScriptResult","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"vault","type":"address"},{"indexed":true,"name":"token","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"RecoverToVault","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"},{"indexed":false,"name":"name","type":"string"},{"indexed":false,"name":"rewardAddress","type":"address"},{"indexed":false,"name":"stakingLimit","type":"uint64"}],"name":"NodeOperatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"active","type":"bool"}],"name":"NodeOperatorActiveSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"name","type":"string"}],"name":"NodeOperatorNameSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"rewardAddress","type":"address"}],"name":"NodeOperatorRewardAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"stakingLimit","type":"uint64"}],"name":"NodeOperatorStakingLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"totalStopped","type":"uint64"}],"name":"NodeOperatorTotalStoppedValidatorsReported","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"totalKeysTrimmed","type":"uint64"}],"name":"NodeOperatorTotalKeysTrimmed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"operatorId","type":"uint256"},{"indexed":false,"name":"pubkey","type":"bytes"}],"name":"SigningKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"operatorId","type":"uint256"},{"indexed":false,"name":"pubkey","type":"bytes"}],"name":"SigningKeyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"keysOpIndex","type":"uint256"}],"name":"KeysOpIndexSet","type":"event"}] \ No newline at end of file diff --git a/test/0.8.9/deposit-security-module.test.js b/test/0.8.9/deposit-security-module.test.js index a0f69d567..84e691b58 100644 --- a/test/0.8.9/deposit-security-module.test.js +++ b/test/0.8.9/deposit-security-module.test.js @@ -70,7 +70,6 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { } describe('depositBufferedEther', () => { - const MAX_DEPOSITS = 24 const KEYS_OP_INDEX = 12 const DEPOSIT_ROOT = '0xd151867719c94ad8458feaf491809f9bc8096c702a72747403ecaac30c179137' @@ -91,7 +90,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { }) it('deposits are impossible', async () => { await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, [], { + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, [], { from: stranger }), 'no guardian quorum' @@ -112,16 +111,9 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { const signatures = [ signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] - const tx = await depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ) + const tx = await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) assertEvent(tx.receipt, 'Deposited', { - expectedArgs: { maxDeposits: MAX_DEPOSITS }, + expectedArgs: { maxDeposits: MAX_DEPOSITS_PER_BLOCK }, decodeForAbi: LidoMockForDepositSecurityModule._json.abi }) }) @@ -131,13 +123,13 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), 'invalid signature' ) }) it('cannot deposit with no sigs', async () => { await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, []), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, []), 'no guardian quorum' ) }) @@ -151,7 +143,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), 'deposit root changed' ) }) @@ -164,45 +156,22 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), 'keys op index changed' ) }) - it('cannot deposit more than allowed number of validators', async () => { - const signatures = [ - signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) - ] - await assertRevert( - depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS_PER_BLOCK + 1, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ), - 'too many deposits' - ) - }) it('cannot deposit more frequently than allowed', async () => { const signatures = [ signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] - const tx = await depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ) + const tx = await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) assertEvent(tx.receipt, 'Deposited', { - expectedArgs: { maxDeposits: MAX_DEPOSITS }, + expectedArgs: { maxDeposits: MAX_DEPOSITS_PER_BLOCK }, decodeForAbi: LidoMockForDepositSecurityModule._json.abi }) await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), 'too frequent deposits' ) }) @@ -213,7 +182,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { const staleBlockHash = block.hash await waitBlocks(1) await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, staleBlockHash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, staleBlockHash, signatures), 'unexpected block hash' ) }) @@ -231,7 +200,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { ) ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, staleBlock.number, '0x', signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, staleBlock.number, '0x', signatures), 'unexpected block hash' ) }) @@ -253,16 +222,9 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN3]) ] - const tx = await depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ) + const tx = await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) assertEvent(tx.receipt, 'Deposited', { - expectedArgs: { maxDeposits: MAX_DEPOSITS }, + expectedArgs: { maxDeposits: MAX_DEPOSITS_PER_BLOCK }, decodeForAbi: LidoMockForDepositSecurityModule._json.abi }) }) @@ -272,16 +234,9 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN2]) ] - const tx = await depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ) + const tx = await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) assertEvent(tx.receipt, 'Deposited', { - expectedArgs: { maxDeposits: MAX_DEPOSITS }, + expectedArgs: { maxDeposits: MAX_DEPOSITS_PER_BLOCK }, decodeForAbi: LidoMockForDepositSecurityModule._json.abi }) }) @@ -291,16 +246,9 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN3]) ] - const tx = await depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ) + const tx = await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) assertEvent(tx.receipt, 'Deposited', { - expectedArgs: { maxDeposits: MAX_DEPOSITS }, + expectedArgs: { maxDeposits: MAX_DEPOSITS_PER_BLOCK }, decodeForAbi: LidoMockForDepositSecurityModule._json.abi }) }) @@ -309,22 +257,15 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN2]), signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN3]) ] - const tx = await depositSecurityModule.depositBufferedEther( - MAX_DEPOSITS, - DEPOSIT_ROOT, - KEYS_OP_INDEX, - block.number, - block.hash, - signatures - ) + const tx = await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) assertEvent(tx.receipt, 'Deposited', { - expectedArgs: { maxDeposits: MAX_DEPOSITS }, + expectedArgs: { maxDeposits: MAX_DEPOSITS_PER_BLOCK }, decodeForAbi: LidoMockForDepositSecurityModule._json.abi }) }) it('cannot deposit with no sigs', async () => { await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, []), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, []), 'no guardian quorum' ) }) @@ -334,7 +275,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), 'signatures not sorted' ) }) @@ -345,7 +286,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN2]) ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures), 'signatures not sorted' ) }) @@ -370,7 +311,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { ) ] await assertRevert( - depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signature), + depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signature), 'invalid signature' ) }) @@ -716,7 +657,6 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { }) describe('canDeposit', () => { it('true if not paused and quorum > 0 and currentBlock - lastDepositBlock >= minDepositBlockDistance', async () => { - const MAX_DEPOSITS = 24 const KEYS_OP_INDEX = 12 const DEPOSIT_ROOT = '0xd151867719c94ad8458feaf491809f9bc8096c702a72747403ecaac30c179137' @@ -728,7 +668,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { const signatures = [ signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] - await depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) const lastDepositBlockNumber = await web3.eth.getBlockNumber() await waitBlocks(2 * MIN_DEPOSIT_BLOCK_DISTANCE) @@ -740,7 +680,6 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { assert.isTrue(await depositSecurityModule.canDeposit()) }) it('false if paused and quorum > 0 and currentBlock - lastDepositBlock >= minDepositBlockDistance', async () => { - const MAX_DEPOSITS = 24 const KEYS_OP_INDEX = 12 const DEPOSIT_ROOT = '0xd151867719c94ad8458feaf491809f9bc8096c702a72747403ecaac30c179137' @@ -750,7 +689,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { const signatures = [ signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] - await depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) const lastDepositBlockNumber = await web3.eth.getBlockNumber() await waitBlocks(2 * MIN_DEPOSIT_BLOCK_DISTANCE) @@ -765,7 +704,6 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { assert.isFalse(await depositSecurityModule.canDeposit()) }) it('false if not paused and quorum == 0 and currentBlock - lastDepositBlock >= minDepositBlockDistance', async () => { - const MAX_DEPOSITS = 24 const KEYS_OP_INDEX = 12 const DEPOSIT_ROOT = '0xd151867719c94ad8458feaf491809f9bc8096c702a72747403ecaac30c179137' @@ -775,7 +713,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { const signatures = [ signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] - await depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) const lastDepositBlockNumber = await web3.eth.getBlockNumber() await waitBlocks(2 * MIN_DEPOSIT_BLOCK_DISTANCE) @@ -789,7 +727,6 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { assert.isFalse(await depositSecurityModule.canDeposit()) }) it('false if not paused and quorum > 0 and currentBlock - lastDepositBlock < minDepositBlockDistance', async () => { - const MAX_DEPOSITS = 24 const KEYS_OP_INDEX = 12 const DEPOSIT_ROOT = '0xd151867719c94ad8458feaf491809f9bc8096c702a72747403ecaac30c179137' @@ -801,7 +738,7 @@ contract('DepositSecurityModule', ([owner, stranger, guardian]) => { const signatures = [ signDepositData(ATTEST_MESSAGE_PREFIX, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, GUARDIAN_PRIVATE_KEYS[GUARDIAN1]) ] - await depositSecurityModule.depositBufferedEther(MAX_DEPOSITS, DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(DEPOSIT_ROOT, KEYS_OP_INDEX, block.number, block.hash, signatures) const lastDepositBlockNumber = await web3.eth.getBlockNumber() await waitBlocks(Math.floor(MIN_DEPOSIT_BLOCK_DISTANCE / 2)) diff --git a/test/scenario/lido_deposit_iteration_limit.js b/test/scenario/lido_deposit_iteration_limit.js index baddf646c..fd52751d4 100644 --- a/test/scenario/lido_deposit_iteration_limit.js +++ b/test/scenario/lido_deposit_iteration_limit.js @@ -50,11 +50,13 @@ contract('Lido: deposit loop iteration limit', (addresses) => { await pool.setFee(0.01 * 10000, { from: voting }) await pool.setFeeDistribution(0.3 * 10000, 0.2 * 10000, 0.5 * 10000, { from: voting }) await pool.setWithdrawalCredentials(pad('0x0202', 32), { from: voting }) + await depositSecurityModule.setMaxDeposits(10, { from: appManager }) + assertBn(await depositSecurityModule.getMaxDeposits(), 10, 'invariant failed: max deposits') }) - it('voting adds a node operator with 16 signing keys', async () => { + it('voting adds a node operator with 26 signing keys', async () => { const validatorsLimit = 1000 - const numKeys = 21 + const numKeys = 26 const txn = await nodeOperatorRegistry.addNodeOperator('operator_1', nodeOperator, { from: voting }) await nodeOperatorRegistry.setNodeOperatorStakingLimit(0, validatorsLimit, { from: voting }) @@ -81,22 +83,20 @@ contract('Lido: deposit loop iteration limit', (addresses) => { assertBn(totalKeys, numKeys, 'total signing keys') }) - it('a user submits 20 * 32 ETH', async () => { + it('a user submits 25 * 32 ETH', async () => { + const depositAmount = 25 * 32 const referral = ZERO_ADDRESS - await pool.submit(referral, { from: user1, value: ETH(20 * 32) }) - assertBn(await pool.getTotalPooledEther(), ETH(20 * 32), 'total controlled ether') + await pool.submit(referral, { from: user1, value: ETH(depositAmount) }) + assertBn(await pool.getTotalPooledEther(), ETH(depositAmount), 'total controlled ether') // at this point, no deposit assignments were made and all ether is buffered - assertBn(await pool.getBufferedEther(), ETH(20 * 32), 'buffered ether') + assertBn(await pool.getBufferedEther(), ETH(depositAmount), 'buffered ether') const ether2Stat = await pool.getBeaconStat() assertBn(ether2Stat.depositedValidators, 0, 'deposited validators') }) - it('guardians can assign the buffered ether to validators by calling depositBufferedEther() and passing deposit iteration limit', async () => { - const depositIterationLimit = 5 - let bufferedEther = await pool.getBufferedEther() - + it('guardians can assign the buffered ether to validators by calling depositBufferedEther()', async () => { const block = await web3.eth.getBlock('latest') const keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() const signatures = [ @@ -117,48 +117,22 @@ contract('Lido: deposit loop iteration limit', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther(depositIterationLimit, depositRoot, keysOpIndex, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) // no more than depositIterationLimit validators are assigned in a single transaction - assertBn(await depositContractMock.totalCalls(), 5, 'total validators assigned') + assertBn(await depositContractMock.totalCalls(), 10, 'total validators assigned') const ether2Stat = await pool.getBeaconStat() - assertBn(ether2Stat.depositedValidators, 5, 'deposited validators') - - bufferedEther = await pool.getBufferedEther() + assertBn(ether2Stat.depositedValidators, 10, 'deposited validators') // the rest of the received Ether is still buffered in the pool assertBn(await pool.getBufferedEther(), ETH(15 * 32), 'buffered ether') }) it('guardians can advance the deposit loop further by calling depositBufferedEther() once again', async () => { - const depositIterationLimit = 10 - - let block = await waitBlocks(await depositSecurityModule.getMinDepositBlockDistance()) - let keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() - let signatures = [ - signDepositData( - await depositSecurityModule.ATTEST_MESSAGE_PREFIX(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - guardians.privateKeys[guardians.addresses[0]] - ), - signDepositData( - await depositSecurityModule.ATTEST_MESSAGE_PREFIX(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - guardians.privateKeys[guardians.addresses[1]] - ) - ] - await depositSecurityModule.depositBufferedEther(depositIterationLimit, depositRoot, keysOpIndex, block.number, block.hash, signatures) - - block = await waitBlocks(await depositSecurityModule.getMinDepositBlockDistance()) - keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() - signatures = [ + const block = await waitBlocks(await depositSecurityModule.getMinDepositBlockDistance()) + const keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() + const signatures = [ signDepositData( await depositSecurityModule.ATTEST_MESSAGE_PREFIX(), depositRoot, @@ -176,17 +150,16 @@ contract('Lido: deposit loop iteration limit', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) - assertBn(await depositContractMock.totalCalls(), 15, 'total validators assigned') + assertBn(await depositContractMock.totalCalls(), 20, 'total validators assigned') const ether2Stat = await pool.getBeaconStat() - assertBn(ether2Stat.depositedValidators, 15, 'deposited validators') - + assertBn(ether2Stat.depositedValidators, 20, 'deposited validators') assertBn(await pool.getBufferedEther(), ETH(5 * 32), 'buffered ether') }) it('the number of assigned validators is limited by the remaining ether', async () => { - const depositIterationLimit = 10 const block = await waitBlocks(await depositSecurityModule.getMinDepositBlockDistance()) const keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() const signatures = [ @@ -207,12 +180,12 @@ contract('Lido: deposit loop iteration limit', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther(depositIterationLimit, depositRoot, keysOpIndex, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) - assertBn(await depositContractMock.totalCalls(), 20) + assertBn(await depositContractMock.totalCalls(), 25) const ether2Stat = await pool.getBeaconStat() - assertBn(ether2Stat.depositedValidators, 20, 'deposited validators') + assertBn(ether2Stat.depositedValidators, 25, 'deposited validators') // the is no ether left buffered in the pool assertBn(await pool.getBufferedEther(), ETH(0), 'buffered ether') @@ -222,12 +195,11 @@ contract('Lido: deposit loop iteration limit', (addresses) => { const referral = ZERO_ADDRESS await pool.submit(referral, { from: user1, value: ETH(2 * 32) }) - assertBn(await pool.getTotalPooledEther(), ETH(22 * 32), 'total controlled ether') + assertBn(await pool.getTotalPooledEther(), ETH(27 * 32), 'total controlled ether') assertBn(await pool.getBufferedEther(), ETH(2 * 32), 'buffered ether') }) it('the number of assigned validators is still limited by the number of available validator keys', async () => { - const depositIterationLimit = 10 const block = await waitBlocks(await depositSecurityModule.getMinDepositBlockDistance()) const keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() const signatures = [ @@ -248,19 +220,18 @@ contract('Lido: deposit loop iteration limit', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther(depositIterationLimit, depositRoot, keysOpIndex, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) - assertBn(await depositContractMock.totalCalls(), 21) + assertBn(await depositContractMock.totalCalls(), 26) const ether2Stat = await pool.getBeaconStat() - assertBn(ether2Stat.depositedValidators, 21, 'deposited validators') + assertBn(ether2Stat.depositedValidators, 26, 'deposited validators') // the rest of the received Ether is still buffered in the pool assertBn(await pool.getBufferedEther(), ETH(1 * 32), 'buffered ether') }) it('depositBufferedEther is a nop if there are no signing keys available', async () => { - const depositIterationLimit = 10 const block = await waitBlocks(await depositSecurityModule.getMinDepositBlockDistance()) const keysOpIndex = await nodeOperatorRegistry.getKeysOpIndex() const signatures = [ @@ -281,9 +252,9 @@ contract('Lido: deposit loop iteration limit', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther(depositIterationLimit, depositRoot, keysOpIndex, block.number, block.hash, signatures) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) - assertBn(await depositContractMock.totalCalls(), 21, 'total validators assigned') + assertBn(await depositContractMock.totalCalls(), 26, 'total validators assigned') // the rest of the received Ether is still buffered in the pool assertBn(await pool.getBufferedEther(), ETH(1 * 32), 'buffered ether') diff --git a/test/scenario/lido_happy_path.js b/test/scenario/lido_happy_path.js index 71935aa09..73afad4c1 100644 --- a/test/scenario/lido_happy_path.js +++ b/test/scenario/lido_happy_path.js @@ -168,14 +168,7 @@ contract('Lido: happy path', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) // No Ether was deposited yet to the validator contract @@ -219,14 +212,7 @@ contract('Lido: happy path', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) // The first 32 ETH chunk was deposited to the deposit contract, // using public key and signature of the only validator of the first operator @@ -331,14 +317,7 @@ contract('Lido: happy path', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) // The first 32 ETH chunk was deposited to the deposit contract, // using public key and signature of the only validator of the second operator @@ -508,14 +487,7 @@ contract('Lido: happy path', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) let nodeOperatorInfo = await nodeOperatorRegistry.getNodeOperator(nodeOperator3.id, false) // validate that only 5 signing keys used after key removing diff --git a/test/scenario/lido_penalties_slashing.js b/test/scenario/lido_penalties_slashing.js index 6c4056143..d21b2539c 100644 --- a/test/scenario/lido_penalties_slashing.js +++ b/test/scenario/lido_penalties_slashing.js @@ -175,14 +175,7 @@ contract('Lido: penalties, slashing, operator stops', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) // No Ether was deposited yet to the validator contract @@ -237,14 +230,7 @@ contract('Lido: penalties, slashing, operator stops', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) }) it('new validator gets the 32 ETH deposit from the pool', async () => { @@ -419,14 +405,7 @@ contract('Lido: penalties, slashing, operator stops', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) assertBn(await depositContractMock.totalCalls(), 2) @@ -583,14 +562,7 @@ contract('Lido: penalties, slashing, operator stops', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) const ether2Stat = await pool.getBeaconStat() assertBn(ether2Stat.depositedValidators, 2, 'no validators have received the current deposit') diff --git a/test/scenario/lido_rewards_distribution_math.js b/test/scenario/lido_rewards_distribution_math.js index 3ab9100c3..232cd6c60 100644 --- a/test/scenario/lido_rewards_distribution_math.js +++ b/test/scenario/lido_rewards_distribution_math.js @@ -205,14 +205,7 @@ contract('Lido: rewards distribution math', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - await depositSecurityModule.depositBufferedEther( - await depositSecurityModule.getMaxDeposits(), - depositRoot, - keysOpIndex, - block.number, - block.hash, - signatures - ) + await depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures) assertBn(await nodeOperatorRegistry.getUnusedSigningKeyCount(0), 0, 'no more available keys for the first validator') assertBn(await token.balanceOf(user1), ETH(34), 'user1 balance is equal first reported value + their buffered deposit value') @@ -369,9 +362,8 @@ contract('Lido: rewards distribution math', (addresses) => { guardians.privateKeys[guardians.addresses[1]] ) ] - const maxDeposits = await depositSecurityModule.getMaxDeposits() const [_, deltas] = await getSharesTokenDeltas( - () => depositSecurityModule.depositBufferedEther(maxDeposits, depositRoot, keysOpIndex, block.number, block.hash, signatures), + () => depositSecurityModule.depositBufferedEther(depositRoot, keysOpIndex, block.number, block.hash, signatures), treasuryAddr, insuranceAddr, nodeOperator1.address,