diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a2a0ca..666f6ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ ## [latest](https://github.com/kilnfi/staking-contracts) - [feat: add optional OFAC sanctions check](https://github.com/kilnfi/staking-contracts/pull/101/commits/4513c1e406c8dffe126bc450dfc02af510187933) - - [feat: blockList](https://github.com/kilnfi/staking-contracts/pull/101/commits/b680e4e017dfb57a4c97425f1ee85c118fd95e53) +- [refacto: refresh tests]() ## [1.2.0](https://github.com/kilnfi/staking-contracts/releases/tag/1.2.0) diff --git a/lib/forge-std b/lib/forge-std index 52715a2..051fb65 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 52715a217dc51d0de15877878ab8213f6cbbbab5 +Subproject commit 051fb65fc46013dff64e46ca410445d63ea5620a diff --git a/src/test/StakingContract.t.sol b/src/test/StakingContract.t.sol index 479f107..492c173 100644 --- a/src/test/StakingContract.t.sol +++ b/src/test/StakingContract.t.sol @@ -1,13 +1,9 @@ //SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.10; -import "forge-std/Vm.sol"; import "forge-std/Test.sol"; -import "./UserFactory.sol"; import "../contracts/StakingContract.sol"; -import "solmate/test/utils/DSTestPlus.sol"; import "../contracts/interfaces/IDepositContract.sol"; -import "./UserFactory.sol"; import "../contracts/libs/BytesLib.sol"; import "../contracts/ConsensusLayerFeeDispatcher.sol"; import "../contracts/ExecutionLayerFeeDispatcher.sol"; @@ -50,19 +46,38 @@ contract DepositContractMock is IDepositContract { } } -contract StakingContractTest is DSTestPlus { - Vm internal vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); +// 10 PUBLIC KEYS +bytes constant PUBLIC_KEYS = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; +bytes constant PUBLIC_KEYS_2 = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fbff"; +bytes constant PUBKEY_1 = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; +bytes constant PUBKEY_2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; +bytes constant PUBKEY_10 = hex"fdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; + +bytes constant PUBKEY_2_1 = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b0"; + +// 10 SIGNATURES +bytes constant SIGNATURES = hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966f393d619cbf13ff427df11dcb17026df25f35268de5b168e359c16f2a3d5fbc6376db44638d773c851c875f21222448433d285920e8bdc4f5cbff130d7387c0a9589324286aea398e5aacad3bbfe3992dfce62571f0e282ed9c29e3fa5b07aa5c81749589b1170d3b85a84331e2f6b8e26eadebfd569b225759f40bbd12d6c3d253ed3f379b014b2ea44cce54d362072e2d020ff139a903b7d87fc3fddc2e6657c83e0b79851c22c6e0e477463463c97d6cc0e2e2de5e35b227bddb285521be3766358abaf3159d89f68c9770e28278f177088cfc4089b817effaaecabdffa4e66427868b105cb9348ea2d84eeea059a5d1ff3277d6f9cf656fc973d07cabed70fb8f8eb2798a65d207a8e1f8a26910949db9fa62d62bc15ecc097a93a27a1873405b8589a4ddf0ecf0303c6031484562b32eb7881975026524d6d4a9de6cd73fe2c324501586b9b6fa6bce950bbd21472278302f83dbfd6be036f2fc36d299d66578e844be3d6aa8314fab468f038fd6e130ada0a886fccfb2fd843f7dd07e8968401bbe2af7345fce52ba4b310b30af2d54b15669d06c206682c1730ab6b17787e361f04401f78dc5cbd5fac955df4e83c24cdabfabdb3f4ea40961d04a5ca166c17694fca144025b47131a68ddb230d36fe6e831e82624c9a925d706bff86982852b26ebf019a3f6ee36aedbbc6bec2d50531a233e09225493d3c5fd48379aec373baf622fb9feed6261e5296e5ae6601e7523c7f386801ed63a344b07106a0d03e5848209db5e114c0e67884916a43a1bfb77d9b8ea113c3ba8cad4b006aafeadcc31e70e85c5efecaf807154d011c1413340d4b592d2f270fb48b2050e08493c1427ddfac8dcc27fe434d32a35dcbddbcb1c4e22ead6734a4ac910f6768bc9ff6b355c1151695e41121cdcc9d9d3b18cf4d66ca3c1db0527c471a0dcf256590602a7269dcb26175e7eb370bd9794ac8ab558bea69e6a92d8e818b675a80e2df0516b8307291d93cb85d959ac60d47b46455a7ab0a38687c747c6d2d9e8c20ccf74dc6cdf145ec06805d4ac24a39aec2f5cd6e26e63e3d043a31c42411e4"; +bytes constant SIGNATURES_2 = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d21"; + +bytes constant SIGNATURE_1 = hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a"; +bytes constant SIGNATURE_2 = hex"02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966"; + +uint256 constant OPERATOR_INDEX = 0; + +contract StakingContractTest is Test { address internal treasury; StakingContract internal stakingContract; DepositContractMock internal depositContract; - UserFactory internal uf; - address internal admin = address(1); - address internal bob = address(2); - address internal alice = address(3); - address internal operatorOne = address(4); - address internal feeRecipientOne = address(44); + address internal admin; + address internal bob; + address internal alice; + address internal operator; + address internal feeRecipient; + address internal elDispatcher; + address internal clDispatcher; + address internal feeRecipientImpl; bytes32 salt = bytes32(0); @@ -91,11 +106,11 @@ contract StakingContractTest is DSTestPlus { function testLoopedDeposit() external { for (uint256 idx = 0; idx < 250; ++idx) { - vm.startPrank(operatorOne); + vm.startPrank(operator); bytes memory pubkey = genBytes(25 * 48); bytes memory sigs = genBytes(25 * 96); startMeasure(""); - stakingContract.addValidators(0, 25, pubkey, sigs); + stakingContract.addValidators(OPERATOR_INDEX, 25, pubkey, sigs); stopMeasure(); uint256 gasCost = lastMeasure; if (gasCost > 6000000) { @@ -119,20 +134,25 @@ contract StakingContractTest is DSTestPlus { } function setUp() public { - uf = new UserFactory(); - address[] memory recipients = new address[](1); - uint256[] memory percents = new uint256[](1); - percents[0] = 10_000; - treasury = address(99); + admin = makeAddr("admin"); + bob = makeAddr("bob"); + alice = makeAddr("alice"); + operator = makeAddr("operator"); + feeRecipient = makeAddr("feeRecipient"); + clDispatcher = makeAddr("clDispatcher"); + elDispatcher = makeAddr("elDispatcher"); + feeRecipientImpl = makeAddr("feeRecipientImpl"); + treasury = makeAddr("treasury"); + stakingContract = new StakingContract(); depositContract = new DepositContractMock(); stakingContract.initialize_1( admin, treasury, address(depositContract), - address(100), - address(101), - address(102), + clDispatcher, + elDispatcher, + feeRecipientImpl, 1000, 2000, 2000, @@ -140,36 +160,29 @@ contract StakingContractTest is DSTestPlus { ); vm.startPrank(admin); - stakingContract.addOperator(operatorOne, feeRecipientOne); + stakingContract.addOperator(operator, feeRecipient); vm.stopPrank(); { - bytes - memory publicKeys = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - - bytes - memory signatures = hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966f393d619cbf13ff427df11dcb17026df25f35268de5b168e359c16f2a3d5fbc6376db44638d773c851c875f21222448433d285920e8bdc4f5cbff130d7387c0a9589324286aea398e5aacad3bbfe3992dfce62571f0e282ed9c29e3fa5b07aa5c81749589b1170d3b85a84331e2f6b8e26eadebfd569b225759f40bbd12d6c3d253ed3f379b014b2ea44cce54d362072e2d020ff139a903b7d87fc3fddc2e6657c83e0b79851c22c6e0e477463463c97d6cc0e2e2de5e35b227bddb285521be3766358abaf3159d89f68c9770e28278f177088cfc4089b817effaaecabdffa4e66427868b105cb9348ea2d84eeea059a5d1ff3277d6f9cf656fc973d07cabed70fb8f8eb2798a65d207a8e1f8a26910949db9fa62d62bc15ecc097a93a27a1873405b8589a4ddf0ecf0303c6031484562b32eb7881975026524d6d4a9de6cd73fe2c324501586b9b6fa6bce950bbd21472278302f83dbfd6be036f2fc36d299d66578e844be3d6aa8314fab468f038fd6e130ada0a886fccfb2fd843f7dd07e8968401bbe2af7345fce52ba4b310b30af2d54b15669d06c206682c1730ab6b17787e361f04401f78dc5cbd5fac955df4e83c24cdabfabdb3f4ea40961d04a5ca166c17694fca144025b47131a68ddb230d36fe6e831e82624c9a925d706bff86982852b26ebf019a3f6ee36aedbbc6bec2d50531a233e09225493d3c5fd48379aec373baf622fb9feed6261e5296e5ae6601e7523c7f386801ed63a344b07106a0d03e5848209db5e114c0e67884916a43a1bfb77d9b8ea113c3ba8cad4b006aafeadcc31e70e85c5efecaf807154d011c1413340d4b592d2f270fb48b2050e08493c1427ddfac8dcc27fe434d32a35dcbddbcb1c4e22ead6734a4ac910f6768bc9ff6b355c1151695e41121cdcc9d9d3b18cf4d66ca3c1db0527c471a0dcf256590602a7269dcb26175e7eb370bd9794ac8ab558bea69e6a92d8e818b675a80e2df0516b8307291d93cb85d959ac60d47b46455a7ab0a38687c747c6d2d9e8c20ccf74dc6cdf145ec06805d4ac24a39aec2f5cd6e26e63e3d043a31c42411e4"; - - vm.startPrank(operatorOne); - stakingContract.addValidators(0, 10, publicKeys, signatures); + vm.startPrank(operator); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS, SIGNATURES); vm.stopPrank(); } { vm.startPrank(admin); - stakingContract.setOperatorLimit(0, 10, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 10, block.number); vm.stopPrank(); } } - function testGetAdmin() public { + function testGetAdmin() public view { assertEq(stakingContract.getAdmin(), admin); } event ChangedAdmin(address newAdmin); - function testSetAdmin(uint256 _adminSalt) public { - address newAdmin = uf._new(_adminSalt); + function testSetAdmin(address newAdmin) public { assertEq(stakingContract.getAdmin(), admin); // Start ownership transfer process. @@ -206,20 +219,16 @@ contract StakingContractTest is DSTestPlus { ); } - function testTransferOwnershipUnauthorized(uint256 _adminSalt) public { - address newAdmin = uf._new(_adminSalt); + function testTransferOwnershipUnauthorized(address newAdmin) public { vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); stakingContract.transferOwnership(newAdmin); } - function testAcceptOwnershipUnauthorized(uint256 _adminSalt) public { - address newAdmin = uf._new(_adminSalt); - + function testAcceptOwnershipUnauthorized(address newAdmin, address randomUser) public { vm.startPrank(admin); stakingContract.transferOwnership(newAdmin); vm.stopPrank(); - address randomUser = uf._new(_adminSalt); // A random user tries to accept new admin's role. vm.startPrank(randomUser); vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); @@ -227,7 +236,7 @@ contract StakingContractTest is DSTestPlus { vm.stopPrank(); } - function testGetOperator() public { + function testGetOperator() public view { ( address operatorAddress, address feeRecipientAddress, @@ -236,9 +245,9 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 0); @@ -246,26 +255,15 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == false); } - function testAddOperatorUnauthorized(uint256 _operatorSalt) public { - address newOperator = uf._new(_operatorSalt); - address newOperatorFeeRecipient = uf._new(_operatorSalt); - - uint256 operatorIndex; - + function testAddOperatorUnauthorized(address newOperator, address newOperatorFeeRecipient) public { vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); - operatorIndex = stakingContract.addOperator(newOperator, newOperatorFeeRecipient); + stakingContract.addOperator(newOperator, newOperatorFeeRecipient); } - function testSetOperatorAddresses(uint256 _operatorSalt) public { - address newOperatorFeeRecipient = uf._new(_operatorSalt); - - uint256 operatorIndex = 0; - - address updatedOperator = uf._new(_operatorSalt); - + function testSetOperatorAddresses(address newOperatorFeeRecipient, address updatedOperator) public { // Try to update the operator address - vm.startPrank(feeRecipientOne); - stakingContract.setOperatorAddresses(operatorIndex, updatedOperator, newOperatorFeeRecipient); + vm.startPrank(feeRecipient); + stakingContract.setOperatorAddresses(OPERATOR_INDEX, updatedOperator, newOperatorFeeRecipient); vm.stopPrank(); ( @@ -276,7 +274,7 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(operatorIndex); + ) = stakingContract.getOperator(OPERATOR_INDEX); assertEq(operatorAddress, updatedOperator); assertEq(feeRecipientAddress, newOperatorFeeRecipient); assertEq(limit, 10); @@ -286,29 +284,22 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == false); } - function testSetOperatorAddressesUnauthorized(uint256 _operatorSalt) public { - address newOperator = uf._new(_operatorSalt); - address wrongOperatorFeeRecipient = uf._new(_operatorSalt); - - uint256 operatorIndex = 0; - + function testSetOperatorAddressesUnauthorized(address newOperator, address wrongOperatorFeeRecipient) public { // Try to update the operator addresses vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); - stakingContract.setOperatorAddresses(operatorIndex, newOperator, wrongOperatorFeeRecipient); + stakingContract.setOperatorAddresses(OPERATOR_INDEX, newOperator, wrongOperatorFeeRecipient); } event ChangedOperatorLimit(uint256 operatorIndex, uint256 limit); - function testSetOperatorLimit(uint256 _operatorSalt, uint8 _limit) public { - uint256 operatorIndex = 0; - - (, , uint256 limit, , , , ) = stakingContract.getOperator(operatorIndex); + function testSetOperatorLimit(uint8 _limit) public { + (, , uint256 limit, , , , ) = stakingContract.getOperator(OPERATOR_INDEX); assertEq(limit, 10); if (_limit > 0) { - vm.startPrank(operatorOne); + vm.startPrank(operator); stakingContract.addValidators( - operatorIndex, + OPERATOR_INDEX, _limit, genBytes(48 * uint256(_limit)), genBytes(96 * uint256(_limit)) @@ -318,55 +309,58 @@ contract StakingContractTest is DSTestPlus { vm.startPrank(admin); vm.expectEmit(true, true, true, true); - emit ChangedOperatorLimit(operatorIndex, _limit); - stakingContract.setOperatorLimit(operatorIndex, _limit, block.number); + emit ChangedOperatorLimit(OPERATOR_INDEX, _limit); + stakingContract.setOperatorLimit(OPERATOR_INDEX, _limit, block.number); vm.stopPrank(); - (, , limit, , , , ) = stakingContract.getOperator(operatorIndex); + (, , limit, , , , ) = stakingContract.getOperator(OPERATOR_INDEX); assertEq(limit, _limit); } - function testSetOperatorLimit_snapshotRevert(uint256 _operatorSalt, uint8 _limit) public { + function testSetOperatorLimit_snapshotRevert(uint8 _limit) public { vm.assume(_limit > 10); // Ensuring we raise the existing limit - (, , uint256 limit, , , , ) = stakingContract.getOperator(0); + (, , uint256 limit, , , , ) = stakingContract.getOperator(OPERATOR_INDEX); assertEq(limit, 10); vm.roll(1000); if (_limit > 0) { - vm.startPrank(operatorOne); - stakingContract.addValidators(0, _limit, genBytes(48 * uint256(_limit)), genBytes(96 * uint256(_limit))); + vm.startPrank(operator); + stakingContract.addValidators( + OPERATOR_INDEX, + _limit, + genBytes(48 * uint256(_limit)), + genBytes(96 * uint256(_limit)) + ); vm.stopPrank(); } vm.startPrank(admin); vm.expectRevert(abi.encodeWithSignature("LastEditAfterSnapshot()")); - stakingContract.setOperatorLimit(0, _limit, block.number - 10); + stakingContract.setOperatorLimit(OPERATOR_INDEX, _limit, block.number - 10); vm.stopPrank(); } function testSetOperatorLimitUnauthorized() public { vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); - stakingContract.setOperatorLimit(0, 10, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 10, block.number); } function testSetOperatorLimitTooHighUnauthorized() public { vm.startPrank(admin); vm.expectRevert(abi.encodeWithSignature("OperatorLimitTooHigh(uint256,uint256)", 11, 10)); - stakingContract.setOperatorLimit(0, 11, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 11, block.number); vm.stopPrank(); } - function testSetOperatorLimitDeactivated(uint256 _operatorSalt, uint8 _limit) public { - uint256 operatorIndex = 0; - - (, , uint256 limit, , , , ) = stakingContract.getOperator(operatorIndex); + function testSetOperatorLimitDeactivated(uint8 _limit) public { + (, , uint256 limit, , , , ) = stakingContract.getOperator(OPERATOR_INDEX); assertEq(limit, 10); if (_limit > 0) { - vm.startPrank(operatorOne); + vm.startPrank(operator); stakingContract.addValidators( - operatorIndex, + OPERATOR_INDEX, _limit, genBytes(48 * uint256(_limit)), genBytes(96 * uint256(_limit)) @@ -375,18 +369,13 @@ contract StakingContractTest is DSTestPlus { } vm.startPrank(admin); - stakingContract.deactivateOperator(operatorIndex, operatorOne); + stakingContract.deactivateOperator(OPERATOR_INDEX, operator); vm.expectRevert(abi.encodeWithSignature("Deactivated()")); - stakingContract.setOperatorLimit(operatorIndex, _limit, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, _limit, block.number); vm.stopPrank(); } - function testAddValidatorsOperatorOne() public { - bytes - memory publicKeys = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fb1e"; - bytes - memory signatures = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d0c"; - + function testAddValidatorsOperator() public { ( address operatorAddress, address feeRecipientAddress, @@ -395,31 +384,29 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 0); assertEq(available, 10); assert(deactivated == false); - bytes - memory pubKey1 = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b0"; - assertFalse(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(pubKey1, bytes16(0))))); + assertFalse(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(PUBKEY_2_1, bytes16(0))))); - vm.startPrank(operatorOne); + vm.startPrank(operator); vm.expectEmit(true, true, true, true); - emit ValidatorKeysAdded(0, publicKeys, signatures); - stakingContract.addValidators(0, 10, publicKeys, signatures); + emit ValidatorKeysAdded(OPERATOR_INDEX, PUBLIC_KEYS_2, SIGNATURES_2); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS_2, SIGNATURES_2); vm.stopPrank(); - assertTrue(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(pubKey1, bytes16(0))))); + assertTrue(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(PUBKEY_2_1, bytes16(0))))); (operatorAddress, feeRecipientAddress, limit, keys, funded, available, deactivated) = stakingContract - .getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + .getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 20); assertEq(funded, 0); @@ -427,14 +414,14 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == false); vm.startPrank(admin); - stakingContract.setOperatorLimit(0, 20, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 20, block.number); vm.stopPrank(); (operatorAddress, feeRecipientAddress, limit, keys, funded, available, deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 20); assertEq(keys, 20); assertEq(funded, 0); @@ -445,23 +432,18 @@ contract StakingContractTest is DSTestPlus { event DeactivatedOperator(uint256 _operatorIndex); event ActivatedOperator(uint256 _operatorIndex); - function testAddValidatorsDeactivatedOperatorOne() public { - bytes - memory publicKeys = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fb1e"; - bytes - memory signatures = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d0c"; - + function testAddValidatorsDeactivatedOperator() public { ( address operatorAddress, - address feeRecipient, + address feeRecipientAddress, uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipient, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 0); @@ -470,12 +452,14 @@ contract StakingContractTest is DSTestPlus { vm.startPrank(admin); vm.expectEmit(true, true, true, true); - emit DeactivatedOperator(0); - stakingContract.deactivateOperator(0, address(1)); + emit DeactivatedOperator(OPERATOR_INDEX); + stakingContract.deactivateOperator(OPERATOR_INDEX, address(1)); vm.stopPrank(); - (operatorAddress, feeRecipient, limit, keys, funded, available, deactivated) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); + (operatorAddress, feeRecipient, limit, keys, funded, available, deactivated) = stakingContract.getOperator( + OPERATOR_INDEX + ); + assertEq(operatorAddress, operator); assertEq(feeRecipient, address(1)); assertEq(limit, 0); assertEq(keys, 10); @@ -483,37 +467,39 @@ contract StakingContractTest is DSTestPlus { assertEq(available, 0); assert(deactivated == true); - vm.startPrank(operatorOne); + vm.startPrank(operator); vm.expectRevert(abi.encodeWithSignature("Deactivated()")); - stakingContract.addValidators(0, 10, publicKeys, signatures); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS_2, SIGNATURES_2); vm.stopPrank(); - vm.startPrank(operatorOne); + vm.startPrank(operator); uint256[] memory indexes = new uint256[](1); indexes[0] = 0; vm.expectRevert(abi.encodeWithSignature("Deactivated()")); - stakingContract.removeValidators(0, indexes); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); - vm.startPrank(feeRecipientOne); + vm.startPrank(feeRecipient); vm.expectRevert(abi.encodeWithSignature("Deactivated()")); - stakingContract.setOperatorAddresses(0, operatorOne, feeRecipientOne); + stakingContract.setOperatorAddresses(OPERATOR_INDEX, operator, feeRecipient); vm.stopPrank(); vm.startPrank(admin); vm.expectEmit(true, true, true, true); - emit ActivatedOperator(0); - stakingContract.activateOperator(0, feeRecipientOne); + emit ActivatedOperator(OPERATOR_INDEX); + stakingContract.activateOperator(OPERATOR_INDEX, feeRecipient); vm.stopPrank(); - vm.startPrank(operatorOne); - stakingContract.addValidators(0, 10, publicKeys, signatures); + vm.startPrank(operator); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS_2, SIGNATURES_2); vm.stopPrank(); - (operatorAddress, feeRecipient, limit, keys, funded, available, deactivated) = stakingContract.getOperator(0); + (operatorAddress, feeRecipient, limit, keys, funded, available, deactivated) = stakingContract.getOperator( + OPERATOR_INDEX + ); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipient, feeRecipientOne); + assertEq(operatorAddress, operator); + assertEq(feeRecipient, feeRecipient); assertEq(limit, 0); assertEq(keys, 20); assertEq(funded, 0); @@ -521,12 +507,7 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == false); } - function testAddValidatorsOperatorOneDuplicateKeys() public { - bytes - memory publicKeys = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fb1e"; - bytes - memory signatures = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d0c"; - + function testAddValidatorsoperatorDuplicateKeys() public { ( address operatorAddress, address feeRecipientAddress, @@ -535,65 +516,47 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 0); assertEq(available, 10); assert(deactivated == false); - vm.startPrank(operatorOne); - stakingContract.addValidators(0, 10, publicKeys, signatures); + vm.startPrank(operator); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS_2, SIGNATURES_2); vm.stopPrank(); - vm.startPrank(operatorOne); - vm.expectRevert( - abi.encodeWithSignature( - "DuplicateValidatorKey(bytes)", - hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b0" - ) - ); - stakingContract.addValidators(0, 10, publicKeys, signatures); + vm.startPrank(operator); + vm.expectRevert(abi.encodeWithSignature("DuplicateValidatorKey(bytes)", PUBKEY_2_1)); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS_2, SIGNATURES_2); vm.stopPrank(); } function testAddValidatorsInvalidPubKey() public { - bytes - memory publicKeys = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fb"; - bytes - memory signatures = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d0c"; - - vm.startPrank(operatorOne); + bytes memory corruptedPublicKeys = bytes.concat(PUBLIC_KEYS, hex"42"); + vm.startPrank(operator); vm.expectRevert(abi.encodeWithSignature("InvalidPublicKeys()")); - stakingContract.addValidators(0, 10, publicKeys, signatures); + stakingContract.addValidators(OPERATOR_INDEX, 10, corruptedPublicKeys, SIGNATURES); vm.stopPrank(); } function testAddValidatorsInvalidSignature() public { - bytes - memory publicKeys = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fbff"; - bytes - memory signatures = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d"; - - vm.startPrank(operatorOne); + bytes memory corruptedSignatures = bytes.concat(SIGNATURES, hex"42"); + vm.startPrank(operator); vm.expectRevert(abi.encodeWithSignature("InvalidSignatures()")); - stakingContract.addValidators(0, 10, publicKeys, signatures); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS, corruptedSignatures); vm.stopPrank(); } function testAddValidatorsUnauthorized() public { - bytes - memory publicKeys = hex"0c74b6d3d877bbb2083f1bcc83b302f3ed533eaf3cd39cff97daf2c7b9b776168481aa7b51778df673a37049886f25b07f03dbc79d85fa9d41f9eefa8e598353b652aadf497673744527c73127f872b91cf31ec8041dae1b3a4238683cf442ea23a95fe68b400ab42b14e8c99280a057d1d840e80723c3622b38e6acd1f471bf247cf62312c9b863a75ac0d270cefa4f84fd8586dbda15c67c1a46e85cf56c60550f54cb082770baf3d2bbf4c33f5254bd0b93e017f3ed036b13baec41bb69085f9eff48651be38c8f9e1f67b643f84ec356864aaa057f0042b121b9d040ed9be3f5cc9cc659d8f8fc02575ed3c25708adac2c8d0c50ab7e4599ce9edf300d98e1cfcfc8e0022a24c712f0769de99a3389bac1cdca92ae20fba323142fe2e8d09ef2cb59c3f822779b3fe6410cddce7255d35db01093cc435c0a35bbb4cd8d4eb3bd2cc597c49a7a909c16f67fe8b6702d5d0c22ad189b1c45325190015b0017606f768c7aa2006cc19dfeb5f367eae9dd17a5c307705db1f5cec552fc038e5fa3a76352d9621a4d74b1fd7e1707c7bfb5e912e2b5a33a2f34a419055d0c4065aa787f743aff953d73441e96ffc9b0f5a3248c23398518a758aec8451b626bff7eed063a3b11bf661d10ad6dac5ee62f47be125e3c668e14b3c704d736b4fbff"; - bytes - memory signatures = hex"fe41ffbe702fb08d01063c9cd99fac11a16e921c784e681e365db00c4bd6760df67cfc0d0555a8ee8bf534a2c0987b7949b18dba726ced579240fa063274bc7ab25e44b758c452c433debfebbc075cbe105f07502402a9591dc891640a9f2b34fe0863bf987ff4b5a601b0ffcecc185f04847e0b97d3fb9457c32efb9c3ce35520308cfcc8ca78d5d4da164f6d1575d32fe466b8076bc4056ad97fa3e3607a60e5e420bdec413e5ffcc3119b1b89a957b14a437e009a858c4c40c0f1fc7f3d1ad83bc96ada6c2c772260637774e5fbdc60791db6de3a31e136c28106b35c21932a8ed610306f0723675730e31d3deceff4f912e6070c9efcd6e3f0c9ad4a0e203f437f21679b87d46351714b5a1b6226f8ffadd19e18f85c918461ab67291e1c8cdfdc05280adf2b923f1269cf7de8bd351a7ede13524e836cbfc7ba22db91aaa5c9a0729a469985f5bd844347ba9a9b4019f4ad42c2025457cf48557494ac3ce6e311a1ded3e903cd3009d18133015d445d02a3ce3858781b582d28701a311ddb271f8a0c91c65b32cc13c512c35e5be9bb9dc556dfd3249a3733f58426718974820f17b3242a089e29b129fcea37c8b84996e2c725b59efccee24068625584e583700346f823ce92e11ac9db5964ca6300905c5e9f294330037ec1cb7d9b8fc28829b98fcc0fc405afcd54f43cb4a14e8cab3f5aa979fe2c3492fe295e1a50170e8857bd94e5b009bcec9626e6eb137b272882037202da7329dadcb5b99bbd7835b8875d696dab41774dcb559bfb4c79a5337efc5f1606bc7c2752389a49b6a578f0c7c58e2bf9efc55eef19beaf3de94da90c712ca3891ac71a6ff6d778a1c0c31f77fdde2c4b7f29adf8ccf000050e9e4829d2de36fda8d6b26020e6f0ece339e9ad96c01b166301238e1aaa30ddfb978968361a5f9d3fcaa381973c967c0dd88c6d54d00fa375ab4df3be57c4360b69d7634e95e4d4201da8f2348d0ce53be690146f0049d5d173a635d21406b10ed23ec9996bd0a43b812df363986fb8dedf5be1cdb3f85a5090460511af617507d24657e3733310b42e1406070a0316620037da35c5227bb85d3aacf3aebf750265838994e03a8770cdc1c31723ca1037232c32d21f31eee561575b18b1b4c0f027f270898aed60ab4bfe41160cd989cd5bdfeb795097ff01cd0ff41fea96311e92798c0a619aa957772cfd408747fc30dcb39210839a4c70b87d3ad881207fa5eee926bc2c6936ce10b382c7a37606d40bb1cf2637768255aae4a4cd18ed7004e3046520bea92c66a7074e4b46d3d566703e44d0c3f9ef49a2ff30632fe3f6a409178db66423809514cd7473f83d0c"; - vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); - stakingContract.addValidators(0, 10, publicKeys, signatures); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS, SIGNATURES); } - function testRemoveValidatorsOperatorOne() public { + function testRemoveValidatorsoperator() public { ( address operatorAddress, address feeRecipientAddress, @@ -602,9 +565,9 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 0); @@ -623,22 +586,20 @@ contract StakingContractTest is DSTestPlus { indexes[8] = 1; indexes[9] = 0; - bytes - memory pubKey = hex"fdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - assertTrue(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(pubKey, bytes16(0))))); + assertTrue(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(PUBKEY_10, bytes16(0))))); - vm.startPrank(operatorOne); + vm.startPrank(operator); vm.expectEmit(true, true, true, true); - emit ValidatorKeyRemoved(0, pubKey); - stakingContract.removeValidators(0, indexes); + emit ValidatorKeyRemoved(OPERATOR_INDEX, PUBKEY_10); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); - assertFalse(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(pubKey, bytes16(0))))); + assertFalse(stakingContract.getEnabledFromPublicKeyRoot(sha256(abi.encodePacked(PUBKEY_10, bytes16(0))))); (operatorAddress, feeRecipientAddress, limit, keys, funded, available, deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); - assertEq(operatorAddress, operatorOne); + assertEq(operatorAddress, operator); assertEq(limit, 0); assertEq(keys, 0); assertEq(funded, 0); @@ -646,7 +607,7 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == false); } - function testRemoveValidatorsDeactivatedOperatorOne() public { + function testRemoveValidatorsDeactivatedoperator() public { ( address operatorAddress, address feeRecipientAddress, @@ -655,9 +616,9 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 0); @@ -677,18 +638,18 @@ contract StakingContractTest is DSTestPlus { indexes[9] = 0; vm.startPrank(admin); - stakingContract.deactivateOperator(0, address(1)); + stakingContract.deactivateOperator(OPERATOR_INDEX, address(1)); vm.stopPrank(); - vm.startPrank(operatorOne); + vm.startPrank(operator); vm.expectRevert(abi.encodeWithSignature("Deactivated()")); - stakingContract.removeValidators(0, indexes); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); (operatorAddress, feeRecipientAddress, limit, keys, funded, available, deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); - assertEq(operatorAddress, operatorOne); + assertEq(operatorAddress, operator); assertEq(feeRecipientAddress, address(1)); assertEq(limit, 0); assertEq(keys, 10); @@ -697,13 +658,13 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == true); vm.startPrank(admin); - stakingContract.removeValidators(0, indexes); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); (operatorAddress, feeRecipientAddress, limit, keys, funded, available, deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); - assertEq(operatorAddress, operatorOne); + assertEq(operatorAddress, operator); assertEq(feeRecipientAddress, address(1)); assertEq(limit, 0); assertEq(keys, 0); @@ -712,7 +673,7 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == true); } - function testRemoveValidatorsOperatorOneInvalidIndexes() public { + function testRemoveValidatorsoperatorInvalidIndexes() public { uint256[] memory indexes = new uint256[](10); indexes[0] = 8; indexes[1] = 9; @@ -725,13 +686,13 @@ contract StakingContractTest is DSTestPlus { indexes[8] = 1; indexes[9] = 0; - vm.startPrank(operatorOne); + vm.startPrank(operator); vm.expectRevert(abi.encodeWithSignature("UnsortedIndexes()")); - stakingContract.removeValidators(0, indexes); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); } - function testRemoveValidatorsOperatorOneUnauthorized() public { + function testRemoveValidatorsoperatorUnauthorized() public { uint256[] memory indexes = new uint256[](10); indexes[0] = 9; indexes[1] = 8; @@ -745,11 +706,11 @@ contract StakingContractTest is DSTestPlus { indexes[9] = 0; vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); - stakingContract.removeValidators(0, indexes); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); } - function testRemoveValidatorsWhileFunded(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testRemoveValidatorsWhileFunded(address user) public { + vm.assume(user != address(depositContract)); vm.deal(user, 32 * 1 ether); vm.startPrank(user); @@ -770,8 +731,8 @@ contract StakingContractTest is DSTestPlus { indexes[7] = 2; indexes[8] = 1; - vm.startPrank(operatorOne); - stakingContract.removeValidators(0, indexes); + vm.startPrank(operator); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); ( @@ -782,9 +743,9 @@ contract StakingContractTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 1); assertEq(keys, 1); assertEq(funded, 1); @@ -792,8 +753,8 @@ contract StakingContractTest is DSTestPlus { assert(deactivated == false); } - function testRemoveFundedValidator(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testRemoveFundedValidator(address user) public { + vm.assume(user != address(depositContract)); vm.deal(user, 32 * 3 ether); vm.roll(99999); @@ -816,17 +777,16 @@ contract StakingContractTest is DSTestPlus { indexes[8] = 1; indexes[9] = 0; - vm.startPrank(operatorOne); + vm.startPrank(operator); vm.expectRevert(abi.encodeWithSignature("FundedValidatorDeletionAttempt()")); - stakingContract.removeValidators(0, indexes); + stakingContract.removeValidators(OPERATOR_INDEX, indexes); vm.stopPrank(); } event SetWithdrawerCustomizationStatus(bool _status); - function testSetWithdrawer(uint256 _userSalt, uint256 _anotherUserSalt) public { - address user = uf._new(_userSalt); - address anotherUser = uf._new(_anotherUserSalt); + function testSetWithdrawer(address user, address anotherUser) public { + vm.assume(user != address(depositContract) && anotherUser != address(depositContract)); vm.deal(user, 32 * 3 ether); vm.startPrank(user); @@ -836,8 +796,7 @@ contract StakingContractTest is DSTestPlus { assertEq(user.balance, 0); - bytes - memory pk = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory pk = PUBKEY_1; assertEq(stakingContract.getWithdrawer(pk), user); @@ -852,9 +811,8 @@ contract StakingContractTest is DSTestPlus { vm.stopPrank(); } - function testSetWithdrawerForbidden(uint256 _userSalt, uint256 _anotherUserSalt) public { - address user = uf._new(_userSalt); - address anotherUser = uf._new(_anotherUserSalt); + function testSetWithdrawerForbidden(address user, address anotherUser) public { + vm.assume(user != address(depositContract) && anotherUser != address(depositContract)); vm.deal(user, 32 * 3 ether); vm.startPrank(user); @@ -864,20 +822,16 @@ contract StakingContractTest is DSTestPlus { assertEq(user.balance, 0); - bytes - memory pk = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - - assertEq(stakingContract.getWithdrawer(pk), user); + assertEq(stakingContract.getWithdrawer(PUBKEY_1), user); vm.startPrank(user); vm.expectRevert(abi.encodeWithSignature("Forbidden()")); - stakingContract.setWithdrawer(pk, anotherUser); + stakingContract.setWithdrawer(PUBKEY_1, anotherUser); vm.stopPrank(); } - function testSetWithdrawerUnauthorized(uint256 _userSalt, uint256 _anotherUserSalt) public { - address user = uf._new(_userSalt); - address anotherUser = uf._new(_anotherUserSalt); + function testSetWithdrawerUnauthorized(address user, address anotherUser) public { + vm.assume(user != address(depositContract) && anotherUser != address(depositContract)); vm.deal(user, 32 * 3 ether); vm.startPrank(user); @@ -891,21 +845,17 @@ contract StakingContractTest is DSTestPlus { stakingContract.setWithdrawerCustomizationEnabled(true); vm.stopPrank(); - bytes - memory pk = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - - assertEq(stakingContract.getWithdrawer(pk), user); + assertEq(stakingContract.getWithdrawer(PUBKEY_1), user); vm.startPrank(anotherUser); vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); - stakingContract.setWithdrawer(pk, anotherUser); + stakingContract.setWithdrawer(PUBKEY_1, anotherUser); vm.stopPrank(); } event ChangedTreasury(address newTreasury); - function testSetTreasury(uint256 _treasurySalt) public { - address newTreasury = uf._new(_treasurySalt); + function testSetTreasury(address newTreasury) public { vm.startPrank(admin); vm.expectEmit(true, true, true, true); emit ChangedTreasury(newTreasury); @@ -916,9 +866,7 @@ contract StakingContractTest is DSTestPlus { assertEq(newTreasury, gotTreasury); } - function testSetTreasuryUnauthorized(uint256 _userSalt) public { - address user = uf._new(_userSalt); - + function testSetTreasuryUnauthorized(address user) public { vm.startPrank(user); vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); stakingContract.setTreasury(user); @@ -926,23 +874,16 @@ contract StakingContractTest is DSTestPlus { } } -contract StakingContractInitializationTest is DSTestPlus { - Vm internal vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); - +contract StakingContractInitializationTest is Test { address internal treasury; StakingContract internal stakingContract; DepositContractMock internal depositContract; - UserFactory internal uf; address internal admin = address(1); bytes32 salt = bytes32(0); function setUp() public { - uf = new UserFactory(); - address[] memory recipients = new address[](1); - uint256[] memory percents = new uint256[](1); - percents[0] = 10_000; treasury = address(99); stakingContract = new StakingContract(); depositContract = new DepositContractMock(); @@ -1008,7 +949,7 @@ contract StakingContractInitializationTest is DSTestPlus { event NewOperator(address operatorAddress, address feeRecipientAddress, uint256 index); - function testAddOperator(uint256 _operatorSalt) public { + function testAddOperator(address newOperator, address newOperatorFeeRecipient) public { stakingContract.initialize_1( admin, address(treasury), @@ -1021,15 +962,11 @@ contract StakingContractInitializationTest is DSTestPlus { 2000, 5000 ); - address newOperator = uf._new(_operatorSalt); - address newOperatorFeeRecipient = uf._new(_operatorSalt); - - uint256 operatorIndex; vm.startPrank(admin); vm.expectEmit(true, true, true, true); emit NewOperator(newOperator, newOperatorFeeRecipient, 0); - operatorIndex = stakingContract.addOperator(newOperator, newOperatorFeeRecipient); + stakingContract.addOperator(newOperator, newOperatorFeeRecipient); vm.stopPrank(); ( @@ -1040,7 +977,7 @@ contract StakingContractInitializationTest is DSTestPlus { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(operatorIndex); + ) = stakingContract.getOperator(OPERATOR_INDEX); assertEq(operatorAddress, newOperator); assertEq(feeRecipientAddress, newOperatorFeeRecipient); assertEq(limit, 0); @@ -1051,23 +988,16 @@ contract StakingContractInitializationTest is DSTestPlus { } } -contract StakingContractOperatorTest is DSTestPlus { - Vm internal vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); - +contract StakingContractOperatorTest is Test { address internal treasury; StakingContract internal stakingContract; DepositContractMock internal depositContract; - UserFactory internal uf; address internal admin = address(1); bytes32 salt = bytes32(0); function setUp() public { - uf = new UserFactory(); - address[] memory recipients = new address[](1); - uint256[] memory percents = new uint256[](1); - percents[0] = 10_000; treasury = address(99); stakingContract = new StakingContract(); depositContract = new DepositContractMock(); @@ -1085,58 +1015,35 @@ contract StakingContractOperatorTest is DSTestPlus { ); } - function testAddOperatorLimitReached(uint128 _operatorSalt) public { - vm.roll(uint256(_operatorSalt) + 1); - uint256 operatorIndex = 0; - address newOperator; - address newOperatorFeeRecipient; - + function testAddOperatorLimitReached(address newOperator, address newOperatorFeeRecipient) public { vm.startPrank(admin); - address operatorZero; - // We register as much operator as possible. - for (uint256 i = 0; i < 1; i++) { - newOperator = uf._new(uint256(_operatorSalt) + (i * 2)); - if (i == 0) { - operatorZero = newOperator; - } - newOperatorFeeRecipient = uf._new(uint256(_operatorSalt) + (i * 2) + 1); + stakingContract.addOperator(newOperator, newOperatorFeeRecipient); + address operatorZero = newOperator; - operatorIndex = stakingContract.addOperator(newOperator, newOperator); - assertEq(i, operatorIndex); - } - - bytes - memory publicKeys = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - - bytes - memory signatures = hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966f393d619cbf13ff427df11dcb17026df25f35268de5b168e359c16f2a3d5fbc6376db44638d773c851c875f21222448433d285920e8bdc4f5cbff130d7387c0a9589324286aea398e5aacad3bbfe3992dfce62571f0e282ed9c29e3fa5b07aa5c81749589b1170d3b85a84331e2f6b8e26eadebfd569b225759f40bbd12d6c3d253ed3f379b014b2ea44cce54d362072e2d020ff139a903b7d87fc3fddc2e6657c83e0b79851c22c6e0e477463463c97d6cc0e2e2de5e35b227bddb285521be3766358abaf3159d89f68c9770e28278f177088cfc4089b817effaaecabdffa4e66427868b105cb9348ea2d84eeea059a5d1ff3277d6f9cf656fc973d07cabed70fb8f8eb2798a65d207a8e1f8a26910949db9fa62d62bc15ecc097a93a27a1873405b8589a4ddf0ecf0303c6031484562b32eb7881975026524d6d4a9de6cd73fe2c324501586b9b6fa6bce950bbd21472278302f83dbfd6be036f2fc36d299d66578e844be3d6aa8314fab468f038fd6e130ada0a886fccfb2fd843f7dd07e8968401bbe2af7345fce52ba4b310b30af2d54b15669d06c206682c1730ab6b17787e361f04401f78dc5cbd5fac955df4e83c24cdabfabdb3f4ea40961d04a5ca166c17694fca144025b47131a68ddb230d36fe6e831e82624c9a925d706bff86982852b26ebf019a3f6ee36aedbbc6bec2d50531a233e09225493d3c5fd48379aec373baf622fb9feed6261e5296e5ae6601e7523c7f386801ed63a344b07106a0d03e5848209db5e114c0e67884916a43a1bfb77d9b8ea113c3ba8cad4b006aafeadcc31e70e85c5efecaf807154d011c1413340d4b592d2f270fb48b2050e08493c1427ddfac8dcc27fe434d32a35dcbddbcb1c4e22ead6734a4ac910f6768bc9ff6b355c1151695e41121cdcc9d9d3b18cf4d66ca3c1db0527c471a0dcf256590602a7269dcb26175e7eb370bd9794ac8ab558bea69e6a92d8e818b675a80e2df0516b8307291d93cb85d959ac60d47b46455a7ab0a38687c747c6d2d9e8c20ccf74dc6cdf145ec06805d4ac24a39aec2f5cd6e26e63e3d043a31c42411e4"; vm.stopPrank(); vm.startPrank(operatorZero); - stakingContract.addValidators(0, 10, publicKeys, signatures); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS, SIGNATURES); vm.stopPrank(); vm.startPrank(admin); - stakingContract.setOperatorLimit(0, 10, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 10, block.number); vm.stopPrank(); vm.deal(address(this), 32 ether); stakingContract.deposit{value: 32 ether}(); vm.startPrank(admin); - newOperator = uf._new(_operatorSalt); - newOperatorFeeRecipient = uf._new(_operatorSalt); + newOperator = makeAddr("newOperator2"); + newOperatorFeeRecipient = makeAddr("newOperatorFeeRecipient2"); vm.expectRevert(abi.encodeWithSignature("MaximumOperatorCountAlreadyReached()")); - operatorIndex = stakingContract.addOperator(newOperator, newOperatorFeeRecipient); + stakingContract.addOperator(newOperator, newOperatorFeeRecipient); vm.stopPrank(); } } -contract StakingContractDistributionTest is DSTestPlus { - Vm internal vm = Vm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D); - +contract StakingContractDistributionTest is Test { address internal treasury; StakingContract internal stakingContract; DepositContractMock internal depositContract; - UserFactory internal uf; address internal admin = address(1); address internal bob = address(2); @@ -1145,10 +1052,6 @@ contract StakingContractDistributionTest is DSTestPlus { bytes32 salt = bytes32(0); function setUp() public { - uf = new UserFactory(); - address[] memory recipients = new address[](1); - uint256[] memory percents = new uint256[](1); - percents[0] = 10_000; treasury = address(99); stakingContract = new StakingContract(); depositContract = new DepositContractMock(); @@ -1188,25 +1091,23 @@ contract StakingContractDistributionTest is DSTestPlus { keyPerOperator = 3; } - uint256 depositCount = (uint256(newOps) * uint256(keyPerOperator)) / 2; + uint256 depositCount = uint256(keyPerOperator) / 2; - for (uint256 i; i < newOps; ++i) { - vm.startPrank(admin); - address newOperator = uf._new(uint256(keccak256(abi.encodePacked(i)))); - address newOperatorFeeRecipient = uf._new(uint256(keccak256(abi.encodePacked(i)))); + vm.startPrank(admin); + address newOperator = makeAddr("newOp"); + address newOperatorFeeRecipient = makeAddr("newOpFeRe"); - stakingContract.addOperator(newOperator, newOperatorFeeRecipient); - operators.push(newOperator); - vm.stopPrank(); - vm.startPrank(newOperator); - bytes memory publicKeys = genBytes(uint256(keyPerOperator) * 48); - bytes memory signatures = genBytes(uint256(keyPerOperator) * 96); - stakingContract.addValidators(i, keyPerOperator, publicKeys, signatures); - vm.stopPrank(); - vm.startPrank(admin); - stakingContract.setOperatorLimit(i, keyPerOperator, block.number); - vm.stopPrank(); - } + stakingContract.addOperator(newOperator, newOperatorFeeRecipient); + operators.push(newOperator); + vm.stopPrank(); + vm.startPrank(newOperator); + bytes memory publicKeys = genBytes(uint256(keyPerOperator) * 48); + bytes memory signatures = genBytes(uint256(keyPerOperator) * 96); + stakingContract.addValidators(OPERATOR_INDEX, keyPerOperator, publicKeys, signatures); + vm.stopPrank(); + vm.startPrank(admin); + stakingContract.setOperatorLimit(OPERATOR_INDEX, keyPerOperator, block.number); + vm.stopPrank(); for (uint256 i; i < depositCount; ) { // +1 To prevent underflow. @@ -1242,26 +1143,30 @@ contract StakingContractDistributionTest is DSTestPlus { } contract StakingContractOneValidatorTest is Test { - address internal treasury; StakingContract internal stakingContract; DepositContractMock internal depositContract; - UserFactory internal uf; - address internal admin = address(1); - address internal bob = address(2); - address internal alice = address(3); - address internal operatorOne = address(4); - address internal feeRecipientOne = address(44); + address internal proxyAdmin; + address internal admin; + address internal bob; + address internal alice; + address internal operator; + address internal feeRecipient; + address internal treasury; + ExecutionLayerFeeDispatcher internal eld; ConsensusLayerFeeDispatcher internal cld; FeeRecipient internal feeRecipientImpl; function setUp() public { - uf = new UserFactory(); - address[] memory recipients = new address[](1); - uint256[] memory percents = new uint256[](1); - percents[0] = 10_000; - treasury = address(99); + proxyAdmin = makeAddr("proxyAdmin"); + admin = makeAddr("admin"); + bob = makeAddr("bob"); + alice = makeAddr("alice"); + operator = makeAddr("operator"); + feeRecipient = makeAddr("feeRecipient"); + treasury = makeAddr("treasury"); + stakingContract = new StakingContract(); depositContract = new DepositContractMock(); feeRecipientImpl = new FeeRecipient(); @@ -1271,13 +1176,13 @@ contract StakingContractOneValidatorTest is Test { eld = ExecutionLayerFeeDispatcher( payable( - address(new TUPProxy(eldImpl, address(1), abi.encodeWithSignature("initELD(address)", stakingContract))) + address(new TUPProxy(eldImpl, proxyAdmin, abi.encodeWithSignature("initELD(address)", stakingContract))) ) ); cld = ConsensusLayerFeeDispatcher( payable( - address(new TUPProxy(cldImpl, address(1), abi.encodeWithSignature("initCLD(address)", stakingContract))) + address(new TUPProxy(cldImpl, proxyAdmin, abi.encodeWithSignature("initCLD(address)", stakingContract))) ) ); @@ -1295,24 +1200,18 @@ contract StakingContractOneValidatorTest is Test { ); vm.startPrank(admin); - stakingContract.addOperator(operatorOne, feeRecipientOne); + stakingContract.addOperator(operator, feeRecipient); vm.stopPrank(); { - bytes - memory publicKeys = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - - bytes - memory signatures = hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966f393d619cbf13ff427df11dcb17026df25f35268de5b168e359c16f2a3d5fbc6376db44638d773c851c875f21222448433d285920e8bdc4f5cbff130d7387c0a9589324286aea398e5aacad3bbfe3992dfce62571f0e282ed9c29e3fa5b07aa5c81749589b1170d3b85a84331e2f6b8e26eadebfd569b225759f40bbd12d6c3d253ed3f379b014b2ea44cce54d362072e2d020ff139a903b7d87fc3fddc2e6657c83e0b79851c22c6e0e477463463c97d6cc0e2e2de5e35b227bddb285521be3766358abaf3159d89f68c9770e28278f177088cfc4089b817effaaecabdffa4e66427868b105cb9348ea2d84eeea059a5d1ff3277d6f9cf656fc973d07cabed70fb8f8eb2798a65d207a8e1f8a26910949db9fa62d62bc15ecc097a93a27a1873405b8589a4ddf0ecf0303c6031484562b32eb7881975026524d6d4a9de6cd73fe2c324501586b9b6fa6bce950bbd21472278302f83dbfd6be036f2fc36d299d66578e844be3d6aa8314fab468f038fd6e130ada0a886fccfb2fd843f7dd07e8968401bbe2af7345fce52ba4b310b30af2d54b15669d06c206682c1730ab6b17787e361f04401f78dc5cbd5fac955df4e83c24cdabfabdb3f4ea40961d04a5ca166c17694fca144025b47131a68ddb230d36fe6e831e82624c9a925d706bff86982852b26ebf019a3f6ee36aedbbc6bec2d50531a233e09225493d3c5fd48379aec373baf622fb9feed6261e5296e5ae6601e7523c7f386801ed63a344b07106a0d03e5848209db5e114c0e67884916a43a1bfb77d9b8ea113c3ba8cad4b006aafeadcc31e70e85c5efecaf807154d011c1413340d4b592d2f270fb48b2050e08493c1427ddfac8dcc27fe434d32a35dcbddbcb1c4e22ead6734a4ac910f6768bc9ff6b355c1151695e41121cdcc9d9d3b18cf4d66ca3c1db0527c471a0dcf256590602a7269dcb26175e7eb370bd9794ac8ab558bea69e6a92d8e818b675a80e2df0516b8307291d93cb85d959ac60d47b46455a7ab0a38687c747c6d2d9e8c20ccf74dc6cdf145ec06805d4ac24a39aec2f5cd6e26e63e3d043a31c42411e4"; - - vm.startPrank(operatorOne); - stakingContract.addValidators(0, 10, publicKeys, signatures); + vm.startPrank(operator); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS, SIGNATURES); vm.stopPrank(); } { vm.startPrank(admin); - stakingContract.setOperatorLimit(0, 10, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 10, block.number); vm.stopPrank(); } } @@ -1320,28 +1219,27 @@ contract StakingContractOneValidatorTest is Test { event Deposit(address indexed caller, address indexed withdrawer, bytes publicKey, bytes signature); event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index); - function testExplicitDepositOneValidatorCheckDepositEvent(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function assumeAddress(address user) public view { + vm.assume(user != proxyAdmin && user != address(depositContract)); + } + + function testExplicitDepositOneValidatorCheckDepositEvent(address user) public { + assumeAddress(user); vm.deal(user, 32 ether); vm.startPrank(user); bytes memory expectedWithdrawalCredentials = abi.encodePacked( bytes32( - uint256( - uint160( - stakingContract.getCLFeeRecipient( - hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759" - ) - ) - ) + 0x0100000000000000000000000000000000000000000000000000000000000000 + uint256(uint160(stakingContract.getCLFeeRecipient(PUBKEY_1))) + + 0x0100000000000000000000000000000000000000000000000000000000000000 ) ); vm.expectEmit(true, true, true, true); emit DepositEvent( - hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759", + PUBKEY_1, expectedWithdrawalCredentials, hex"0040597307000000", - hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a", + SIGNATURE_1, hex"0000000000000000" ); stakingContract.deposit{value: 32 ether}(); @@ -1350,7 +1248,7 @@ contract StakingContractOneValidatorTest is Test { assertEq(user.balance, 0); (, , uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 1); @@ -1358,8 +1256,8 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testExplicitDepositOneValidator(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositOneValidator(address user) public { + assumeAddress(user); vm.deal(user, 32 ether); vm.startPrank(user); @@ -1369,7 +1267,7 @@ contract StakingContractOneValidatorTest is Test { assertEq(user.balance, 0); (, , uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 1); @@ -1377,18 +1275,13 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testExplicitDepositTwoValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositTwoValidators(address user) public { + assumeAddress(user); vm.deal(user, 32 * 2 ether); vm.startPrank(user); vm.expectEmit(true, true, true, true); - emit Deposit( - user, - user, - hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060", - hex"02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966" - ); + emit Deposit(user, user, PUBKEY_2, SIGNATURE_2); stakingContract.deposit{value: 32 * 2 ether}(); vm.stopPrank(); @@ -1402,9 +1295,9 @@ contract StakingContractOneValidatorTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 2); @@ -1412,8 +1305,8 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testExplicitDepositAllValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositAllValidators(address user) public { + assumeAddress(user); vm.deal(user, 32 * 10 ether); vm.startPrank(user); @@ -1430,9 +1323,9 @@ contract StakingContractOneValidatorTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 10); @@ -1440,8 +1333,8 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testExplicitDepositNotEnough(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositNotEnough(address user) public { + assumeAddress(user); vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -1450,8 +1343,8 @@ contract StakingContractOneValidatorTest is Test { vm.stopPrank(); } - function testExplicitDepositNotEnoughAfterFilled(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositNotEnoughAfterFilled(address user) public { + assumeAddress(user); vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -1463,8 +1356,8 @@ contract StakingContractOneValidatorTest is Test { vm.stopPrank(); } - function testExplicitDepositInvalidAmount(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositInvalidAmount(address user) public { + assumeAddress(user); vm.deal(user, 31.9 ether); vm.startPrank(user); @@ -1473,8 +1366,8 @@ contract StakingContractOneValidatorTest is Test { vm.stopPrank(); } - function testImplicitDepositOneValidator(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositOneValidator(address user) public { + assumeAddress(user); vm.deal(user, 32 ether); vm.startPrank(user); @@ -1485,7 +1378,7 @@ contract StakingContractOneValidatorTest is Test { assertEq(user.balance, 0); (, , uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 1); @@ -1493,18 +1386,13 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testImplicitDepositTwoValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositTwoValidators(address user) public { + assumeAddress(user); vm.deal(user, 32 * 2 ether); vm.startPrank(user); vm.expectEmit(true, true, true, true); - emit Deposit( - user, - user, - hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060", - hex"02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966" - ); + emit Deposit(user, user, PUBKEY_2, SIGNATURE_2); (bool _success, ) = address(stakingContract).call{value: 32 * 2 ether}(""); assert(_success == true); vm.stopPrank(); @@ -1519,9 +1407,9 @@ contract StakingContractOneValidatorTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 2); @@ -1529,8 +1417,8 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testImplicitDepositAllValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositAllValidators(address user) public { + assumeAddress(user); vm.deal(user, 32 * 10 ether); vm.startPrank(user); @@ -1548,9 +1436,9 @@ contract StakingContractOneValidatorTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 10); @@ -1558,8 +1446,8 @@ contract StakingContractOneValidatorTest is Test { assert(deactivated == false); } - function testImplicitDepositNotEnough(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositNotEnough(address user) public { + assumeAddress(user); vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -1569,8 +1457,8 @@ contract StakingContractOneValidatorTest is Test { vm.stopPrank(); } - function testImplicitDepositNotEnoughAfterFilled(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositNotEnoughAfterFilled(address user) public { + assumeAddress(user); vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -1584,8 +1472,8 @@ contract StakingContractOneValidatorTest is Test { vm.stopPrank(); } - function testImplicitDepositInvalidAmount(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositInvalidAmount(address user) public { + assumeAddress(user); vm.deal(user, 31.9 ether); vm.startPrank(user); @@ -1666,8 +1554,7 @@ contract StakingContractOneValidatorTest is Test { } function testFeeRecipients() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); address _elfr = stakingContract.getELFeeRecipient(publicKey); @@ -1676,8 +1563,7 @@ contract StakingContractOneValidatorTest is Test { } function testWithdrawELFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1686,21 +1572,20 @@ contract StakingContractOneValidatorTest is Test { address elfrBob = stakingContract.getELFeeRecipient(publicKey); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); stakingContract.withdrawELFee(publicKey); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.02 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.02 ether); assert(address(treasury).balance == 0.08 ether); } function testWithdrawELFees_asAdmin() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1709,21 +1594,20 @@ contract StakingContractOneValidatorTest is Test { address elfrBob = stakingContract.getELFeeRecipient(publicKey); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(admin); stakingContract.withdrawELFee(publicKey); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.02 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.02 ether); assert(address(treasury).balance == 0.08 ether); } function testWithdrawELFees_asRandom() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1732,8 +1616,8 @@ contract StakingContractOneValidatorTest is Test { address elfrBob = stakingContract.getELFeeRecipient(publicKey); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(elfrBob), 1 ether); vm.expectRevert(abi.encodeWithSignature("InvalidWithdrawer()")); vm.prank(address(0xdede)); @@ -1744,8 +1628,7 @@ contract StakingContractOneValidatorTest is Test { vm.startPrank(admin); stakingContract.setOperatorFee(5000); vm.stopPrank(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1754,22 +1637,21 @@ contract StakingContractOneValidatorTest is Test { address elfrBob = stakingContract.getELFeeRecipient(publicKey); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); stakingContract.withdrawELFee(publicKey); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.05 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.05 ether); assert(address(treasury).balance == 0.05 ether); } function testWithdrawELFeesAlreadyDeployed() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1778,28 +1660,27 @@ contract StakingContractOneValidatorTest is Test { address elfrBob = stakingContract.getELFeeRecipient(publicKey); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); stakingContract.withdrawELFee(publicKey); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.02 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.02 ether); assert(address(treasury).balance == 0.08 ether); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); stakingContract.withdrawELFee(publicKey); assert(bob.balance == 1.8 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.04 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.04 ether); assert(address(treasury).balance == 0.16 ether); } function testWithdrawELFeesEmptyWithdrawal() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1809,8 +1690,7 @@ contract StakingContractOneValidatorTest is Test { } function testWithdrawCLFeesExitedValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1819,9 +1699,9 @@ contract StakingContractOneValidatorTest is Test { address clfrBob = stakingContract.getCLFeeRecipient(publicKey); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assert(address(treasury).balance == 0 ether); - assert(feeRecipientOne.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); stakingContract.requestValidatorsExit(publicKey); @@ -1830,17 +1710,16 @@ contract StakingContractOneValidatorTest is Test { stakingContract.withdrawCLFee(publicKey); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 32.90 ether, 10**5); - assertEq(operatorOne.balance, 0); + assertEq(operator.balance, 0); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**5); } function testWithdrawCLFeesEditedOperatorFee() public { vm.startPrank(admin); stakingContract.setOperatorFee(5000); vm.stopPrank(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1849,8 +1728,8 @@ contract StakingContractOneValidatorTest is Test { address clfrBob = stakingContract.getCLFeeRecipient(publicKey); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); @@ -1861,13 +1740,12 @@ contract StakingContractOneValidatorTest is Test { assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 32.90 ether, 10**6); assertApproxEqAbs(address(treasury).balance, 0.05 ether, 10**6); - assertEq(operatorOne.balance, 0); - assertApproxEqAbs(feeRecipientOne.balance, 0.05 ether, 10**6); + assertEq(operator.balance, 0); + assertApproxEqAbs(feeRecipient.balance, 0.05 ether, 10**6); } function testWithdrawCLFeesSkimmedValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1876,8 +1754,8 @@ contract StakingContractOneValidatorTest is Test { address clfrBob = stakingContract.getCLFeeRecipient(publicKey); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); @@ -1885,13 +1763,12 @@ contract StakingContractOneValidatorTest is Test { assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 0.90 ether, 10**6); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**6); - assertEq(operatorOne.balance, 0); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**6); + assertEq(operator.balance, 0); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**6); } function testWithdrawCLFeesSkimmedLuckyValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1900,8 +1777,8 @@ contract StakingContractOneValidatorTest is Test { address clfrBob = stakingContract.getCLFeeRecipient(publicKey); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 2 ether); vm.prank(bob); @@ -1909,13 +1786,12 @@ contract StakingContractOneValidatorTest is Test { assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 1.8 ether, 10**6); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**6); - assertEq(operatorOne.balance, 0); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**6); + assertEq(operator.balance, 0); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**6); } function testWithdrawCLFeesSlashedValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1924,7 +1800,7 @@ contract StakingContractOneValidatorTest is Test { address clfrBob = stakingContract.getCLFeeRecipient(publicKey); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); vm.deal(address(clfrBob), 1 ether); // 1 ETH skimmed vm.deal(address(clfrBob), 32 ether); // 31 ETH forced exit after slashing, exit not requested vm.prank(bob); @@ -1933,12 +1809,11 @@ contract StakingContractOneValidatorTest is Test { // In this case bob would be manually rebated, including the commission charged on it's principal assertApproxEqAbs(bob.balance, 28.8 ether, 1); assertApproxEqAbs(address(treasury).balance, 2.56 ether, 10**6); - assertApproxEqAbs(feeRecipientOne.balance, 0.64 ether, 10**6); + assertApproxEqAbs(feeRecipient.balance, 0.64 ether, 10**6); } function testWithdrawCLFeesAlreadyDeployed() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1947,8 +1822,8 @@ contract StakingContractOneValidatorTest is Test { address clfrBob = stakingContract.getCLFeeRecipient(publicKey); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); @@ -1958,8 +1833,8 @@ contract StakingContractOneValidatorTest is Test { assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 0.90 ether, 10**6); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**6); - assertEq(operatorOne.balance, 0); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**6); + assertEq(operator.balance, 0); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**6); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); @@ -1970,13 +1845,12 @@ contract StakingContractOneValidatorTest is Test { assertApproxEqAbs(bob.balance, 33.80 ether, 10**6); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**6); - assertEq(operatorOne.balance, 0); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**6); + assertEq(operator.balance, 0); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**6); } function testWithdrawCLFeesEmptyWithdrawal() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1987,8 +1861,7 @@ contract StakingContractOneValidatorTest is Test { } function testWithdrawAllFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; + bytes memory publicKey = PUBKEY_1; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -1999,8 +1872,8 @@ contract StakingContractOneValidatorTest is Test { assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); @@ -2017,15 +1890,15 @@ contract StakingContractOneValidatorTest is Test { assertApproxEqAbs(bob.balance, 33.80 ether, 10**6); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**6); - assertEq(operatorOne.balance, 0); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**6); + assertEq(operator.balance, 0); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**6); } } contract SanctionsOracle { mapping(address => bool) sanctionsMap; - function isSanctioned(address user) public returns (bool) { + function isSanctioned(address user) public view returns (bool) { return sanctionsMap[user]; } @@ -2035,33 +1908,37 @@ contract SanctionsOracle { } contract StakingContractBehindProxyTest is Test { - address internal treasury; StakingContract internal stakingContract; DepositContractMock internal depositContract; - UserFactory internal uf; - address internal admin = address(1); - address internal bob = address(2); - address internal alice = address(3); - address internal operatorOne = address(4); - address internal feeRecipientOne = address(44); + address internal proxyAdmin; + address internal admin; + address internal bob; + address internal alice; + address internal operator; + address internal feeRecipient; + address internal treasury; + ExecutionLayerFeeDispatcher internal eld; ConsensusLayerFeeDispatcher internal cld; FeeRecipient internal feeRecipientImpl; SanctionsOracle oracle; - address internal proxyAdmin = address(42); event ExitRequest(address caller, bytes pubkey); function setUp() public { - uf = new UserFactory(); + proxyAdmin = makeAddr("proxyAdmin"); + admin = makeAddr("admin"); + bob = makeAddr("bob"); + alice = makeAddr("alice"); + operator = makeAddr("operator"); + feeRecipient = makeAddr("feeRecipient"); + treasury = makeAddr("treasury"); + depositContract = new DepositContractMock(); feeRecipientImpl = new FeeRecipient(); - address[] memory recipients = new address[](1); - uint256[] memory percents = new uint256[](1); - percents[0] = 10_000; - treasury = address(99); + address eldImpl = address(new ExecutionLayerFeeDispatcher(1)); address cldImpl = address(new ConsensusLayerFeeDispatcher(1)); address stakingContractImpl = address(new StakingContract()); @@ -2094,24 +1971,18 @@ contract StakingContractBehindProxyTest is Test { ); vm.startPrank(admin); - stakingContract.addOperator(operatorOne, feeRecipientOne); + stakingContract.addOperator(operator, feeRecipient); vm.stopPrank(); { - bytes - memory publicKeys = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - - bytes - memory signatures = hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966f393d619cbf13ff427df11dcb17026df25f35268de5b168e359c16f2a3d5fbc6376db44638d773c851c875f21222448433d285920e8bdc4f5cbff130d7387c0a9589324286aea398e5aacad3bbfe3992dfce62571f0e282ed9c29e3fa5b07aa5c81749589b1170d3b85a84331e2f6b8e26eadebfd569b225759f40bbd12d6c3d253ed3f379b014b2ea44cce54d362072e2d020ff139a903b7d87fc3fddc2e6657c83e0b79851c22c6e0e477463463c97d6cc0e2e2de5e35b227bddb285521be3766358abaf3159d89f68c9770e28278f177088cfc4089b817effaaecabdffa4e66427868b105cb9348ea2d84eeea059a5d1ff3277d6f9cf656fc973d07cabed70fb8f8eb2798a65d207a8e1f8a26910949db9fa62d62bc15ecc097a93a27a1873405b8589a4ddf0ecf0303c6031484562b32eb7881975026524d6d4a9de6cd73fe2c324501586b9b6fa6bce950bbd21472278302f83dbfd6be036f2fc36d299d66578e844be3d6aa8314fab468f038fd6e130ada0a886fccfb2fd843f7dd07e8968401bbe2af7345fce52ba4b310b30af2d54b15669d06c206682c1730ab6b17787e361f04401f78dc5cbd5fac955df4e83c24cdabfabdb3f4ea40961d04a5ca166c17694fca144025b47131a68ddb230d36fe6e831e82624c9a925d706bff86982852b26ebf019a3f6ee36aedbbc6bec2d50531a233e09225493d3c5fd48379aec373baf622fb9feed6261e5296e5ae6601e7523c7f386801ed63a344b07106a0d03e5848209db5e114c0e67884916a43a1bfb77d9b8ea113c3ba8cad4b006aafeadcc31e70e85c5efecaf807154d011c1413340d4b592d2f270fb48b2050e08493c1427ddfac8dcc27fe434d32a35dcbddbcb1c4e22ead6734a4ac910f6768bc9ff6b355c1151695e41121cdcc9d9d3b18cf4d66ca3c1db0527c471a0dcf256590602a7269dcb26175e7eb370bd9794ac8ab558bea69e6a92d8e818b675a80e2df0516b8307291d93cb85d959ac60d47b46455a7ab0a38687c747c6d2d9e8c20ccf74dc6cdf145ec06805d4ac24a39aec2f5cd6e26e63e3d043a31c42411e4"; - - vm.startPrank(operatorOne); - stakingContract.addValidators(0, 10, publicKeys, signatures); + vm.startPrank(operator); + stakingContract.addValidators(OPERATOR_INDEX, 10, PUBLIC_KEYS, SIGNATURES); vm.stopPrank(); } { vm.startPrank(admin); - stakingContract.setOperatorLimit(0, 10, block.number); + stakingContract.setOperatorLimit(OPERATOR_INDEX, 10, block.number); vm.stopPrank(); } @@ -2121,28 +1992,27 @@ contract StakingContractBehindProxyTest is Test { event Deposit(address indexed caller, address indexed withdrawer, bytes publicKey, bytes signature); event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index); - function testExplicitDepositOneValidatorCheckDepositEvent(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function assumeAddress(address user) public view { + vm.assume(user != proxyAdmin && user != address(depositContract)); + } + + function testExplicitDepositOneValidatorCheckDepositEvent(address user) public { + assumeAddress(user); vm.deal(user, 32 ether); vm.startPrank(user); bytes memory expectedWithdrawalCredentials = abi.encodePacked( bytes32( - uint256( - uint160( - stakingContract.getCLFeeRecipient( - hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759" - ) - ) - ) + 0x0100000000000000000000000000000000000000000000000000000000000000 + uint256(uint160(stakingContract.getCLFeeRecipient(PUBKEY_1))) + + 0x0100000000000000000000000000000000000000000000000000000000000000 ) ); vm.expectEmit(true, true, true, true); emit DepositEvent( - hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759", + PUBKEY_1, expectedWithdrawalCredentials, hex"0040597307000000", - hex"ccb81f4485957f440bc17dbe760f374cbb112c6f12fa10e8709fac4522b30440d918c7bb867fa04f6b3cfbd977455f8f2fde586fdf3d7baa429e98e497ff871f3b8db1528b2b964fa24d26e377c74746496cc719c50dbf391fb3f74f5ca4b93a", + SIGNATURE_1, hex"0000000000000000" ); stakingContract.deposit{value: 32 ether}(); @@ -2151,7 +2021,7 @@ contract StakingContractBehindProxyTest is Test { assertEq(user.balance, 0); (, , uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 1); @@ -2159,8 +2029,8 @@ contract StakingContractBehindProxyTest is Test { assert(deactivated == false); } - function testExplicitDepositOneValidator(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositOneValidator(address user) public { + assumeAddress(user); vm.deal(user, 32 ether); vm.startPrank(user); @@ -2170,7 +2040,7 @@ contract StakingContractBehindProxyTest is Test { assertEq(user.balance, 0); (, , uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 1); @@ -2179,7 +2049,7 @@ contract StakingContractBehindProxyTest is Test { } function test_deposit_withsanctions_senderSanctioned(address user) public { - vm.assume(user != proxyAdmin); + assumeAddress(user); oracle.setSanction(user, true); vm.prank(admin); @@ -2194,7 +2064,7 @@ contract StakingContractBehindProxyTest is Test { } function test_deposit_withSanctions_SenderClear(address user) public { - vm.assume(user != proxyAdmin); + assumeAddress(user); vm.prank(admin); stakingContract.setSanctionsOracle(address(oracle)); @@ -2204,10 +2074,11 @@ contract StakingContractBehindProxyTest is Test { vm.startPrank(user); stakingContract.deposit{value: 32 ether}(); vm.stopPrank(); + assertEq(user, stakingContract.getWithdrawer(PUBKEY_1)); } function test_deposit_BlockedUser(address user) public { - vm.assume(user != proxyAdmin); + assumeAddress(user); vm.prank(admin); stakingContract.blockAccount(user, ""); @@ -2220,18 +2091,14 @@ contract StakingContractBehindProxyTest is Test { vm.stopPrank(); } - function testExplicitDepositTwoValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositTwoValidators(address user) public { + assumeAddress(user); + vm.deal(user, 32 * 2 ether); vm.startPrank(user); vm.expectEmit(true, true, true, true); - emit Deposit( - user, - user, - hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060", - hex"02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966" - ); + emit Deposit(user, user, PUBKEY_2, SIGNATURE_2); stakingContract.deposit{value: 32 * 2 ether}(); vm.stopPrank(); @@ -2245,9 +2112,9 @@ contract StakingContractBehindProxyTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 2); @@ -2255,8 +2122,9 @@ contract StakingContractBehindProxyTest is Test { assert(deactivated == false); } - function testExplicitDepositAllValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositAllValidators(address user) public { + assumeAddress(user); + vm.deal(user, 32 * 10 ether); vm.startPrank(user); @@ -2273,9 +2141,9 @@ contract StakingContractBehindProxyTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 10); @@ -2283,8 +2151,9 @@ contract StakingContractBehindProxyTest is Test { assert(deactivated == false); } - function testExplicitDepositNotEnough(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositNotEnough(address user) public { + assumeAddress(user); + vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -2293,8 +2162,9 @@ contract StakingContractBehindProxyTest is Test { vm.stopPrank(); } - function testExplicitDepositNotEnoughAfterFilled(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositNotEnoughAfterFilled(address user) public { + assumeAddress(user); + vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -2306,8 +2176,9 @@ contract StakingContractBehindProxyTest is Test { vm.stopPrank(); } - function testExplicitDepositInvalidAmount(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testExplicitDepositInvalidAmount(address user) public { + assumeAddress(user); + vm.deal(user, 31.9 ether); vm.startPrank(user); @@ -2316,8 +2187,9 @@ contract StakingContractBehindProxyTest is Test { vm.stopPrank(); } - function testImplicitDepositOneValidator(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositOneValidator(address user) public { + assumeAddress(user); + vm.deal(user, 32 ether); vm.startPrank(user); @@ -2328,7 +2200,7 @@ contract StakingContractBehindProxyTest is Test { assertEq(user.balance, 0); (, , uint256 limit, uint256 keys, uint256 funded, uint256 available, bool deactivated) = stakingContract - .getOperator(0); + .getOperator(OPERATOR_INDEX); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 1); @@ -2336,18 +2208,14 @@ contract StakingContractBehindProxyTest is Test { assert(deactivated == false); } - function testImplicitDepositTwoValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositTwoValidators(address user) public { + assumeAddress(user); + vm.deal(user, 32 * 2 ether); vm.startPrank(user); vm.expectEmit(true, true, true, true); - emit Deposit( - user, - user, - hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060", - hex"02a9f0007cd7b7d2af2d1b07c8600ab86a5d27dc51a29c2e3007c7a69cb73bcaecc764641e02370955dba100428d259d6475ee3566872bd43b0e73e55b9669e50f2b1666e57b326a5dfad655c7921e0dfb421b1ec59c8fdb48eb77421fd06966" - ); + emit Deposit(user, user, PUBKEY_2, SIGNATURE_2); (bool _success, ) = address(stakingContract).call{value: 32 * 2 ether}(""); assert(_success == true); vm.stopPrank(); @@ -2362,9 +2230,9 @@ contract StakingContractBehindProxyTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 2); @@ -2372,8 +2240,9 @@ contract StakingContractBehindProxyTest is Test { assert(deactivated == false); } - function testImplicitDepositAllValidators(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositAllValidators(address user) public { + assumeAddress(user); + vm.deal(user, 32 * 10 ether); vm.startPrank(user); @@ -2391,9 +2260,9 @@ contract StakingContractBehindProxyTest is Test { uint256 funded, uint256 available, bool deactivated - ) = stakingContract.getOperator(0); - assertEq(operatorAddress, operatorOne); - assertEq(feeRecipientAddress, feeRecipientOne); + ) = stakingContract.getOperator(OPERATOR_INDEX); + assertEq(operatorAddress, operator); + assertEq(feeRecipientAddress, feeRecipient); assertEq(limit, 10); assertEq(keys, 10); assertEq(funded, 10); @@ -2401,8 +2270,8 @@ contract StakingContractBehindProxyTest is Test { assert(deactivated == false); } - function testImplicitDepositNotEnough(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositNotEnough(address user) public { + assumeAddress(user); vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -2412,8 +2281,8 @@ contract StakingContractBehindProxyTest is Test { vm.stopPrank(); } - function testImplicitDepositNotEnoughAfterFilled(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositNotEnoughAfterFilled(address user) public { + assumeAddress(user); vm.deal(user, 32 * 11 ether); vm.startPrank(user); @@ -2427,8 +2296,9 @@ contract StakingContractBehindProxyTest is Test { vm.stopPrank(); } - function testImplicitDepositInvalidAmount(uint256 _userSalt) public { - address user = uf._new(_userSalt); + function testImplicitDepositInvalidAmount(address user) public { + assumeAddress(user); + vm.deal(user, 31.9 ether); vm.startPrank(user); @@ -2455,106 +2325,90 @@ contract StakingContractBehindProxyTest is Test { } function testFeeRecipients() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); - address _elfr = stakingContract.getELFeeRecipient(publicKey); - address _clfr = stakingContract.getCLFeeRecipient(publicKey); + address _elfr = stakingContract.getELFeeRecipient(PUBKEY_1); + address _clfr = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(_elfr != _clfr); } function testWithdrawELFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); - stakingContract.withdrawELFee(publicKey); + stakingContract.withdrawELFee(PUBKEY_1); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.02 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.02 ether); assert(address(treasury).balance == 0.08 ether); } function testBatchWithdrawELFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); vm.prank(bob); stakingContract.batchWithdrawELFee(publicKeys); assert(bob.balance == 1.8 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.04 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.04 ether); assert(address(treasury).balance == 0.16 ether); } function testBatchWithdrawELFees_asAdmin() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); vm.prank(admin); stakingContract.batchWithdrawELFee(publicKeys); assert(bob.balance == 1.8 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.04 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.04 ether); assert(address(treasury).balance == 0.16 ether); } function testBatchWithdrawELFees_WrongWithdrawerSecondKey() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 32 ether); address bob2 = makeAddr("bob2"); vm.deal(bob2, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.prank(bob2); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob2); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); vm.expectRevert(abi.encodeWithSignature("InvalidWithdrawer()")); @@ -2563,20 +2417,16 @@ contract StakingContractBehindProxyTest is Test { } function testBatchWithdrawELFees_WrongPublicKeys() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); publicKeys = BytesLib.concat(publicKeys, hex"66"); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); @@ -2589,299 +2439,271 @@ contract StakingContractBehindProxyTest is Test { vm.startPrank(admin); stakingContract.setOperatorFee(5000); vm.stopPrank(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); - stakingContract.withdrawELFee(publicKey); + stakingContract.withdrawELFee(PUBKEY_1); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.05 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.05 ether); assert(address(treasury).balance == 0.05 ether); } function testWithdrawELFeesAlreadyDeployed() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); assert(elfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); - stakingContract.withdrawELFee(publicKey); + stakingContract.withdrawELFee(PUBKEY_1); assert(elfrBob.code.length != 0); assert(bob.balance == 0.9 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.02 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.02 ether); assert(address(treasury).balance == 0.08 ether); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); - stakingContract.withdrawELFee(publicKey); + stakingContract.withdrawELFee(PUBKEY_1); assert(bob.balance == 1.8 ether); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0.04 ether); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0.04 ether); assert(address(treasury).balance == 0.16 ether); } function testWithdrawELFeesEmptyWithdrawal() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.expectRevert(abi.encodeWithSignature("ZeroBalanceWithdrawal()")); vm.prank(bob); - stakingContract.withdrawELFee(publicKey); + stakingContract.withdrawELFee(PUBKEY_1); } function testWithdrawCLFeesExitedValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assert(address(treasury).balance == 0 ether); - assert(feeRecipientOne.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 33 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 32.90 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**5); } function testWithdrawCLFeesExitedValidator_RewardsAfterRequest() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assert(address(treasury).balance == 0 ether); - assert(feeRecipientOne.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 34 ether); // skimming + exit + rewards earned since last skimming vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 33.80 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**5); } function testWithdrawCLFeesExitedValidator_UserTriesToStealFee() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assert(address(treasury).balance == 0 ether); - assert(feeRecipientOne.balance == 0); + assert(feeRecipient.balance == 0); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 2 ether); // skimming happens between request & actual exit vm.deal(address(clfrBob), 32 ether); // withdrawer send 30 ETH to the fee recipient, using a self destructing contract vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assertEq(bob.balance, 32 ether); // no fee was paid on the last withdraw, it was treated as an exiting validator vm.deal(address(clfrBob), 32 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); // The user tried to scam the commission, as a consequence the fee is applied to their principal + stakingContract.withdrawCLFee(PUBKEY_1); // The user tried to scam the commission, as a consequence the fee is applied to their principal assert(clfrBob.code.length != 0); assertEq(bob.balance, 60.8 ether); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertEq(address(treasury).balance, 2.56 ether); - assertEq(feeRecipientOne.balance, 0.64 ether); + assertEq(feeRecipient.balance, 0.64 ether); } function testWithdrawCLFeesEditedOperatorFee() public { vm.startPrank(admin); stakingContract.setOperatorFee(5000); vm.stopPrank(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 33 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 32.90 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.05 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.05 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.05 ether, 10**5); } function testWithdrawCLFeesSkimmedValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 0.90 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**5); } function testWithdrawCLFeesSkimmedValidator_asAdmin() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(admin); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 0.90 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**5); } function testWithdrawCLFeesSkimmedValidator_asRandom() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.expectRevert(abi.encodeWithSignature("InvalidWithdrawer()")); vm.prank(address(0xdede)); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); } function testBatchWithdrawCLFees_asAdmin() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); vm.prank(admin); stakingContract.batchWithdrawCLFee(publicKeys); assertApproxEqAbs(bob.balance, 1.8 ether, 10**6); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**5); } function testBatchWithdrawCLFees_WrongSecondWithdrawer() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 32 ether); address bob2 = makeAddr("bob2"); vm.deal(bob2, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.prank(bob2); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob2); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); vm.expectRevert(abi.encodeWithSignature("InvalidWithdrawer()")); @@ -2890,45 +2712,37 @@ contract StakingContractBehindProxyTest is Test { } function testBatchWithdrawCLFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); vm.prank(bob); stakingContract.batchWithdrawCLFee(publicKeys); assertApproxEqAbs(bob.balance, 1.8 ether, 10**6); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**5); } function testBatchWithdrawCLFees_WrongPublicKeys() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); publicKeys = BytesLib.concat(publicKeys, hex"66"); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); @@ -2938,136 +2752,126 @@ contract StakingContractBehindProxyTest is Test { } function testWithdrawCLFeesSlashedValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); // Validator accumulated ~1 ETH or rewards then get slashed for 1 ETH + exit drain // Less than 32 ETH land on the fee recipient vm.deal(address(clfrBob), 31.95 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); // In this case the user will the be manually rebated and covered by insurance assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 28.755 ether, 10**6); - assertEq(operatorOne.balance, 0); + assertEq(operator.balance, 0); } function testWithdrawCLFeesSlashedValidatorWithRewards() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 28.755 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); // In this case the user will the be manually rebated and covered by insurance assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 25.8795 ether, 10**6); - assertEq(operatorOne.balance, 0); + assertEq(operator.balance, 0); } function testWithdrawCLFeesAlreadyDeployed() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assert(clfrBob.code.length != 0); assertApproxEqAbs(bob.balance, 0.90 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.08 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.02 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.02 ether, 10**5); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 33 ether); vm.prank(bob); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); assertApproxEqAbs(bob.balance, 33.80 ether, 10**6); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**5); } function testWithdrawCLFeesEmptyWithdrawal() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.expectRevert(abi.encodeWithSignature("ZeroBalanceWithdrawal()")); - stakingContract.withdrawCLFee(publicKey); + stakingContract.withdrawCLFee(PUBKEY_1); vm.stopPrank(); assertEq(bob.balance, 0); assertEq(address(treasury).balance, 0); - assertEq(feeRecipientOne.balance, 0); + assertEq(feeRecipient.balance, 0); } function testWithdrawAllFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.deal(address(clfrBob), 1 ether); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); vm.deal(address(clfrBob), 33 ether); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); assert(elfrBob.code.length == 0); vm.deal(address(elfrBob), 1 ether); vm.prank(bob); - stakingContract.withdraw(publicKey); + stakingContract.withdraw(PUBKEY_1); assertApproxEqAbs(bob.balance, 33.80 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**5); } function test_withdraw_withSanctions_RecipientSanctioned() public { @@ -3075,8 +2879,6 @@ contract StakingContractBehindProxyTest is Test { vm.prank(admin); stakingContract.setSanctionsOracle(address(oracle)); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); vm.expectRevert(abi.encodeWithSignature("AddressSanctioned(address)", bob)); @@ -3085,143 +2887,127 @@ contract StakingContractBehindProxyTest is Test { } function testWithdrawAllFees_asAdmin() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); vm.deal(address(clfrBob), 1 ether); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); assert(elfrBob.code.length == 0); vm.deal(address(elfrBob), 1 ether); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.prank(admin); - stakingContract.withdraw(publicKey); + stakingContract.withdraw(PUBKEY_1); assertApproxEqAbs(bob.balance, 1.80 ether, 10**5); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.16 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.04 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.04 ether, 10**5); } function testWithdrawAllFees_asRandom() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); assert(clfrBob.code.length == 0); vm.deal(address(clfrBob), 33 ether); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); assert(elfrBob.code.length == 0); vm.deal(address(elfrBob), 1 ether); assert(bob.balance == 0); - assert(operatorOne.balance == 0); - assert(feeRecipientOne.balance == 0); + assert(operator.balance == 0); + assert(feeRecipient.balance == 0); assert(address(treasury).balance == 0); vm.expectRevert(abi.encodeWithSignature("InvalidWithdrawer()")); vm.prank(address(0xdede)); - stakingContract.withdraw(publicKey); + stakingContract.withdraw(PUBKEY_1); } function testBatchWithdrawAllFees() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.prank(bob); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); stakingContract.batchWithdraw(publicKeys); assertApproxEqAbs(bob.balance, 3.6 ether, 10**6); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.32 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.08 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.08 ether, 10**5); } function testBatchWithdrawAllFees_asAdmin() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.prank(admin); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); stakingContract.batchWithdraw(publicKeys); assertApproxEqAbs(bob.balance, 3.6 ether, 10**6); - assert(operatorOne.balance == 0); + assert(operator.balance == 0); assertApproxEqAbs(address(treasury).balance, 0.32 ether, 10**5); - assertApproxEqAbs(feeRecipientOne.balance, 0.08 ether, 10**5); + assertApproxEqAbs(feeRecipient.balance, 0.08 ether, 10**5); } function testBatchWithdrawAllFees_WrongWithdrawer() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 32 ether); address bob2 = makeAddr("bob2"); vm.deal(bob2, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.prank(bob2); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob2); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.prank(bob); vm.deal(address(clfrBob), 1 ether); vm.deal(address(clfrBob2), 1 ether); @@ -3230,24 +3016,20 @@ contract StakingContractBehindProxyTest is Test { } function testBatchWithdrawAllFees_WrongPublicKeys() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 64 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - address elfrBob = stakingContract.getELFeeRecipient(publicKey); - address elfrBob2 = stakingContract.getELFeeRecipient(publicKey2); + address elfrBob = stakingContract.getELFeeRecipient(PUBKEY_1); + address elfrBob2 = stakingContract.getELFeeRecipient(PUBKEY_2); vm.deal(address(elfrBob), 1 ether); vm.deal(address(elfrBob2), 1 ether); - address clfrBob = stakingContract.getCLFeeRecipient(publicKey); - address clfrBob2 = stakingContract.getCLFeeRecipient(publicKey2); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + address clfrBob = stakingContract.getCLFeeRecipient(PUBKEY_1); + address clfrBob2 = stakingContract.getCLFeeRecipient(PUBKEY_2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); publicKeys = BytesLib.concat(publicKeys, hex"66"); vm.prank(bob); vm.deal(address(clfrBob), 1 ether); @@ -3257,95 +3039,85 @@ contract StakingContractBehindProxyTest is Test { } function testBatchWithdrawELFees_10() public { - bytes - memory publicKeys_10 = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - assertEq(publicKeys_10.length, 480); + assertEq(PUBLIC_KEYS.length, 480); vm.deal(bob, 320 ether); vm.startPrank(bob); - for (uint256 i = 0; i < publicKeys_10.length; i += 48) { + for (uint256 i = 0; i < PUBLIC_KEYS.length; i += 48) { stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(BytesLib.slice(publicKeys_10, i, 48)) == bob); + assert(stakingContract.getWithdrawer(BytesLib.slice(PUBLIC_KEYS, i, 48)) == bob); } vm.stopPrank(); - for (uint256 i = 0; i < publicKeys_10.length; i += 48) { - address elfrBob = stakingContract.getELFeeRecipient(BytesLib.slice(publicKeys_10, i, 48)); + for (uint256 i = 0; i < PUBLIC_KEYS.length; i += 48) { + address elfrBob = stakingContract.getELFeeRecipient(BytesLib.slice(PUBLIC_KEYS, i, 48)); vm.deal(address(elfrBob), 1 ether); } vm.prank(bob); - stakingContract.batchWithdrawELFee(publicKeys_10); + stakingContract.batchWithdrawELFee(PUBLIC_KEYS); assertEq(bob.balance, 9 ether); - assertEq(operatorOne.balance, 0); - assertEq(feeRecipientOne.balance, 0.2 ether); + assertEq(operator.balance, 0); + assertEq(feeRecipient.balance, 0.2 ether); assertEq(address(treasury).balance, 0.8 ether); } function testBatchWithdrawCLFees_10() public { - bytes - memory publicKeys_10 = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - assertEq(publicKeys_10.length, 480); + assertEq(PUBLIC_KEYS.length, 480); vm.deal(bob, 320 ether); vm.startPrank(bob); - for (uint256 i = 0; i < publicKeys_10.length; i += 48) { + for (uint256 i = 0; i < PUBLIC_KEYS.length; i += 48) { stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(BytesLib.slice(publicKeys_10, i, 48)) == bob); + assert(stakingContract.getWithdrawer(BytesLib.slice(PUBLIC_KEYS, i, 48)) == bob); } vm.stopPrank(); - for (uint256 i = 0; i < publicKeys_10.length; i += 48) { - address clfrBob = stakingContract.getCLFeeRecipient(BytesLib.slice(publicKeys_10, i, 48)); + for (uint256 i = 0; i < PUBLIC_KEYS.length; i += 48) { + address clfrBob = stakingContract.getCLFeeRecipient(BytesLib.slice(PUBLIC_KEYS, i, 48)); vm.deal(address(clfrBob), 1 ether); } vm.prank(bob); - stakingContract.batchWithdrawCLFee(publicKeys_10); + stakingContract.batchWithdrawCLFee(PUBLIC_KEYS); assertApproxEqAbs(bob.balance, 9 ether, 10**7); - assertEq(operatorOne.balance, 0); + assertEq(operator.balance, 0); assertApproxEqAbs(address(treasury).balance, 0.8 ether, 10**6); - assertApproxEqAbs(feeRecipientOne.balance, 0.2 ether, 10**6); + assertApproxEqAbs(feeRecipient.balance, 0.2 ether, 10**6); } function testBatchWithdrawAllFees_10() public { - bytes - memory publicKeys_10 = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e06014451b3fb9288549aff6dea9843b43e0c47a3b856f307732175230e254c0004e48b02414987088ac7003e148930017b49a1a8d4600f33d463c4afc07bbfc82703c9fcf81a5891f90a71c86a02faff443c6c3b2592bd44d5d3d7a93cb4aaaa105612496d61e68140a5418b468f872bf2f3e79f9cb0d9c3e889663fca02939b31e8ee3092203ee1417128e965c6406a07f68abf2ebe2689cf6c853ef126ffa8574c2a7d913e28de9147fa6b96706ea5bf9eacd1aba06edeaee155009fb912c00070774cc64136fcffde12ed731260bc5529df64da298f493561198e9d6acf42cf21e853ae7b2df85f27d2183149969d623b9237254c2cfe1d0082742eb042ac096d686dbe03c79ee31cbd03bb4682f8797043eed9f6e622814831ac5dfe1176552fb7f9b6ff38a149ae1d8414097a32fd96da6453c52fda13e3402a09e2fa6886daa4300f09c73e4bc2901b99c44744c5cfdca2994adc49ddccb195bda2510e50a4ae10de26cf96dee5e577689f51650a610a33da0a826ae47247d8d1189cb3386"; - assertEq(publicKeys_10.length, 480); + assertEq(PUBLIC_KEYS.length, 480); vm.deal(bob, 320 ether); vm.startPrank(bob); - for (uint256 i = 0; i < publicKeys_10.length; i += 48) { + for (uint256 i = 0; i < PUBLIC_KEYS.length; i += 48) { stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(BytesLib.slice(publicKeys_10, i, 48)) == bob); + assert(stakingContract.getWithdrawer(BytesLib.slice(PUBLIC_KEYS, i, 48)) == bob); } vm.stopPrank(); - for (uint256 i = 0; i < publicKeys_10.length; i += 48) { - address elfrBob = stakingContract.getELFeeRecipient(BytesLib.slice(publicKeys_10, i, 48)); + for (uint256 i = 0; i < PUBLIC_KEYS.length; i += 48) { + address elfrBob = stakingContract.getELFeeRecipient(BytesLib.slice(PUBLIC_KEYS, i, 48)); vm.deal(address(elfrBob), 1 ether); - address clfrBob = stakingContract.getCLFeeRecipient(BytesLib.slice(publicKeys_10, i, 48)); + address clfrBob = stakingContract.getCLFeeRecipient(BytesLib.slice(PUBLIC_KEYS, i, 48)); vm.deal(address(clfrBob), 1 ether); } vm.prank(bob); - stakingContract.batchWithdraw(publicKeys_10); + stakingContract.batchWithdraw(PUBLIC_KEYS); assertApproxEqAbs(bob.balance, 18 ether, 10**7); - assertEq(operatorOne.balance, 0); + assertEq(operator.balance, 0); assertApproxEqAbs(address(treasury).balance, 1.6 ether, 10**6); - assertApproxEqAbs(feeRecipientOne.balance, 0.4 ether, 10**6); + assertApproxEqAbs(feeRecipient.balance, 0.4 ether, 10**6); } function testRequestValidatorsExits_OneValidator() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.expectEmit(true, true, true, true); - emit ExitRequest(bob, publicKey); + emit ExitRequest(bob, PUBKEY_1); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); } function test_requestValidatorExits_OracleActive_OwnerSanctioned() public { vm.prank(admin); stakingContract.setSanctionsOracle(address(oracle)); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); @@ -3355,55 +3127,48 @@ contract StakingContractBehindProxyTest is Test { vm.expectRevert(abi.encodeWithSignature("AddressSanctioned(address)", bob)); vm.prank(bob); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); } function testRequestValidatorsExits_TwoValidators() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; + vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_2) == bob); vm.stopPrank(); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.expectEmit(true, true, true, true); - emit ExitRequest(bob, publicKey); + emit ExitRequest(bob, PUBKEY_1); vm.expectEmit(true, true, true, true); - emit ExitRequest(bob, publicKey2); + emit ExitRequest(bob, PUBKEY_2); vm.prank(bob); stakingContract.requestValidatorsExit(publicKeys); } function testRequestValidatorsExits_WrongWithdrawer() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); vm.prank(address(1337)); - stakingContract.requestValidatorsExit(publicKey); + stakingContract.requestValidatorsExit(PUBKEY_1); } function testRequestValidatorsExits_WrongPublicKeys() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; vm.deal(bob, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.expectRevert(abi.encodeWithSignature("InvalidPublicKeys()")); vm.prank(bob); @@ -3413,22 +3178,18 @@ contract StakingContractBehindProxyTest is Test { } function testRequestValidatorsExits_WrongSecondWithdrawer() public { - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory publicKey2 = hex"b0ce3fa164aae897adca509ed44429e7b1f91b7c46ddbe199cee848e09b1ccbb9736b78b68aacff1011b7266fe11e060"; vm.deal(bob, 32 ether); vm.deal(alice, 32 ether); vm.startPrank(bob); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey) == bob); + assert(stakingContract.getWithdrawer(PUBKEY_1) == bob); vm.stopPrank(); vm.startPrank(alice); stakingContract.deposit{value: 32 ether}(); - assert(stakingContract.getWithdrawer(publicKey2) == alice); + assert(stakingContract.getWithdrawer(PUBKEY_2) == alice); vm.stopPrank(); - bytes memory publicKeys = BytesLib.concat(publicKey, publicKey2); + bytes memory publicKeys = BytesLib.concat(PUBKEY_1, PUBKEY_2); vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); vm.prank(bob); @@ -3441,7 +3202,7 @@ contract StakingContractBehindProxyTest is Test { vm.deal(bob, 32 ether); - (bool isBlocked, bool isSanctioned) = stakingContract.isBlockedOrSanctioned(bob); + (bool isBlocked, ) = stakingContract.isBlockedOrSanctioned(bob); assertTrue(isBlocked); @@ -3454,7 +3215,7 @@ contract StakingContractBehindProxyTest is Test { vm.prank(admin); stakingContract.blockAccount(bob, ""); - (bool isBlocked, bool isSanctioned) = stakingContract.isBlockedOrSanctioned(bob); + (bool isBlocked, ) = stakingContract.isBlockedOrSanctioned(bob); assertTrue(isBlocked); @@ -3476,19 +3237,16 @@ contract StakingContractBehindProxyTest is Test { vm.prank(bob); stakingContract.deposit{value: 32 ether}(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - vm.expectEmit(true, true, true, true); - emit ExitRequest(bob, publicKey); + emit ExitRequest(bob, PUBKEY_1); vm.prank(admin); - stakingContract.blockAccount(bob, publicKey); + stakingContract.blockAccount(bob, PUBKEY_1); - (bool isBlocked, bool isSanctioned) = stakingContract.isBlockedOrSanctioned(bob); + (bool isBlocked, ) = stakingContract.isBlockedOrSanctioned(bob); assertTrue(isBlocked); - assertTrue(stakingContract.getExitRequestedFromRoot(getPubkeyRoot(publicKey))); + assertTrue(stakingContract.getExitRequestedFromRoot(getPubkeyRoot(PUBKEY_1))); } function test_block_UserDepositOneValidator_Sanctioned() public { @@ -3500,18 +3258,16 @@ contract StakingContractBehindProxyTest is Test { vm.prank(bob); stakingContract.deposit{value: 32 ether}(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; oracle.setSanction(bob, true); vm.prank(admin); - stakingContract.blockAccount(bob, publicKey); + stakingContract.blockAccount(bob, PUBKEY_1); - (bool isBlocked, bool isSanctioned) = stakingContract.isBlockedOrSanctioned(bob); + (bool isBlocked, ) = stakingContract.isBlockedOrSanctioned(bob); assertTrue(isBlocked); - assertFalse(stakingContract.getExitRequestedFromRoot(getPubkeyRoot(publicKey))); + assertFalse(stakingContract.getExitRequestedFromRoot(getPubkeyRoot(PUBKEY_1))); } function test_block_UserDepositOneValidator_NotSanctioned_WrongPublicKey() public { @@ -3523,14 +3279,9 @@ contract StakingContractBehindProxyTest is Test { vm.prank(bob); stakingContract.deposit{value: 32 ether}(); - bytes - memory publicKey = hex"21d2e725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - bytes - memory wrongPublicKey = hex"ffffe725aef3a8f9e09d8f4034948bb7f79505fc7c40e7a7ca15734bad4220a594bf0c6257cef7db88d9fc3fd4360759"; - vm.expectRevert(abi.encodeWithSignature("Unauthorized()")); vm.prank(admin); - stakingContract.blockAccount(bob, wrongPublicKey); + stakingContract.blockAccount(bob, PUBKEY_2); } } diff --git a/src/test/UserFactory.sol b/src/test/UserFactory.sol deleted file mode 100644 index 26a3106..0000000 --- a/src/test/UserFactory.sol +++ /dev/null @@ -1,13 +0,0 @@ -//SPDX-License-Identifier: BUSL-1.1 -pragma solidity >=0.8.10; - -contract User {} - -contract UserFactory { - uint256 internal counter; - - function _new(uint256 _salt) external returns (address user) { - user = address(new User{salt: bytes32(keccak256(abi.encodePacked(_salt, counter)))}()); - ++counter; - } -} diff --git a/src/test/console.sol b/src/test/console.sol deleted file mode 100644 index feb58e0..0000000 --- a/src/test/console.sol +++ /dev/null @@ -1,3067 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity >=0.8.10; - -library console { - address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67); - - function _sendLogPayload(bytes memory payload) private view { - uint256 payloadLength = payload.length; - address consoleAddress = CONSOLE_ADDRESS; - assembly { - let payloadStart := add(payload, 32) - let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0) - } - } - - function log() internal view { - _sendLogPayload(abi.encodeWithSignature("log()")); - } - - function logInt(int256 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(int)", p0)); - } - - function logUint(uint256 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); - } - - function logString(string memory p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); - } - - function logBool(bool p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); - } - - function logAddress(address p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); - } - - function logBytes(bytes memory p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0)); - } - - function logBytes1(bytes1 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0)); - } - - function logBytes2(bytes2 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0)); - } - - function logBytes3(bytes3 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0)); - } - - function logBytes4(bytes4 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0)); - } - - function logBytes5(bytes5 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0)); - } - - function logBytes6(bytes6 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0)); - } - - function logBytes7(bytes7 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0)); - } - - function logBytes8(bytes8 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0)); - } - - function logBytes9(bytes9 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0)); - } - - function logBytes10(bytes10 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0)); - } - - function logBytes11(bytes11 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0)); - } - - function logBytes12(bytes12 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0)); - } - - function logBytes13(bytes13 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0)); - } - - function logBytes14(bytes14 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0)); - } - - function logBytes15(bytes15 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0)); - } - - function logBytes16(bytes16 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0)); - } - - function logBytes17(bytes17 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0)); - } - - function logBytes18(bytes18 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0)); - } - - function logBytes19(bytes19 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0)); - } - - function logBytes20(bytes20 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0)); - } - - function logBytes21(bytes21 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0)); - } - - function logBytes22(bytes22 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0)); - } - - function logBytes23(bytes23 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0)); - } - - function logBytes24(bytes24 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0)); - } - - function logBytes25(bytes25 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0)); - } - - function logBytes26(bytes26 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0)); - } - - function logBytes27(bytes27 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0)); - } - - function logBytes28(bytes28 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0)); - } - - function logBytes29(bytes29 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0)); - } - - function logBytes30(bytes30 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0)); - } - - function logBytes31(bytes31 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0)); - } - - function logBytes32(bytes32 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0)); - } - - function log(uint256 p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint)", p0)); - } - - function log(string memory p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string)", p0)); - } - - function log(bool p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool)", p0)); - } - - function log(address p0) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address)", p0)); - } - - function log(uint256 p0, uint256 p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1)); - } - - function log(uint256 p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1)); - } - - function log(uint256 p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1)); - } - - function log(uint256 p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1)); - } - - function log(string memory p0, uint256 p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1)); - } - - function log(string memory p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1)); - } - - function log(string memory p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1)); - } - - function log(string memory p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1)); - } - - function log(bool p0, uint256 p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1)); - } - - function log(bool p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1)); - } - - function log(bool p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1)); - } - - function log(bool p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1)); - } - - function log(address p0, uint256 p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1)); - } - - function log(address p0, string memory p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1)); - } - - function log(address p0, bool p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1)); - } - - function log(address p0, address p1) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1)); - } - - function log( - uint256 p0, - uint256 p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2)); - } - - function log( - uint256 p0, - uint256 p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2)); - } - - function log( - uint256 p0, - uint256 p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2)); - } - - function log( - uint256 p0, - uint256 p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2)); - } - - function log( - uint256 p0, - string memory p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2)); - } - - function log( - uint256 p0, - string memory p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2)); - } - - function log( - uint256 p0, - string memory p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2)); - } - - function log( - uint256 p0, - string memory p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2)); - } - - function log( - uint256 p0, - bool p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2)); - } - - function log( - uint256 p0, - bool p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2)); - } - - function log( - uint256 p0, - bool p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2)); - } - - function log( - uint256 p0, - bool p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2)); - } - - function log( - uint256 p0, - address p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2)); - } - - function log( - uint256 p0, - address p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2)); - } - - function log( - uint256 p0, - address p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2)); - } - - function log( - uint256 p0, - address p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2)); - } - - function log( - string memory p0, - uint256 p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2)); - } - - function log( - string memory p0, - uint256 p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2)); - } - - function log( - string memory p0, - uint256 p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2)); - } - - function log( - string memory p0, - uint256 p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2)); - } - - function log( - string memory p0, - string memory p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2)); - } - - function log( - string memory p0, - string memory p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2)); - } - - function log( - string memory p0, - string memory p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2)); - } - - function log( - string memory p0, - string memory p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2)); - } - - function log( - string memory p0, - bool p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2)); - } - - function log( - string memory p0, - bool p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2)); - } - - function log( - string memory p0, - bool p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2)); - } - - function log( - string memory p0, - bool p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2)); - } - - function log( - string memory p0, - address p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2)); - } - - function log( - string memory p0, - address p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2)); - } - - function log( - string memory p0, - address p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2)); - } - - function log( - string memory p0, - address p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2)); - } - - function log( - bool p0, - uint256 p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2)); - } - - function log( - bool p0, - uint256 p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2)); - } - - function log( - bool p0, - uint256 p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2)); - } - - function log( - bool p0, - uint256 p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2)); - } - - function log( - bool p0, - string memory p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2)); - } - - function log( - bool p0, - string memory p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2)); - } - - function log( - bool p0, - string memory p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2)); - } - - function log( - bool p0, - string memory p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2)); - } - - function log( - bool p0, - bool p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2)); - } - - function log( - bool p0, - bool p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2)); - } - - function log( - bool p0, - bool p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2)); - } - - function log( - bool p0, - bool p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2)); - } - - function log( - bool p0, - address p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2)); - } - - function log( - bool p0, - address p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2)); - } - - function log( - bool p0, - address p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2)); - } - - function log( - bool p0, - address p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2)); - } - - function log( - address p0, - uint256 p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2)); - } - - function log( - address p0, - uint256 p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2)); - } - - function log( - address p0, - uint256 p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2)); - } - - function log( - address p0, - uint256 p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2)); - } - - function log( - address p0, - string memory p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2)); - } - - function log( - address p0, - string memory p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2)); - } - - function log( - address p0, - string memory p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2)); - } - - function log( - address p0, - string memory p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2)); - } - - function log( - address p0, - bool p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2)); - } - - function log( - address p0, - bool p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2)); - } - - function log( - address p0, - bool p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2)); - } - - function log( - address p0, - bool p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2)); - } - - function log( - address p0, - address p1, - uint256 p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2)); - } - - function log( - address p0, - address p1, - string memory p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2)); - } - - function log( - address p0, - address p1, - bool p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2)); - } - - function log( - address p0, - address p1, - address p2 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2)); - } - - function log( - uint256 p0, - uint256 p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - uint256 p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - string memory p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - bool p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3)); - } - - function log( - uint256 p0, - address p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - uint256 p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - string memory p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - bool p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3)); - } - - function log( - string memory p0, - address p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - uint256 p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - string memory p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - bool p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3)); - } - - function log( - bool p0, - address p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - uint256 p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - string memory p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - bool p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - uint256 p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - uint256 p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - uint256 p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - uint256 p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - string memory p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - string memory p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - string memory p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - string memory p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - bool p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - bool p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - bool p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - bool p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - address p2, - uint256 p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - address p2, - string memory p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - address p2, - bool p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3)); - } - - function log( - address p0, - address p1, - address p2, - address p3 - ) internal view { - _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3)); - } -}