diff --git a/src/contracts/libraries/BeaconChainProofs.sol b/src/contracts/libraries/BeaconChainProofs.sol index cdd0dd6d1..2c4b88662 100644 --- a/src/contracts/libraries/BeaconChainProofs.sol +++ b/src/contracts/libraries/BeaconChainProofs.sol @@ -11,37 +11,19 @@ import "../libraries/Endian.sol"; //BeaconState Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconstate library BeaconChainProofs { // constants are the number of fields and the heights of the different merkle trees used in merkleizing beacon chain containers - uint256 internal constant NUM_BEACON_BLOCK_HEADER_FIELDS = 5; uint256 internal constant BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT = 3; - uint256 internal constant NUM_BEACON_BLOCK_BODY_FIELDS = 11; uint256 internal constant BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT = 4; - uint256 internal constant NUM_BEACON_STATE_FIELDS = 21; uint256 internal constant BEACON_STATE_FIELD_TREE_HEIGHT = 5; - uint256 internal constant NUM_ETH1_DATA_FIELDS = 3; - uint256 internal constant ETH1_DATA_FIELD_TREE_HEIGHT = 2; - - uint256 internal constant NUM_VALIDATOR_FIELDS = 8; uint256 internal constant VALIDATOR_FIELD_TREE_HEIGHT = 3; - uint256 internal constant NUM_EXECUTION_PAYLOAD_HEADER_FIELDS = 15; //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; - - // HISTORICAL_ROOTS_LIMIT = 2**24, so tree height is 24 - uint256 internal constant HISTORICAL_ROOTS_TREE_HEIGHT = 24; - - // HISTORICAL_BATCH is root of state_roots and block_root, so number of leaves = 2^1 - uint256 internal constant HISTORICAL_BATCH_TREE_HEIGHT = 1; - // SLOTS_PER_HISTORICAL_ROOT = 2**13, so tree height is 13 - uint256 internal constant STATE_ROOTS_TREE_HEIGHT = 13; uint256 internal constant BLOCK_ROOTS_TREE_HEIGHT = 13; //HISTORICAL_ROOTS_LIMIT = 2**24, so tree height is 24 @@ -50,7 +32,6 @@ library BeaconChainProofs { //Index of block_summary_root in historical_summary container uint256 internal constant BLOCK_SUMMARY_ROOT_INDEX = 0; - uint256 internal constant NUM_WITHDRAWAL_FIELDS = 4; // tree height for hash tree of an individual withdrawal container uint256 internal constant WITHDRAWAL_FIELD_TREE_HEIGHT = 2; @@ -64,31 +45,20 @@ library BeaconChainProofs { // in beacon block header https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader uint256 internal constant SLOT_INDEX = 0; - uint256 internal constant PROPOSER_INDEX_INDEX = 1; uint256 internal constant STATE_ROOT_INDEX = 3; uint256 internal constant BODY_ROOT_INDEX = 4; // in beacon state https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate - uint256 internal constant HISTORICAL_BATCH_STATE_ROOT_INDEX = 1; - uint256 internal constant BEACON_STATE_SLOT_INDEX = 2; - uint256 internal constant LATEST_BLOCK_HEADER_ROOT_INDEX = 4; - uint256 internal constant BLOCK_ROOTS_INDEX = 5; - uint256 internal constant STATE_ROOTS_INDEX = 6; - uint256 internal constant HISTORICAL_ROOTS_INDEX = 7; - uint256 internal constant ETH_1_ROOT_INDEX = 8; uint256 internal constant VALIDATOR_TREE_ROOT_INDEX = 11; - uint256 internal constant EXECUTION_PAYLOAD_HEADER_INDEX = 24; uint256 internal constant HISTORICAL_SUMMARIES_INDEX = 27; // in validator https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator uint256 internal constant VALIDATOR_PUBKEY_INDEX = 0; uint256 internal constant VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX = 1; uint256 internal constant VALIDATOR_BALANCE_INDEX = 2; - uint256 internal constant VALIDATOR_SLASHED_INDEX = 3; uint256 internal constant VALIDATOR_WITHDRAWABLE_EPOCH_INDEX = 7; // in execution payload header uint256 internal constant TIMESTAMP_INDEX = 9; - uint256 internal constant WITHDRAWALS_ROOT_INDEX = 14; //in execution payload uint256 internal constant WITHDRAWALS_INDEX = 14; @@ -97,9 +67,6 @@ library BeaconChainProofs { uint256 internal constant WITHDRAWAL_VALIDATOR_INDEX_INDEX = 1; uint256 internal constant WITHDRAWAL_VALIDATOR_AMOUNT_INDEX = 3; - //In historicalBatch - uint256 internal constant HISTORICALBATCH_STATEROOTS_INDEX = 1; - //Misc Constants /// @notice The number of slots each epoch in the beacon chain