From 842737ec9aa8ad3f4d68c6dafe1aabad64e802bd Mon Sep 17 00:00:00 2001 From: kachapah <60323455+Sidu28@users.noreply.github.com> Date: Thu, 1 Feb 2024 12:54:31 -0800 Subject: [PATCH] Deneb Mainnet Patch (#395) * init commit * updated testFullWithdrawalFlow to deneb spec * added two proof paths * added both capella and deneb testS * added testFullWithdrawalFlowCapellaWithdrawalAgainstDenebRoot * added event * fixed storage gap * uncommented testsg * fix: remove line * fixed tesst * added a setter in the EPM for deneForkTimetamp * tests still broken * cleanup * added modifier * fixing tests * tests working * added tests * comments * fixed failing test * fix flaky test * removed modifier --------- Co-authored-by: gpsanant --- src/contracts/interfaces/IEigenPodManager.sol | 16 ++ src/contracts/libraries/BeaconChainProofs.sol | 13 +- src/contracts/pods/EigenPod.sol | 3 +- src/contracts/pods/EigenPodManager.sol | 22 +++ src/contracts/pods/EigenPodManagerStorage.sol | 4 +- src/test/EigenPod.t.sol | 53 +++++- src/test/events/IEigenPodManagerEvents.sol | 4 + .../integration/IntegrationDeployer.t.sol | 5 + .../integration/mocks/BeaconChainMock.t.sol | 21 ++- src/test/mocks/EigenPodManagerMock.sol | 7 + ...fullWithdrawalCapellaAgainstDenebRoot.json | 160 +++++++++++++++++ src/test/test-data/fullWithdrawalDeneb.json | 162 ++++++++++++++++++ src/test/unit/EigenPod-PodManagerUnit.t.sol | 6 +- src/test/unit/EigenPodManagerUnit.t.sol | 41 +++++ src/test/unit/EigenPodUnit.t.sol | 14 +- src/test/utils/ProofParsing.sol | 36 +++- 16 files changed, 535 insertions(+), 32 deletions(-) create mode 100644 src/test/test-data/fullWithdrawalCapellaAgainstDenebRoot.json create mode 100644 src/test/test-data/fullWithdrawalDeneb.json diff --git a/src/contracts/interfaces/IEigenPodManager.sol b/src/contracts/interfaces/IEigenPodManager.sol index 9003c9ce4..020e0d2d9 100644 --- a/src/contracts/interfaces/IEigenPodManager.sol +++ b/src/contracts/interfaces/IEigenPodManager.sol @@ -42,6 +42,8 @@ interface IEigenPodManager is IPausable { bytes32 withdrawalRoot ); + event DenebForkTimestampUpdated(uint64 newValue); + /** * @notice Creates an EigenPod for the sender. * @dev Function will revert if the `msg.sender` already has an EigenPod. @@ -146,4 +148,18 @@ interface IEigenPodManager is IPausable { * @dev Reverts if `shares` is not a whole Gwei amount */ function withdrawSharesAsTokens(address podOwner, address destination, uint256 shares) external; + + /** + * @notice the deneb hard fork timestamp used to determine which proof path to use for proving a withdrawal + */ + function denebForkTimestamp() external view returns (uint64); + + /** + * setting the deneb hard fork timestamp by the eigenPodManager owner + * @dev this function is designed to be called twice. Once, it is set to type(uint64).max + * prior to the actual deneb fork timestamp being set, and then the second time it is set + * to the actual deneb fork timestamp. + */ + function setDenebForkTimestamp(uint64 newDenebForkTimestamp) external; + } diff --git a/src/contracts/libraries/BeaconChainProofs.sol b/src/contracts/libraries/BeaconChainProofs.sol index e488eedf8..da2d75cbc 100644 --- a/src/contracts/libraries/BeaconChainProofs.sol +++ b/src/contracts/libraries/BeaconChainProofs.sol @@ -27,7 +27,9 @@ library BeaconChainProofs { uint256 internal constant VALIDATOR_FIELD_TREE_HEIGHT = 3; uint256 internal constant NUM_EXECUTION_PAYLOAD_HEADER_FIELDS = 15; - uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT = 4; + //Note: changed in the deneb hard fork from 4->5 + uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB = 5; + uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA = 4; uint256 internal constant NUM_EXECUTION_PAYLOAD_FIELDS = 15; uint256 internal constant EXECUTION_PAYLOAD_FIELD_TREE_HEIGHT = 4; @@ -211,7 +213,8 @@ library BeaconChainProofs { function verifyWithdrawal( bytes32 beaconStateRoot, bytes32[] calldata withdrawalFields, - WithdrawalProof calldata withdrawalProof + WithdrawalProof calldata withdrawalProof, + uint64 denebForkTimestamp ) internal view { require( withdrawalFields.length == 2 ** WITHDRAWAL_FIELD_TREE_HEIGHT, @@ -232,9 +235,11 @@ library BeaconChainProofs { "BeaconChainProofs.verifyWithdrawal: historicalSummaryIndex is too large" ); + //Note: post deneb hard fork, the exection payload header fields increased, adding an extra level to the tree height + uint256 executionPayloadHeaderFieldTreeHeight = (getWithdrawalTimestamp(withdrawalProof) < denebForkTimestamp) ? EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA : EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB; require( withdrawalProof.withdrawalProof.length == - 32 * (EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT + WITHDRAWALS_TREE_HEIGHT + 1), + 32 * (executionPayloadHeaderFieldTreeHeight + WITHDRAWALS_TREE_HEIGHT + 1), "BeaconChainProofs.verifyWithdrawal: withdrawalProof has incorrect length" ); require( @@ -247,7 +252,7 @@ library BeaconChainProofs { "BeaconChainProofs.verifyWithdrawal: slotProof has incorrect length" ); require( - withdrawalProof.timestampProof.length == 32 * (EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT), + withdrawalProof.timestampProof.length == 32 * (executionPayloadHeaderFieldTreeHeight), "BeaconChainProofs.verifyWithdrawal: timestampProof has incorrect length" ); diff --git a/src/contracts/pods/EigenPod.sol b/src/contracts/pods/EigenPod.sol index 1a2e3cdbf..49ab3b0d0 100644 --- a/src/contracts/pods/EigenPod.sol +++ b/src/contracts/pods/EigenPod.sol @@ -607,7 +607,8 @@ contract EigenPod is IEigenPod, Initializable, ReentrancyGuardUpgradeable, Eigen BeaconChainProofs.verifyWithdrawal({ beaconStateRoot: beaconStateRoot, withdrawalFields: withdrawalFields, - withdrawalProof: withdrawalProof + withdrawalProof: withdrawalProof, + denebForkTimestamp: eigenPodManager.denebForkTimestamp() }); uint40 validatorIndex = withdrawalFields.getValidatorIndex(); diff --git a/src/contracts/pods/EigenPodManager.sol b/src/contracts/pods/EigenPodManager.sol index 419a1e36b..2bc882aea 100644 --- a/src/contracts/pods/EigenPodManager.sol +++ b/src/contracts/pods/EigenPodManager.sol @@ -241,6 +241,28 @@ contract EigenPodManager is _updateBeaconChainOracle(newBeaconChainOracle); } + /** + * @notice Sets the timestamp of the Deneb fork. + * @param newDenebForkTimestamp is the new timestamp of the Deneb fork + */ + function setDenebForkTimestamp(uint64 newDenebForkTimestamp) external onlyOwner { + + /** + * @notice Modifier to ensure that the deneb fork timestamp is not set + * @dev Note that this function is only ever meant to be called twice. First, it will be called to set the timestamp + * to type(uint64).max, and then it will be called to set the timestamp to the actual timestamp + */ + require(newDenebForkTimestamp != 0, "EigenPodManager.denebForkEnabled: cannot set newDenebForkTimestamp to 0"); + if(newDenebForkTimestamp == type(uint64).max){ + require(denebForkTimestamp == 0, "EigenPodManager.denebForkEnabled: denebForkTimestamp must not be set yet"); + } else { + require(denebForkTimestamp ==type(uint64).max, "EigenPodManager.denebForkEnabled: Deneb fork timestamp cannot be set"); + } + + denebForkTimestamp = newDenebForkTimestamp; + emit DenebForkTimestampUpdated(denebForkTimestamp); + } + // INTERNAL FUNCTIONS function _deployPod() internal returns (IEigenPod) { diff --git a/src/contracts/pods/EigenPodManagerStorage.sol b/src/contracts/pods/EigenPodManagerStorage.sol index b893a0816..c0dc29de9 100644 --- a/src/contracts/pods/EigenPodManagerStorage.sol +++ b/src/contracts/pods/EigenPodManagerStorage.sol @@ -64,6 +64,8 @@ abstract contract EigenPodManagerStorage is IEigenPodManager { */ mapping(address => int256) public podOwnerShares; + uint64 public denebForkTimestamp; + constructor( IETHPOSDeposit _ethPOS, IBeacon _eigenPodBeacon, @@ -83,5 +85,5 @@ abstract contract EigenPodManagerStorage is IEigenPodManager { * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ - uint256[45] private __gap; + uint256[44] private __gap; } diff --git a/src/test/EigenPod.t.sol b/src/test/EigenPod.t.sol index e68cd8109..5e3046dfb 100644 --- a/src/test/EigenPod.t.sol +++ b/src/test/EigenPod.t.sol @@ -15,6 +15,8 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { uint256 internal constant GWEI_TO_WEI = 1e9; + uint64 public constant DENEB_FORK_TIMESTAMP_GOERLI = 1705473120; + bytes pubkey = hex"88347ed1c492eedc97fc8c506a35d44d81f27a0c7a1c661b35913cfd15256c0cccbd34a83341f505c7de2983292f2cab"; @@ -24,6 +26,8 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { address podOwner = address(42000094993494); + bool public IS_DENEB; + Vm cheats = Vm(HEVM_ADDRESS); DelegationManager public delegation; IStrategyManager public strategyManager; @@ -255,6 +259,8 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { ) ); + eigenPodManager.setDenebForkTimestamp(type(uint64).max); + cheats.deal(address(podOwner), 5 * stakeAmount); fuzzedAddressMapping[address(0)] = true; @@ -502,6 +508,37 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { } /// @notice This test is to ensure the full withdrawal flow works + function testFullWithdrawalFlowDeneb() public returns (IEigenPod) { + eigenPodManager.setDenebForkTimestamp(DENEB_FORK_TIMESTAMP_GOERLI); + IS_DENEB = true; + //this call is to ensure that validator 302913 has proven their withdrawalcreds + // ./solidityProofGen -newBalance=32000115173 "ValidatorFieldsProof" 302913 true "data/withdrawal_proof_goerli/goerli_block_header_6399998.json" "data/withdrawal_proof_goerli/goerli_slot_6399998.json" "withdrawal_credential_proof_302913.json" + setJSON("./src/test/test-data/withdrawal_credential_proof_302913.json"); + _testDeployAndVerifyNewEigenPod(podOwner, signature, depositDataRoot); + IEigenPod newPod = eigenPodManager.getPod(podOwner); + + //Deneb: ./solidityProofGen/solidityProofGen "WithdrawalFieldsProof" 302913 271 8191 true false "data/deneb_goerli_block_header_7431952.json" "data/deneb_goerli_slot_7431952.json" "data/deneb_goerli_slot_7421952.json" "data/deneb_goerli_block_header_7421951.json" "data/deneb_goerli_block_7421951.json" "fullWithdrawalProof_Latest.json" false false + // To get block header: curl -H "Accept: application/json" 'https://eigenlayer.spiceai.io/goerli/beacon/eth/v1/beacon/headers/6399000?api_key\="343035|f6ebfef661524745abb4f1fd908a76e8"' > block_header_6399000.json + // To get block: curl -H "Accept: application/json" 'https://eigenlayer.spiceai.io/goerli/beacon/eth/v2/beacon/blocks/6399000?api_key\="343035|f6ebfef661524745abb4f1fd908a76e8"' > block_6399000.json + setJSON("./src/test/test-data/fullWithdrawalDeneb.json"); + return _proveWithdrawalForPod(newPod); + } + + function testFullWithdrawalFlowCapellaWithdrawalAgainstDenebRoot() public returns (IEigenPod) { + IS_DENEB = false; + //this call is to ensure that validator 302913 has proven their withdrawalcreds + // ./solidityProofGen/solidityProofGen "WithdrawalFieldsProof" 302913 146 8092 true false "data/deneb_goerli_block_header_7431952.json" "data/deneb_goerli_slot_7431952.json" "data/goerli_slot_6397952.json" "data/goerli_block_header_6397852.json" "data/goerli_block_6397852.json" "fullWithdrawalProof_CapellaAgainstDeneb.json" false true + setJSON("./src/test/test-data/withdrawal_credential_proof_302913.json"); + _testDeployAndVerifyNewEigenPod(podOwner, signature, depositDataRoot); + IEigenPod newPod = eigenPodManager.getPod(podOwner); + + //Deneb: ./solidityProofGen/solidityProofGen "WithdrawalFieldsProof" 302913 271 8191 true false "data/deneb_goerli_block_header_7431952.json" "data/deneb_goerli_slot_7431952.json" "data/deneb_goerli_slot_7421952.json" "data/deneb_goerli_block_header_7421951.json" "data/deneb_goerli_block_7421951.json" "fullWithdrawalProof_Latest.json" false + // To get block header: curl -H "Accept: application/json" 'https://eigenlayer.spiceai.io/goerli/beacon/eth/v1/beacon/headers/6399000?api_key\="343035|f6ebfef661524745abb4f1fd908a76e8"' > block_header_6399000.json + // To get block: curl -H "Accept: application/json" 'https://eigenlayer.spiceai.io/goerli/beacon/eth/v2/beacon/blocks/6399000?api_key\="343035|f6ebfef661524745abb4f1fd908a76e8"' > block_6399000.json + setJSON("./src/test/test-data/fullWithdrawalCapellaAgainstDenebRoot.json"); + return _proveWithdrawalForPod(newPod); + } + function testFullWithdrawalFlow() public returns (IEigenPod) { //this call is to ensure that validator 302913 has proven their withdrawalcreds // ./solidityProofGen -newBalance=32000115173 "ValidatorFieldsProof" 302913 true "data/withdrawal_proof_goerli/goerli_block_header_6399998.json" "data/withdrawal_proof_goerli/goerli_slot_6399998.json" "withdrawal_credential_proof_302913.json" @@ -835,7 +872,6 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { emit log("hello"); IEigenPod newPod = _testDeployAndVerifyNewEigenPod(podOwner, signature, depositDataRoot); - emit log("hello"); //./solidityProofGen "WithdrawalFieldsProof" 302913 146 8092 true false "data/withdrawal_proof_goerli/goerli_block_header_6399998.json" "data/withdrawal_proof_goerli/goerli_slot_6399998.json" "data/withdrawal_proof_goerli/goerli_slot_6397852.json" "data/withdrawal_proof_goerli/goerli_block_header_6397852.json" "data/withdrawal_proof_goerli/goerli_block_6397852.json" "fullWithdrawalProof_Latest.json" false // To get block header: curl -H "Accept: application/json" 'https://eigenlayer.spiceai.io/goerli/beacon/eth/v1/beacon/headers/6399000?api_key\="343035|f6ebfef661524745abb4f1fd908a76e8"' > block_header_6399000.json // To get block: curl -H "Accept: application/json" 'https://eigenlayer.spiceai.io/goerli/beacon/eth/v2/beacon/blocks/6399000?api_key\="343035|f6ebfef661524745abb4f1fd908a76e8"' > block_6399000.json @@ -1475,7 +1511,7 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { uint64 withdrawalAmountGwei = Endian.fromLittleEndianUint64( withdrawalFields[BeaconChainProofs.WITHDRAWAL_VALIDATOR_AMOUNT_INDEX] ); - + emit log_named_uint("withdrawalAmountGwei", withdrawalAmountGwei); uint64 leftOverBalanceWEI = uint64(withdrawalAmountGwei - newPod.MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR()) * uint64(GWEI_TO_WEI); cheats.deal(address(newPod), leftOverBalanceWEI); @@ -1727,18 +1763,22 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { eigenPodManager.stake{value: stakeAmount}(pubkey, signature, depositDataRoot); cheats.stopPrank(); + if(!IS_DENEB){ + emit log("NOT DENEB"); + } + bytes memory withdrawalProof = IS_DENEB ? abi.encodePacked(getWithdrawalProofDeneb()) : abi.encodePacked(getWithdrawalProofCapella()); + bytes memory timestampProof = IS_DENEB ? abi.encodePacked(getTimestampProofDeneb()) : abi.encodePacked(getTimestampProofCapella()); { bytes32 blockRoot = getBlockRoot(); bytes32 slotRoot = getSlotRoot(); bytes32 timestampRoot = getTimestampRoot(); bytes32 executionPayloadRoot = getExecutionPayloadRoot(); - return BeaconChainProofs.WithdrawalProof( - abi.encodePacked(getWithdrawalProof()), + abi.encodePacked(withdrawalProof), abi.encodePacked(getSlotProof()), abi.encodePacked(getExecutionPayloadProof()), - abi.encodePacked(getTimestampProof()), + abi.encodePacked(timestampProof), abi.encodePacked(getHistoricalSummaryProof()), uint64(getBlockRootIndex()), uint64(getHistoricalSummaryIndex()), @@ -1750,6 +1790,7 @@ contract EigenPodTests is ProofParsing, EigenPodPausingConstants { ); } } + function _setOracleBlockRoot() internal { bytes32 latestBlockRoot = getLatestBlockRoot(); @@ -1778,7 +1819,7 @@ contract Relayer is Test { bytes32[] calldata withdrawalFields, BeaconChainProofs.WithdrawalProof calldata proofs ) public view { - BeaconChainProofs.verifyWithdrawal(beaconStateRoot, withdrawalFields, proofs); + BeaconChainProofs.verifyWithdrawal(beaconStateRoot, withdrawalFields, proofs, type(uint64).max); } } diff --git a/src/test/events/IEigenPodManagerEvents.sol b/src/test/events/IEigenPodManagerEvents.sol index d56db0d09..2f9796684 100644 --- a/src/test/events/IEigenPodManagerEvents.sol +++ b/src/test/events/IEigenPodManagerEvents.sol @@ -5,6 +5,10 @@ interface IEigenPodManagerEvents { /// @notice Emitted to notify the update of the beaconChainOracle address event BeaconOracleUpdated(address indexed newOracleAddress); + /// @notice Emitted to notify that the denebForkTimestamp has been set + event DenebForkTimestampUpdated(uint64 denebForkTimestamp); + + /// @notice Emitted to notify the deployment of an EigenPod event PodDeployed(address indexed eigenPod, address indexed podOwner); diff --git a/src/test/integration/IntegrationDeployer.t.sol b/src/test/integration/IntegrationDeployer.t.sol index 3a0c86705..0687a7089 100644 --- a/src/test/integration/IntegrationDeployer.t.sol +++ b/src/test/integration/IntegrationDeployer.t.sol @@ -272,6 +272,11 @@ abstract contract IntegrationDeployer is Test, IUserDeployer { // Create mock beacon chain / proof gen interface beaconChain = new BeaconChainMock(timeMachine, beaconChainOracle); + + + + //set deneb fork timestamp + eigenPodManager.setDenebForkTimestamp(type(uint64).max); } /// @dev Deploy a strategy and its underlying token, push to global lists of tokens/strategies, and whitelist diff --git a/src/test/integration/mocks/BeaconChainMock.t.sol b/src/test/integration/mocks/BeaconChainMock.t.sol index b7a121a2f..c0f7b3770 100644 --- a/src/test/integration/mocks/BeaconChainMock.t.sol +++ b/src/test/integration/mocks/BeaconChainMock.t.sol @@ -694,10 +694,16 @@ contract BeaconChainMock is Test { (BeaconChainProofs.VALIDATOR_TREE_HEIGHT + 1) + BeaconChainProofs.BEACON_STATE_FIELD_TREE_HEIGHT ); - uint immutable WITHDRAWAL_PROOF_LEN = 32 * ( - BeaconChainProofs.EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT + + uint immutable WITHDRAWAL_PROOF_LEN_CAPELLA = 32 * ( + BeaconChainProofs.EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA + BeaconChainProofs.WITHDRAWALS_TREE_HEIGHT + 1 ); + + uint immutable WITHDRAWAL_PROOF_LEN_DENEB= 32 * ( + BeaconChainProofs.EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB + + BeaconChainProofs.WITHDRAWALS_TREE_HEIGHT + 1 + ); + uint immutable EXECPAYLOAD_PROOF_LEN = 32 * ( BeaconChainProofs.BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT + BeaconChainProofs.BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT @@ -705,8 +711,11 @@ contract BeaconChainMock is Test { uint immutable SLOT_PROOF_LEN = 32 * ( BeaconChainProofs.BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT ); - uint immutable TIMESTAMP_PROOF_LEN = 32 * ( - BeaconChainProofs.EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT + uint immutable TIMESTAMP_PROOF_LEN_CAPELLA = 32 * ( + BeaconChainProofs.EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA + ); + uint immutable TIMESTAMP_PROOF_LEN_DENEB = 32 * ( + BeaconChainProofs.EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB ); uint immutable HISTSUMMARY_PROOF_LEN = 32 * ( BeaconChainProofs.BEACON_STATE_FIELD_TREE_HEIGHT + @@ -725,10 +734,10 @@ contract BeaconChainMock is Test { uint64 oracleTimestamp ) internal view returns (BeaconChainProofs.WithdrawalProof memory) { return BeaconChainProofs.WithdrawalProof({ - withdrawalProof: new bytes(WITHDRAWAL_PROOF_LEN), + withdrawalProof: new bytes(WITHDRAWAL_PROOF_LEN_CAPELLA), slotProof: new bytes(SLOT_PROOF_LEN), executionPayloadProof: new bytes(EXECPAYLOAD_PROOF_LEN), - timestampProof: new bytes(TIMESTAMP_PROOF_LEN), + timestampProof: new bytes(TIMESTAMP_PROOF_LEN_CAPELLA), historicalSummaryBlockRootProof: new bytes(HISTSUMMARY_PROOF_LEN), blockRootIndex: 0, historicalSummaryIndex: 0, diff --git a/src/test/mocks/EigenPodManagerMock.sol b/src/test/mocks/EigenPodManagerMock.sol index f06730112..102763a7a 100644 --- a/src/test/mocks/EigenPodManagerMock.sol +++ b/src/test/mocks/EigenPodManagerMock.sol @@ -85,4 +85,11 @@ contract EigenPodManagerMock is IEigenPodManager, Test { function numPods() external view returns (uint256) {} function maxPods() external view returns (uint256) {} + + + function denebForkTimestamp() external view returns (uint64){ + return type(uint64).max; + } + + function setDenebForkTimestamp(uint64 timestamp) external{} } \ No newline at end of file diff --git a/src/test/test-data/fullWithdrawalCapellaAgainstDenebRoot.json b/src/test/test-data/fullWithdrawalCapellaAgainstDenebRoot.json new file mode 100644 index 000000000..6bd773af9 --- /dev/null +++ b/src/test/test-data/fullWithdrawalCapellaAgainstDenebRoot.json @@ -0,0 +1,160 @@ +{ + "slot": 6397852, + "validatorIndex": 302913, + "historicalSummaryIndex": 146, + "withdrawalIndex": 0, + "blockHeaderRootIndex": 8092, + "beaconStateRoot": "0x426cc7e4b6a9be3a44e671c99eb62f27dd956d5db33aa8f05d07c3e8b05cb38f", + "slotRoot": "0x9c9f610000000000000000000000000000000000000000000000000000000000", + "timestampRoot": "0xb06fed6400000000000000000000000000000000000000000000000000000000", + "blockHeaderRoot": "0x8b036996f94e940c80c5c692fd0e25467a5d55f1cf92b7808f92090fc7be1d17", + "blockBodyRoot": "0x542df356d51eb305cff8282abe6909504b8c6d7bd4598b43aa7d54be13e44e9c", + "executionPayloadRoot": "0xe628472355543b53917635e60c1f924f111f7a3cd58f2d947e8631b9d9924cb1", + "latestBlockHeaderRoot": "0xb00368eaa2de6ca1e83d610be190a397668215a337837e1ad23241373d1c2dd0", + "SlotProof": [ + "0x89c5010000000000000000000000000000000000000000000000000000000000", + "0xab4a015ca78ff722e478d047b19650dc6fc92a4270c6cd34401523d3d6a1d9f2", + "0xf4e65df697eb85f3ab176ac93b6ad4d96bd6b04bdddcc4f6c98f0fa94effc553" + ], + "WithdrawalProof": [ + "0xa3d843f57c18ee3dac0eb263e446fe5d0110059137807d3cae4a2e60ccca013f", + "0x87441da495942a4af734cbca4dbcf0b96b2d83137ce595c9f29495aae6a8d99e", + "0xae0dc609ecbfb26abc191227a76efb332aaea29725253756f2cad136ef5837a6", + "0x765bcd075991ecad96203020d1576fdb9b45b41dad3b5adde11263ab9f6f56b8", + "0x1000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x9d9b56c23faa6a8abf0a49105eb12bbdfdf198a9c6c616b8f24f6e91ad79de92", + "0xac5e32ea973e990d191039e91c7d9fd9830599b8208675f159c3df128228e729", + "0x38914949a92dc9e402aee96301b080f769f06d752a32acecaa0458cba66cf471" + ], + "ValidatorProof": [ + "0x9e06c3582190fe488eac3f9f6c95622742f9afe3e038b39d2ca97ba6d5d0de4e", + "0x3eb11a14af12d8558cc14493938ffa0a1c6155349699c2b9245e76344d9922ee", + "0x81c959aeae7524f4f1d2d3d930ba504cbe86330619a221c9e2d9fb315e32a4d1", + "0x9b9adf5d31a74f30ae86ce7f7a8bfe89d2bdf2bd799d0c6896174b4f15878bf1", + "0xdfe7aa4a49359b80e66fbdc8cbbf5d2014868aaf8dee25848f1b6494cb56231f", + "0xeec50554b6994496920a265643520c78ff05beec8015c6432f72b0cac5af510c", + "0x949da2d82acf86e064a7022c5d5e69528ad6d3dd5b9cdf7fb9b736f0d925fc38", + "0x9c797e45839da75fea2190bf7a2735e68d8e4bd3cdbc82498491debb3acce128", + "0x2c693b02fbff3f4f659bfb8414a9ba27bbfdc1baf65317f05a84a85552628bd6", + "0x6f853a43c11ab3ac27f5ea8dd9e6dc825216114dee8e5db2306b97723048daaa", + "0x620fe1c260fcea9fb7ca0b7cd64f88aa906c88a8efc136317d88483f8a99d5ae", + "0xccfc09edfaa6bb8f9a1db781f1104b3aeb2a45799c898df57f3610b9ffc255de", + "0x8c5a00d96b9eb727a5a4aec2fd6b9771cb0c5be3a8b5588aff54b2ee36792af2", + "0x48fc48699053f4bd8f986f4216e2728f11e0d53ebeaf13bc9d287d2e099e7196", + "0xac88ce300b12047d9131a651417b624f206b742080c28c347873a7706897b379", + "0xe373b48074ce47d30b57509e85e905e42e8dbc869bb7c436553326a7a65e22ec", + "0x358c6950cfb1fb035e1e2506bddf5a1dc1f87d699a464a7eb05b87ce699942ce", + "0x040e77e06c4d45802b2093e445e56a1ed5d5afbd1c3393806b006b7f40a17148", + "0xcfb3f924f2e8810a349041676060bbf55113cbc00270f778723dbac055c8ba2b", + "0xa4b4bda96e8ae5a441b128b339ed3776f6105d24fcaa288cad2a3153e430a9ea", + "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", + "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", + "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", + "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", + "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", + "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", + "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", + "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", + "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", + "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", + "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", + "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7", + "0xc6f67e02e6e4e1bdefb994c6098953f34636ba2b6ca20a4721d2b26a886722ff", + "0x1c9a7e5ff1cf48b4ad1582d3f4e4a1004f3b20d8c5a2b71387a4254ad933ebc5", + "0x2f075ae229646b6f6aed19a5e372cf295081401eb893ff599b3f9acc0c0d3e7d", + "0x328921deb59612076801e8cd61592107b5c67c79b846595cc6320c395b46362c", + "0xbfb909fdb236ad2411b4e4883810a074b840464689986c3f8a8091827e17c327", + "0x55d8fb3687ba3ba49f342c77f5a1f89bec83d811446e1a467139213d640b6a74", + "0xf7210d4f8e7e1039790e7bf4efa207555a10a6db1dd4b95da313aaa88b88fe76", + "0xad21b516cbc645ffe34ab5de1c8aef8cd4e7f8d2b51e8e1456adc7563cda206f", + "0x0b430a0000000000000000000000000000000000000000000000000000000000", + "0x3b4f070000000000000000000000000000000000000000000000000000000000", + "0x7e71eb9ab70a9ac86179e04cc156a3a6efd5d49e864b1def60d045fe88ae53db", + "0x042f04ac64635d44bd43c48c5504689a119901947ed7cfca6ce6f7171d29b696", + "0x560c8c92a1425b1c928f582f64de643e17290760d4ecb242afb53b62d51ea918", + "0xf426ceebf070d088972f46060f72b9fa35ebb90e8d18af341b698d359ab8366f" + ], + "TimestampProof": [ + "0x28a2c80000000000000000000000000000000000000000000000000000000000", + "0xa749df3368741198702798435eea361b1b1946aa9456587a2be377c8472ea2df", + "0xb1c03097a5a24f46cdb684df37e3ac0536a76428be1a6c6d6450378701ab1f3d", + "0x38914949a92dc9e402aee96301b080f769f06d752a32acecaa0458cba66cf471" + ], + "ExecutionPayloadProof": [ + "0xb6a435ffd17014d1dad214ba466aaa7fba5aa247945d2c29fd53e90d554f4474", + "0x336488033fe5f3ef4ccc12af07b9370b92e553e35ecb4a337a1b1c0e4afe1e0e", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0x5ec9aaf0a3571602f4704d4471b9af564caf17e4d22a7c31017293cb95949053", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", + "0xc1f7cb289e44e9f711d7d7c05b67b84b8c6dd0394b688922a490cfd3fe216db1" + ], + "ValidatorFields": [ + "0xe36689b7b39ee895a754ba878afac2aa5d83349143a8b23d371823dd9ed3435d", + "0x0100000000000000000000008e35f095545c56b07c942a4f3b055ef1ec4cb148", + "0x0040597307000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0xea65010000000000000000000000000000000000000000000000000000000000", + "0xf265010000000000000000000000000000000000000000000000000000000000", + "0xffffffffffffffff000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "WithdrawalFields": [ + "0x45cee50000000000000000000000000000000000000000000000000000000000", + "0x419f040000000000000000000000000000000000000000000000000000000000", + "0x59b0d71688da01057c08e4c1baa8faa629819c2a000000000000000000000000", + "0xe5015b7307000000000000000000000000000000000000000000000000000000" + ], + "StateRootAgainstLatestBlockHeaderProof": [ + "0xc055061b6674f3bac542b141b441b476130d17dacc3e61d6ce01a6b8528f7de7", + "0xfd8af94401badce5dd4588a22c605e197a51b17e696f761aed06819a98645f03", + "0xdeb9a60cdd0908457ff962da3895ffcf1a1e479b633e3427ac9b1166e006c8f7" + ], + "HistoricalSummaryProof": [ + "0x96d85b451bb1df5314fd3fd3fa4caa3285796905bc8bba6eee5e3e1539cf2695", + "0x354f5aaff1cde08c6b8a7ef8610abf62a0b50339d0dd26b0152699ebc2bdf785", + "0xb8c4c9f1dec537f4c4652e6bf519bac768e85b2590b7683e392aab698b50d529", + "0x1cae4e7facb6883024359eb1e9212d36e68a106a7733dc1c099017a74e5f465a", + "0x616439c1379e10fc6ad2fa192a2e49c2d5a7155fdde95911f37fcfb75952fcb2", + "0x9d95eefbaff153d6ad9050327e21a254750d80ff89315ab4056574275ce2a751", + "0x20cdc9ec1006e8bc27ab3e0a9c88a8e14c8a9da2470f8eaf673ee67abcfd0342", + "0x4bdcbe543f9ef7348855aac43d6b6286f9c0c7be53de8a1300bea1ba5ba0758e", + "0xb6631640d626ea9523ae619a42633072614326cc9220462dffdeb63e804ef05f", + "0xf19a76e33ca189a8682ece523c2afda138db575955b7af31a427c9b8adb41e15", + "0x221b43ad87d7410624842cad296fc48360b5bf4e835f6ff610db736774d2f2d3", + "0x297c51f4ff236db943bebeb35538e207c8de6330d26aa8138a9ca206f42154bf", + "0x129a0644f33b9ee4e9a36a11dd59d1dedc64012fbb7a79263d07f82d647ffba8", + "0x763794c2042b9c8381ac7c4d7f4d38b0abb38069b2810b522f87951f25d9d2be", + "0x4ee09be5d00612fc8807752842f0839656107b50699330ecf09825466576a8e5", + "0xee0639a2ada97368e8b3493f9d2141e16c3cd9fe54e13691bb7a2c376c56c7c8", + "0xc9394eeb778485920ae0bc45a6f0e5f1b43f3aeadc24b24e7a655582aa87aede", + "0xfc3f3efb849bf652aa632502c004af0f78dfe1a75902f33bbce3ca3d1cc3bfea", + "0xba2bc704559c23541f0c9efa0b522454e8cd06cd504d0e45724709cf5672640f", + "0x4644f74cc7fedf973ef015906df9ba97729b04395a70ff170bee8c40ffed8f0f", + "0xb5202e0c2d48a246c5b45e30d3bf0a89f3d3ea5e4591db5ec39efc1ed1e0a2a2", + "0xff857f4c17c9fb2e544e496685ebd8e2258c761e4636cfb031ba73a4430061c7", + "0x72cf6a5869e83ea39846cc892946c8a5e6bf3191df19ae922664504e4cf38c6b", + "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", + "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", + "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", + "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", + "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", + "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", + "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", + "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", + "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", + "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", + "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", + "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", + "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", + "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", + "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", + "0x1101000000000000000000000000000000000000000000000000000000000000", + "0xcbe0080000000000000000000000000000000000000000000000000000000000", + "0x8ff2572846d80ce4be83e1638164331c30cd7eadb3488f00ba2507c072929e3a", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0xa6c60794743172c4a55a9fcee4a7832e5ef7b31aac1b9489b5baa1db78df5c60", + "0x1c8017e95f68e52210618f3802699b49a2a13a40257e97b74ee864824a73a280" + ] +} \ No newline at end of file diff --git a/src/test/test-data/fullWithdrawalDeneb.json b/src/test/test-data/fullWithdrawalDeneb.json new file mode 100644 index 000000000..b7d6dc53f --- /dev/null +++ b/src/test/test-data/fullWithdrawalDeneb.json @@ -0,0 +1,162 @@ +{ + "slot": 7421951, + "validatorIndex": 0, + "historicalSummaryIndex": 271, + "withdrawalIndex": 0, + "blockHeaderRootIndex": 8191, + "beaconStateRoot": "0xaf91e832d495c6d0e877bdf61b2bb6614621addb789ab492ceff9eef1696a64b", + "slotRoot": "0xff3f710000000000000000000000000000000000000000000000000000000000", + "timestampRoot": "0x54f4a86500000000000000000000000000000000000000000000000000000000", + "blockHeaderRoot": "0x68d267d7566c4829a1560fea6cce668f8fbf2e126e59e2556288bcbff92b64f2", + "blockBodyRoot": "0x88a28082491645022ce8d6af49dca10325fc979d179d0135f0f7d0937fbbbfeb", + "executionPayloadRoot": "0xc1f6b92b0e40c5cf43de8fe08f68434736dd9d42f7620436df40320f4eb65286", + "latestBlockHeaderRoot": "0x5a35a89568f3323481764c70b1bad0880d4d0114f185e43a42c96a8e45fa2a0f", + "SlotProof": [ + "0x8d6a010000000000000000000000000000000000000000000000000000000000", + "0x0d4c303f43d35612a043d17114edde94bdc94ee369b761067bb85bd347c94c4c", + "0x8dbd7ba3acb83e5e9a00d908e8d05e0dc99569d2135d24affc44e325b0f7911d" + ], + "WithdrawalProof": [ + "0x3effc719333b3a5052a34bd1ed124dce49445905dbe18af5aa947bfe25a94dd8", + "0xf8470ba001831654956a6f12a8ffd6a1f1004e08557268d86477945cd3989531", + "0x55f96eba696026f9d8389019bf3c2f61ab741f968c01744540b170a4fb0f25a4", + "0x47ab534e81180bcf81d1ef541132b84826f1f34e2a0fde736a313a6ed5557459", + "0x1000000000000000000000000000000000000000000000000000000000000000", + "0x00000a0000000000000000000000000000000000000000000000000000000000", + "0x5c1bb5d0e2afe397c9fb9e275aa97209ba4c01e13d181e66311b42aed62559f7", + "0x058ad237cbc009d8b6f426aaa40709e508753fa90c6858e147e1c1066127dc69", + "0x4750fb0e389da83ea89697969498c02f840a2b21c7ece905e0f284f7e5b179c4", + "0xd2252e6aa60b6dbca15826f459db1e89ec584c2a2aa89bccd1715b9942633e00" + ], + "ValidatorProof": [ + "0x9e06c3582190fe488eac3f9f6c95622742f9afe3e038b39d2ca97ba6d5d0de4e", + "0x3eb11a14af12d8558cc14493938ffa0a1c6155349699c2b9245e76344d9922ee", + "0x81c959aeae7524f4f1d2d3d930ba504cbe86330619a221c9e2d9fb315e32a4d1", + "0x9b9adf5d31a74f30ae86ce7f7a8bfe89d2bdf2bd799d0c6896174b4f15878bf1", + "0xdfe7aa4a49359b80e66fbdc8cbbf5d2014868aaf8dee25848f1b6494cb56231f", + "0xeec50554b6994496920a265643520c78ff05beec8015c6432f72b0cac5af510c", + "0x949da2d82acf86e064a7022c5d5e69528ad6d3dd5b9cdf7fb9b736f0d925fc38", + "0x9c797e45839da75fea2190bf7a2735e68d8e4bd3cdbc82498491debb3acce128", + "0x2c693b02fbff3f4f659bfb8414a9ba27bbfdc1baf65317f05a84a85552628bd6", + "0x6f853a43c11ab3ac27f5ea8dd9e6dc825216114dee8e5db2306b97723048daaa", + "0x620fe1c260fcea9fb7ca0b7cd64f88aa906c88a8efc136317d88483f8a99d5ae", + "0xccfc09edfaa6bb8f9a1db781f1104b3aeb2a45799c898df57f3610b9ffc255de", + "0x8c5a00d96b9eb727a5a4aec2fd6b9771cb0c5be3a8b5588aff54b2ee36792af2", + "0x48fc48699053f4bd8f986f4216e2728f11e0d53ebeaf13bc9d287d2e099e7196", + "0xac88ce300b12047d9131a651417b624f206b742080c28c347873a7706897b379", + "0xe373b48074ce47d30b57509e85e905e42e8dbc869bb7c436553326a7a65e22ec", + "0x358c6950cfb1fb035e1e2506bddf5a1dc1f87d699a464a7eb05b87ce699942ce", + "0x040e77e06c4d45802b2093e445e56a1ed5d5afbd1c3393806b006b7f40a17148", + "0xcfb3f924f2e8810a349041676060bbf55113cbc00270f778723dbac055c8ba2b", + "0xa4b4bda96e8ae5a441b128b339ed3776f6105d24fcaa288cad2a3153e430a9ea", + "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", + "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", + "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", + "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", + "0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0", + "0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544", + "0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765", + "0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4", + "0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1", + "0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636", + "0xb5fe28e79f1b850f8658246ce9b6a1e7b49fc06db7143e8fe0b4f2b0c5523a5c", + "0x985e929f70af28d0bdd1a90a808f977f597c7c778c489e98d3bd8910d31ac0f7", + "0xc6f67e02e6e4e1bdefb994c6098953f34636ba2b6ca20a4721d2b26a886722ff", + "0x1c9a7e5ff1cf48b4ad1582d3f4e4a1004f3b20d8c5a2b71387a4254ad933ebc5", + "0x2f075ae229646b6f6aed19a5e372cf295081401eb893ff599b3f9acc0c0d3e7d", + "0x328921deb59612076801e8cd61592107b5c67c79b846595cc6320c395b46362c", + "0xbfb909fdb236ad2411b4e4883810a074b840464689986c3f8a8091827e17c327", + "0x55d8fb3687ba3ba49f342c77f5a1f89bec83d811446e1a467139213d640b6a74", + "0xf7210d4f8e7e1039790e7bf4efa207555a10a6db1dd4b95da313aaa88b88fe76", + "0xad21b516cbc645ffe34ab5de1c8aef8cd4e7f8d2b51e8e1456adc7563cda206f", + "0x0b430a0000000000000000000000000000000000000000000000000000000000", + "0x3b4f070000000000000000000000000000000000000000000000000000000000", + "0x7e71eb9ab70a9ac86179e04cc156a3a6efd5d49e864b1def60d045fe88ae53db", + "0x042f04ac64635d44bd43c48c5504689a119901947ed7cfca6ce6f7171d29b696", + "0x560c8c92a1425b1c928f582f64de643e17290760d4ecb242afb53b62d51ea918", + "0xfe7b7941293bb1a833e6be99db3175a8ab0af7e44f42d0c9dcdf34ae916db490" + ], + "TimestampProof": [ + "0x79958c0000000000000000000000000000000000000000000000000000000000", + "0xb0949007c306f2de2257c598d935ca16be928532e866698c2561bf4cf1e08b6f", + "0x11b7c6b7b01e2a21a682cf18e431dc78efa32300bfb5eba5374420f11cbcb751", + "0x4750fb0e389da83ea89697969498c02f840a2b21c7ece905e0f284f7e5b179c4", + "0xd2252e6aa60b6dbca15826f459db1e89ec584c2a2aa89bccd1715b9942633e00" + ], + "ExecutionPayloadProof": [ + "0xe5e633a5ba845ad1ede8be35fed9ea6d37e39d09061398190eac885703ff5cbd", + "0x260336bbff9ef0540c4497ed3e946ba0ca2080b668a1bdcb033496e56c40d451", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0xd2dc492d263b7c106c7a5012f6f2c138c28e1cd37962d49a30031c16964f6bb8", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b", + "0x5c2aa56042580b615d81c829f006de5e7b2a21fc330119ddc7600a5a28692069" + ], + "ValidatorFields": [ + "0xe36689b7b39ee895a754ba878afac2aa5d83349143a8b23d371823dd9ed3435d", + "0x0100000000000000000000008e35f095545c56b07c942a4f3b055ef1ec4cb148", + "0x0040597307000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0xea65010000000000000000000000000000000000000000000000000000000000", + "0xf265010000000000000000000000000000000000000000000000000000000000", + "0xffffffffffffffff000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "WithdrawalFields": [ + "0xe599a70100000000000000000000000000000000000000000000000000000000", + "0x419f040000000000000000000000000000000000000000000000000000000000", + "0xd982a5927741bfd9b8cf16234061d7a592ca2b1c000000000000000000000000", + "0xe5015b7307000000000000000000000000000000000000000000000000000000" + ], + "StateRootAgainstLatestBlockHeaderProof": [ + "0xc055061b6674f3bac542b141b441b476130d17dacc3e61d6ce01a6b8528f7de7", + "0xfd8af94401badce5dd4588a22c605e197a51b17e696f761aed06819a98645f03", + "0xdeb9a60cdd0908457ff962da3895ffcf1a1e479b633e3427ac9b1166e006c8f7" + ], + "HistoricalSummaryProof": [ + "0x273d5cec9b06327f6b83f079e34df0678d905713326e4ac2fe3afe8b12d4af22", + "0xf39c43458894e29168c729f714c66b3aef24d43ea37c46ece64f736fbcbcb1d1", + "0xeca6748ed11dc62dbecc0eaca339af8929bfa9b962149257af7c30cb947ec642", + "0x7cd5fc51dbcc6c6666c00e0ddda4f095f848c70fdc6fa378c5eb9b9108e59efd", + "0xe6215943dc342defe9fb5c1474eb6f3ab3db8d1e04dd11707394cf026f0bf780", + "0x650c78d820aad1d0b31b94e1d15c2e4998aeffd5e3399646809064042e4f923e", + "0xefe753d3d111fa3603f090f5f08c2f12ae9324e8fbe2862162fc6c1587a5ab4b", + "0x3e62b06efce16432b6495d9d7fb51f0c3c745036e0c77dc5fc78a70e54d64d93", + "0x0aae9c557ef9a8c3d7b1dd2788f484b94a9cf04312cf274353e3c19d5beb8541", + "0x6d716c0e4864c59df7bc3319eb4ccac269242e9a1634cf04d4c8df8f9b53f4da", + "0x1eecd8c195eb8c158d0dd3e6d7303aee05cc9d9fdfe7c9135ac19453ee8d7bed", + "0x93b6c13c69ea8e5c921ac4b895db6f8ebc66d3b01daff16a1658f2526eb79ed9", + "0x4e0b3c661d827f71fca9f2fedc3a72d9e4907599577b7149123d5328afe091c9", + "0xae456e2a1b0f20ebda87d9e3e7f87f7dcc0860aae65c53657a51f876b862f9a9", + "0x3f8e2a5e35171009027df8b882d861e09d70a334a0db14b0f3c920fc6e4c4e23", + "0x0cad2edea11734fc388afd6bc9b9125be12edd7e4df6f05e2fdc5a622c0138fb", + "0x735f927c57108d1de8547c9d49ecdbf8661a481d6374ca6e25a103ea728b1916", + "0xf9513c49e7d50b6311372f787ab3ec7a112e384115d340b0d9f74bccb3562c33", + "0xd3573d59f23ed8018d754c166d987e60ac4018ed6a0c187e01439c10e449511f", + "0x9efde052aa15429fae05bad4d0b1d7c64da64d03d7a1854a588c2cb8430c0d30", + "0xd88ddfeed400a8755596b21942c1497e114c302e6118290f91e6772976041fa1", + "0x87eb0ddba57e35f6d286673802a4af5975e22506c7cf4c64bb6be5ee11527f2c", + "0x1ef5d0b4795711d6aaf89b6eb2e5ca1c8c729ad9acb5b58c2b700a857c3512a0", + "0x506d86582d252405b840018792cad2bf1259f1ef5aa5f887e13cb2f0094f51e1", + "0xffff0ad7e659772f9534c195c815efc4014ef1e1daed4404c06385d11192e92b", + "0x6cf04127db05441cd833107a52be852868890e4317e6a02ab47683aa75964220", + "0xb7d05f875f140027ef5118a2247bbb84ce8f2f0f1123623085daf7960c329f5f", + "0xdf6af5f5bbdb6be9ef8aa618e4bf8073960867171e29676f8b284dea6a08a85e", + "0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784", + "0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb", + "0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb", + "0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab", + "0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4", + "0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f", + "0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa", + "0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c", + "0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167", + "0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7", + "0x1101000000000000000000000000000000000000000000000000000000000000", + "0xcbe0080000000000000000000000000000000000000000000000000000000000", + "0x8ff2572846d80ce4be83e1638164331c30cd7eadb3488f00ba2507c072929e3a", + "0xdb56114e00fdd4c1f85c892bf35ac9a89289aaecb1ebd0a96cde606a748b5d71", + "0xa6c60794743172c4a55a9fcee4a7832e5ef7b31aac1b9489b5baa1db78df5c60", + "0x1c8017e95f68e52210618f3802699b49a2a13a40257e97b74ee864824a73a280" + ] +} \ No newline at end of file diff --git a/src/test/unit/EigenPod-PodManagerUnit.t.sol b/src/test/unit/EigenPod-PodManagerUnit.t.sol index 511b7d9be..e9f96cf35 100644 --- a/src/test/unit/EigenPod-PodManagerUnit.t.sol +++ b/src/test/unit/EigenPod-PodManagerUnit.t.sol @@ -118,6 +118,8 @@ contract EigenPod_PodManager_UnitTests is EigenLayerUnitTestSetup { // Set storage in EPM EigenPodManagerWrapper(address(eigenPodManager)).setPodAddress(podOwner, eigenPod); + + eigenPodManager.setDenebForkTimestamp(type(uint64).max); } } @@ -632,10 +634,10 @@ contract EigenPod_PodManager_UnitTests_EigenPodManager is EigenPod_PodManager_Un return BeaconChainProofs.WithdrawalProof( - abi.encodePacked(getWithdrawalProof()), + abi.encodePacked(getWithdrawalProofCapella()), abi.encodePacked(getSlotProof()), abi.encodePacked(getExecutionPayloadProof()), - abi.encodePacked(getTimestampProof()), + abi.encodePacked(getTimestampProofCapella()), abi.encodePacked(getHistoricalSummaryProof()), uint64(getBlockRootIndex()), uint64(getHistoricalSummaryIndex()), diff --git a/src/test/unit/EigenPodManagerUnit.t.sol b/src/test/unit/EigenPodManagerUnit.t.sol index cd344a0cd..b10864bd7 100644 --- a/src/test/unit/EigenPodManagerUnit.t.sol +++ b/src/test/unit/EigenPodManagerUnit.t.sol @@ -175,6 +175,47 @@ contract EigenPodManagerUnitTests_Initialization_Setters is EigenPodManagerUnitT // Check storage update assertEq(address(eigenPodManager.beaconChainOracle()), address(newBeaconChainOracle), "Beacon chain oracle not updated"); } + + function test_setDenebForkTimestamp(uint64 denebForkTimestamp) public { + cheats.assume(denebForkTimestamp != 0); + cheats.assume(denebForkTimestamp != type(uint64).max); + cheats.prank(initialOwner); + eigenPodManager.setDenebForkTimestamp(type(uint64).max); + cheats.expectEmit(true, true, true, true); + emit DenebForkTimestampUpdated(denebForkTimestamp); + eigenPodManager.setDenebForkTimestamp(denebForkTimestamp); + assertEq(eigenPodManager.denebForkTimestamp(), denebForkTimestamp, "fork timestamp not set correctly"); + } + + function test_setDenebForkTimestamp_Twice(uint64 timestamp1, uint64 timestamp2) public { + cheats.assume(timestamp1 != 0); + cheats.assume(timestamp2 != 0); + cheats.assume(timestamp1 != type(uint64).max); + cheats.assume(timestamp2 != type(uint64).max); + cheats.prank(initialOwner); + eigenPodManager.setDenebForkTimestamp(type(uint64).max); + eigenPodManager.setDenebForkTimestamp(timestamp1); + cheats.expectRevert(bytes("EigenPodManager.denebForkEnabled: Deneb fork timestamp cannot be set")); + eigenPodManager.setDenebForkTimestamp(timestamp2); + } + + function test_setDenebForkTimestamp_NotToUint64MaxImmediately(uint64 timestamp) public { + cheats.assume(timestamp != type(uint64).max); + cheats.assume(timestamp != 0); + cheats.prank(initialOwner); + cheats.expectRevert(bytes("EigenPodManager.denebForkEnabled: Deneb fork timestamp cannot be set")); + eigenPodManager.setDenebForkTimestamp(timestamp); + } + + function test_setDenebForkTimestamp_ToUint64MaxNotImmediately(uint64 timestamp) public { + cheats.assume(timestamp != type(uint64).max); + cheats.assume(timestamp != 0); + cheats.prank(initialOwner); + eigenPodManager.setDenebForkTimestamp(type(uint64).max); + eigenPodManager.setDenebForkTimestamp(timestamp); + cheats.expectRevert(bytes("EigenPodManager.denebForkEnabled: denebForkTimestamp must not be set yet")); + eigenPodManager.setDenebForkTimestamp(type(uint64).max); + } } contract EigenPodManagerUnitTests_CreationTests is EigenPodManagerUnitTests, IEigenPodManagerEvents { diff --git a/src/test/unit/EigenPodUnit.t.sol b/src/test/unit/EigenPodUnit.t.sol index 182562e04..1ed8e9b82 100644 --- a/src/test/unit/EigenPodUnit.t.sol +++ b/src/test/unit/EigenPodUnit.t.sol @@ -19,13 +19,16 @@ contract EigenPodUnitTests is EigenLayerUnitTestSetup { EigenPod public eigenPod; EigenPod public podImplementation; IBeacon public eigenPodBeacon; - + // Mocks IETHPOSDeposit public ethPOSDepositMock; IDelayedWithdrawalRouter public delayedWithdrawalRouterMock; // Address of pod for which proofs were generated address podAddress = address(0x49c486E3f4303bc11C02F952Fe5b08D0AB22D443); + + + bool IS_DENEB = false; // Constants // uint32 public constant WITHDRAWAL_DELAY_BLOCKS = 7 days / 12 seconds; @@ -146,6 +149,7 @@ contract EigenPodUnitTests_Stake is EigenPodUnitTests, IEigenPodEvents { eigenPod.stake{value: 32 ether}(pubkey, signature, depositDataRoot); } + function testFuzz_stake_revert_invalidValue(uint256 value) public { cheats.assume(value != 32 ether); cheats.deal(address(eigenPodManagerMock), value); @@ -419,6 +423,7 @@ contract EigenPodUnitTests_VerifyWithdrawalCredentialsTests is EigenPodHarnessSe } function testFuzz_revert_invalidValidatorFields(address wrongWithdrawalAddress) public { + cheats.assume(wrongWithdrawalAddress != address(eigenPodHarness)); // Set JSON and params setJSON("./src/test/test-data/withdrawal_credential_proof_302913.json"); _setWithdrawalCredentialParams(); @@ -983,13 +988,14 @@ contract EigenPodUnitTests_WithdrawalTests is EigenPodHarnessSetup, ProofParsing bytes32 slotRoot = getSlotRoot(); bytes32 timestampRoot = getTimestampRoot(); bytes32 executionPayloadRoot = getExecutionPayloadRoot(); - + bytes memory withdrawalProof = IS_DENEB ? abi.encodePacked(getWithdrawalProofDeneb()) : abi.encodePacked(getWithdrawalProofCapella()); + bytes memory timestampProof = IS_DENEB ? abi.encodePacked(getTimestampProofDeneb()) : abi.encodePacked(getTimestampProofCapella()); return BeaconChainProofs.WithdrawalProof( - abi.encodePacked(getWithdrawalProof()), + abi.encodePacked(withdrawalProof), abi.encodePacked(getSlotProof()), abi.encodePacked(getExecutionPayloadProof()), - abi.encodePacked(getTimestampProof()), + abi.encodePacked(timestampProof), abi.encodePacked(getHistoricalSummaryProof()), uint64(getBlockRootIndex()), uint64(getHistoricalSummaryIndex()), diff --git a/src/test/utils/ProofParsing.sol b/src/test/utils/ProofParsing.sol index 44b7de2de..5baf260b7 100644 --- a/src/test/utils/ProofParsing.sol +++ b/src/test/utils/ProofParsing.sol @@ -10,12 +10,14 @@ contract ProofParsing is Test { bytes32[18] blockHeaderProof; bytes32[3] slotProof; - bytes32[9] withdrawalProof; + bytes32[10] withdrawalProofDeneb; + bytes32[9] withdrawalProofCapella; bytes32[46] validatorProof; bytes32[44] historicalSummaryProof; bytes32[7] executionPayloadProof; - bytes32[4] timestampProofs; + bytes32[5] timestampProofsCapella; + bytes32[4] timestampProofsDeneb; bytes32 slotRoot; bytes32 executionPayloadRoot; @@ -79,14 +81,24 @@ contract ProofParsing is Test { return executionPayloadProof; } - function getTimestampProof() public returns(bytes32[4] memory) { + function getTimestampProofDeneb() public returns(bytes32[5] memory) { + for (uint i = 0; i < 5; i++) { + prefix = string.concat(".TimestampProof[", string.concat(vm.toString(i), "]")); + timestampProofsCapella[i] = (stdJson.readBytes32(proofConfigJson, prefix)); + } + return timestampProofsCapella; + } + + function getTimestampProofCapella() public returns(bytes32[4] memory) { for (uint i = 0; i < 4; i++) { prefix = string.concat(".TimestampProof[", string.concat(vm.toString(i), "]")); - timestampProofs[i] = (stdJson.readBytes32(proofConfigJson, prefix)); + timestampProofsDeneb[i] = (stdJson.readBytes32(proofConfigJson, prefix)); } - return timestampProofs; + return timestampProofsDeneb; } + + function getBlockHeaderProof() public returns(bytes32[18] memory) { for (uint i = 0; i < 18; i++) { prefix = string.concat(".BlockHeaderProof[", string.concat(vm.toString(i), "]")); @@ -112,12 +124,20 @@ contract ProofParsing is Test { return stateRootProof; } - function getWithdrawalProof() public returns(bytes32[9] memory) { + function getWithdrawalProofDeneb() public returns(bytes32[10] memory) { + for (uint i = 0; i < 10; i++) { + prefix = string.concat(".WithdrawalProof[", string.concat(vm.toString(i), "]")); + withdrawalProofDeneb[i] = (stdJson.readBytes32(proofConfigJson, prefix)); + } + return withdrawalProofDeneb; + } + + function getWithdrawalProofCapella() public returns(bytes32[9] memory) { for (uint i = 0; i < 9; i++) { prefix = string.concat(".WithdrawalProof[", string.concat(vm.toString(i), "]")); - withdrawalProof[i] = (stdJson.readBytes32(proofConfigJson, prefix)); + withdrawalProofCapella[i] = (stdJson.readBytes32(proofConfigJson, prefix)); } - return withdrawalProof; + return withdrawalProofCapella; } function getValidatorProof() public returns(bytes32[46] memory) {