diff --git a/ethereum-consensus/src/types/beacon_block.rs b/ethereum-consensus/src/types/beacon_block.rs index b15d95cfa..9f859e031 100644 --- a/ethereum-consensus/src/types/beacon_block.rs +++ b/ethereum-consensus/src/types/beacon_block.rs @@ -1286,6 +1286,23 @@ impl< MAX_BLOB_COMMITMENTS_PER_BLOCK, > { + pub fn phase0( + &self, + ) -> Option< + &phase0::BeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + >, + > { + match self { + Self::Phase0(inner) => Some(inner), + _ => None, + } + } pub fn phase0_mut( &mut self, ) -> Option< @@ -1303,6 +1320,24 @@ impl< _ => None, } } + pub fn altair( + &self, + ) -> Option< + &altair::BeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + >, + > { + match self { + Self::Altair(inner) => Some(inner), + _ => None, + } + } pub fn altair_mut( &mut self, ) -> Option< @@ -1321,6 +1356,28 @@ impl< _ => None, } } + pub fn bellatrix( + &self, + ) -> Option< + &bellatrix::BeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + >, + > { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option< @@ -1343,6 +1400,30 @@ impl< _ => None, } } + pub fn capella( + &self, + ) -> Option< + &capella::BeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + MAX_BLS_TO_EXECUTION_CHANGES, + >, + > { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option< @@ -1367,6 +1448,31 @@ impl< _ => None, } } + pub fn deneb( + &self, + ) -> Option< + &deneb::BeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_BLOB_COMMITMENTS_PER_BLOCK, + >, + > { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option< @@ -1401,6 +1507,15 @@ impl< Self::Deneb(_) => Version::Deneb, } } + pub fn slot(&self) -> &Slot { + match self { + Self::Phase0(inner) => &inner.slot, + Self::Altair(inner) => &inner.slot, + Self::Bellatrix(inner) => &inner.slot, + Self::Capella(inner) => &inner.slot, + Self::Deneb(inner) => &inner.slot, + } + } pub fn slot_mut(&mut self) -> &mut Slot { match self { Self::Phase0(inner) => &mut inner.slot, @@ -1410,6 +1525,15 @@ impl< Self::Deneb(inner) => &mut inner.slot, } } + pub fn proposer_index(&self) -> &ValidatorIndex { + match self { + Self::Phase0(inner) => &inner.proposer_index, + Self::Altair(inner) => &inner.proposer_index, + Self::Bellatrix(inner) => &inner.proposer_index, + Self::Capella(inner) => &inner.proposer_index, + Self::Deneb(inner) => &inner.proposer_index, + } + } pub fn proposer_index_mut(&mut self) -> &mut ValidatorIndex { match self { Self::Phase0(inner) => &mut inner.proposer_index, @@ -1419,6 +1543,15 @@ impl< Self::Deneb(inner) => &mut inner.proposer_index, } } + pub fn parent_root(&self) -> &Root { + match self { + Self::Phase0(inner) => &inner.parent_root, + Self::Altair(inner) => &inner.parent_root, + Self::Bellatrix(inner) => &inner.parent_root, + Self::Capella(inner) => &inner.parent_root, + Self::Deneb(inner) => &inner.parent_root, + } + } pub fn parent_root_mut(&mut self) -> &mut Root { match self { Self::Phase0(inner) => &mut inner.parent_root, @@ -1428,6 +1561,15 @@ impl< Self::Deneb(inner) => &mut inner.parent_root, } } + pub fn state_root(&self) -> &Root { + match self { + Self::Phase0(inner) => &inner.state_root, + Self::Altair(inner) => &inner.state_root, + Self::Bellatrix(inner) => &inner.state_root, + Self::Capella(inner) => &inner.state_root, + Self::Deneb(inner) => &inner.state_root, + } + } pub fn state_root_mut(&mut self) -> &mut Root { match self { Self::Phase0(inner) => &mut inner.state_root, @@ -1437,6 +1579,32 @@ impl< Self::Deneb(inner) => &mut inner.state_root, } } + pub fn body( + &self, + ) -> BeaconBlockBodyRef< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_BLOB_COMMITMENTS_PER_BLOCK, + > { + match self { + Self::Phase0(inner) => From::from(&inner.body), + Self::Altair(inner) => From::from(&inner.body), + Self::Bellatrix(inner) => From::from(&inner.body), + Self::Capella(inner) => From::from(&inner.body), + Self::Deneb(inner) => From::from(&inner.body), + } + } pub fn body_mut( &mut self, ) -> BeaconBlockBodyRefMut< diff --git a/ethereum-consensus/src/types/beacon_block_body.rs b/ethereum-consensus/src/types/beacon_block_body.rs index 407f4be28..a37669ba9 100644 --- a/ethereum-consensus/src/types/beacon_block_body.rs +++ b/ethereum-consensus/src/types/beacon_block_body.rs @@ -1484,6 +1484,23 @@ impl< MAX_BLOB_COMMITMENTS_PER_BLOCK, > { + pub fn phase0( + &self, + ) -> Option< + &phase0::BeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + >, + > { + match self { + Self::Phase0(inner) => Some(inner), + _ => None, + } + } pub fn phase0_mut( &mut self, ) -> Option< @@ -1501,6 +1518,24 @@ impl< _ => None, } } + pub fn altair( + &self, + ) -> Option< + &altair::BeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + >, + > { + match self { + Self::Altair(inner) => Some(inner), + _ => None, + } + } pub fn altair_mut( &mut self, ) -> Option< @@ -1519,6 +1554,28 @@ impl< _ => None, } } + pub fn bellatrix( + &self, + ) -> Option< + &bellatrix::BeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + >, + > { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option< @@ -1541,6 +1598,30 @@ impl< _ => None, } } + pub fn capella( + &self, + ) -> Option< + &capella::BeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + MAX_BLS_TO_EXECUTION_CHANGES, + >, + > { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option< @@ -1565,6 +1646,31 @@ impl< _ => None, } } + pub fn deneb( + &self, + ) -> Option< + &deneb::BeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_BLOB_COMMITMENTS_PER_BLOCK, + >, + > { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option< @@ -1599,6 +1705,15 @@ impl< Self::Deneb(_) => Version::Deneb, } } + pub fn randao_reveal(&self) -> &BlsSignature { + match self { + Self::Phase0(inner) => &inner.randao_reveal, + Self::Altair(inner) => &inner.randao_reveal, + Self::Bellatrix(inner) => &inner.randao_reveal, + Self::Capella(inner) => &inner.randao_reveal, + Self::Deneb(inner) => &inner.randao_reveal, + } + } pub fn randao_reveal_mut(&mut self) -> &mut BlsSignature { match self { Self::Phase0(inner) => &mut inner.randao_reveal, @@ -1608,6 +1723,15 @@ impl< Self::Deneb(inner) => &mut inner.randao_reveal, } } + pub fn eth1_data(&self) -> &Eth1Data { + match self { + Self::Phase0(inner) => &inner.eth1_data, + Self::Altair(inner) => &inner.eth1_data, + Self::Bellatrix(inner) => &inner.eth1_data, + Self::Capella(inner) => &inner.eth1_data, + Self::Deneb(inner) => &inner.eth1_data, + } + } pub fn eth1_data_mut(&mut self) -> &mut Eth1Data { match self { Self::Phase0(inner) => &mut inner.eth1_data, @@ -1617,6 +1741,15 @@ impl< Self::Deneb(inner) => &mut inner.eth1_data, } } + pub fn graffiti(&self) -> &Bytes32 { + match self { + Self::Phase0(inner) => &inner.graffiti, + Self::Altair(inner) => &inner.graffiti, + Self::Bellatrix(inner) => &inner.graffiti, + Self::Capella(inner) => &inner.graffiti, + Self::Deneb(inner) => &inner.graffiti, + } + } pub fn graffiti_mut(&mut self) -> &mut Bytes32 { match self { Self::Phase0(inner) => &mut inner.graffiti, @@ -1626,6 +1759,15 @@ impl< Self::Deneb(inner) => &mut inner.graffiti, } } + pub fn proposer_slashings(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.proposer_slashings, + Self::Altair(inner) => &inner.proposer_slashings, + Self::Bellatrix(inner) => &inner.proposer_slashings, + Self::Capella(inner) => &inner.proposer_slashings, + Self::Deneb(inner) => &inner.proposer_slashings, + } + } pub fn proposer_slashings_mut( &mut self, ) -> &mut List { @@ -1637,6 +1779,17 @@ impl< Self::Deneb(inner) => &mut inner.proposer_slashings, } } + pub fn attester_slashings( + &self, + ) -> &List, MAX_ATTESTER_SLASHINGS> { + match self { + Self::Phase0(inner) => &inner.attester_slashings, + Self::Altair(inner) => &inner.attester_slashings, + Self::Bellatrix(inner) => &inner.attester_slashings, + Self::Capella(inner) => &inner.attester_slashings, + Self::Deneb(inner) => &inner.attester_slashings, + } + } pub fn attester_slashings_mut( &mut self, ) -> &mut List, MAX_ATTESTER_SLASHINGS> { @@ -1648,6 +1801,17 @@ impl< Self::Deneb(inner) => &mut inner.attester_slashings, } } + pub fn attestations( + &self, + ) -> &List, MAX_ATTESTATIONS> { + match self { + Self::Phase0(inner) => &inner.attestations, + Self::Altair(inner) => &inner.attestations, + Self::Bellatrix(inner) => &inner.attestations, + Self::Capella(inner) => &inner.attestations, + Self::Deneb(inner) => &inner.attestations, + } + } pub fn attestations_mut( &mut self, ) -> &mut List, MAX_ATTESTATIONS> { @@ -1659,6 +1823,15 @@ impl< Self::Deneb(inner) => &mut inner.attestations, } } + pub fn deposits(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.deposits, + Self::Altair(inner) => &inner.deposits, + Self::Bellatrix(inner) => &inner.deposits, + Self::Capella(inner) => &inner.deposits, + Self::Deneb(inner) => &inner.deposits, + } + } pub fn deposits_mut(&mut self) -> &mut List { match self { Self::Phase0(inner) => &mut inner.deposits, @@ -1668,6 +1841,15 @@ impl< Self::Deneb(inner) => &mut inner.deposits, } } + pub fn voluntary_exits(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.voluntary_exits, + Self::Altair(inner) => &inner.voluntary_exits, + Self::Bellatrix(inner) => &inner.voluntary_exits, + Self::Capella(inner) => &inner.voluntary_exits, + Self::Deneb(inner) => &inner.voluntary_exits, + } + } pub fn voluntary_exits_mut(&mut self) -> &mut List { match self { Self::Phase0(inner) => &mut inner.voluntary_exits, @@ -1677,6 +1859,15 @@ impl< Self::Deneb(inner) => &mut inner.voluntary_exits, } } + pub fn sync_aggregate(&self) -> Option<&SyncAggregate> { + match self { + Self::Phase0(_) => None, + Self::Altair(inner) => Some(&inner.sync_aggregate), + Self::Bellatrix(inner) => Some(&inner.sync_aggregate), + Self::Capella(inner) => Some(&inner.sync_aggregate), + Self::Deneb(inner) => Some(&inner.sync_aggregate), + } + } pub fn sync_aggregate_mut(&mut self) -> Option<&mut SyncAggregate> { match self { Self::Phase0(_) => None, @@ -1686,6 +1877,25 @@ impl< Self::Deneb(inner) => Some(&mut inner.sync_aggregate), } } + pub fn execution_payload( + &self, + ) -> Option< + ExecutionPayloadRef< + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + >, + > { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(inner) => Some(From::from(&inner.execution_payload)), + Self::Capella(inner) => Some(From::from(&inner.execution_payload)), + Self::Deneb(inner) => Some(From::from(&inner.execution_payload)), + } + } pub fn execution_payload_mut( &mut self, ) -> Option< @@ -1705,6 +1915,17 @@ impl< Self::Deneb(inner) => Some(From::from(&mut inner.execution_payload)), } } + pub fn bls_to_execution_changes( + &self, + ) -> Option<&List> { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.bls_to_execution_changes), + Self::Deneb(inner) => Some(&inner.bls_to_execution_changes), + } + } pub fn bls_to_execution_changes_mut( &mut self, ) -> Option<&mut List> { @@ -1716,6 +1937,17 @@ impl< Self::Deneb(inner) => Some(&mut inner.bls_to_execution_changes), } } + pub fn blob_kzg_commitments( + &self, + ) -> Option<&List> { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(inner) => Some(&inner.blob_kzg_commitments), + } + } pub fn blob_kzg_commitments_mut( &mut self, ) -> Option<&mut List> { diff --git a/ethereum-consensus/src/types/beacon_state.rs b/ethereum-consensus/src/types/beacon_state.rs index dbf8dc7fc..20223df71 100644 --- a/ethereum-consensus/src/types/beacon_state.rs +++ b/ethereum-consensus/src/types/beacon_state.rs @@ -1855,6 +1855,25 @@ impl< MAX_EXTRA_DATA_BYTES, > { + pub fn phase0( + &self, + ) -> Option< + &phase0::BeaconState< + SLOTS_PER_HISTORICAL_ROOT, + HISTORICAL_ROOTS_LIMIT, + ETH1_DATA_VOTES_BOUND, + VALIDATOR_REGISTRY_LIMIT, + EPOCHS_PER_HISTORICAL_VECTOR, + EPOCHS_PER_SLASHINGS_VECTOR, + MAX_VALIDATORS_PER_COMMITTEE, + PENDING_ATTESTATIONS_BOUND, + >, + > { + match self { + Self::Phase0(inner) => Some(inner), + _ => None, + } + } pub fn phase0_mut( &mut self, ) -> Option< @@ -1874,6 +1893,25 @@ impl< _ => None, } } + pub fn altair( + &self, + ) -> Option< + &altair::BeaconState< + SLOTS_PER_HISTORICAL_ROOT, + HISTORICAL_ROOTS_LIMIT, + ETH1_DATA_VOTES_BOUND, + VALIDATOR_REGISTRY_LIMIT, + EPOCHS_PER_HISTORICAL_VECTOR, + EPOCHS_PER_SLASHINGS_VECTOR, + MAX_VALIDATORS_PER_COMMITTEE, + SYNC_COMMITTEE_SIZE, + >, + > { + match self { + Self::Altair(inner) => Some(inner), + _ => None, + } + } pub fn altair_mut( &mut self, ) -> Option< @@ -1893,6 +1931,27 @@ impl< _ => None, } } + pub fn bellatrix( + &self, + ) -> Option< + &bellatrix::BeaconState< + SLOTS_PER_HISTORICAL_ROOT, + HISTORICAL_ROOTS_LIMIT, + ETH1_DATA_VOTES_BOUND, + VALIDATOR_REGISTRY_LIMIT, + EPOCHS_PER_HISTORICAL_VECTOR, + EPOCHS_PER_SLASHINGS_VECTOR, + MAX_VALIDATORS_PER_COMMITTEE, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + >, + > { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option< @@ -1914,6 +1973,27 @@ impl< _ => None, } } + pub fn capella( + &self, + ) -> Option< + &capella::BeaconState< + SLOTS_PER_HISTORICAL_ROOT, + HISTORICAL_ROOTS_LIMIT, + ETH1_DATA_VOTES_BOUND, + VALIDATOR_REGISTRY_LIMIT, + EPOCHS_PER_HISTORICAL_VECTOR, + EPOCHS_PER_SLASHINGS_VECTOR, + MAX_VALIDATORS_PER_COMMITTEE, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + >, + > { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option< @@ -1935,6 +2015,27 @@ impl< _ => None, } } + pub fn deneb( + &self, + ) -> Option< + &deneb::BeaconState< + SLOTS_PER_HISTORICAL_ROOT, + HISTORICAL_ROOTS_LIMIT, + ETH1_DATA_VOTES_BOUND, + VALIDATOR_REGISTRY_LIMIT, + EPOCHS_PER_HISTORICAL_VECTOR, + EPOCHS_PER_SLASHINGS_VECTOR, + MAX_VALIDATORS_PER_COMMITTEE, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + >, + > { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option< @@ -1965,6 +2066,15 @@ impl< Self::Deneb(_) => Version::Deneb, } } + pub fn genesis_time(&self) -> &u64 { + match self { + Self::Phase0(inner) => &inner.genesis_time, + Self::Altair(inner) => &inner.genesis_time, + Self::Bellatrix(inner) => &inner.genesis_time, + Self::Capella(inner) => &inner.genesis_time, + Self::Deneb(inner) => &inner.genesis_time, + } + } pub fn genesis_time_mut(&mut self) -> &mut u64 { match self { Self::Phase0(inner) => &mut inner.genesis_time, @@ -1974,6 +2084,15 @@ impl< Self::Deneb(inner) => &mut inner.genesis_time, } } + pub fn genesis_validators_root(&self) -> &Root { + match self { + Self::Phase0(inner) => &inner.genesis_validators_root, + Self::Altair(inner) => &inner.genesis_validators_root, + Self::Bellatrix(inner) => &inner.genesis_validators_root, + Self::Capella(inner) => &inner.genesis_validators_root, + Self::Deneb(inner) => &inner.genesis_validators_root, + } + } pub fn genesis_validators_root_mut(&mut self) -> &mut Root { match self { Self::Phase0(inner) => &mut inner.genesis_validators_root, @@ -1983,6 +2102,15 @@ impl< Self::Deneb(inner) => &mut inner.genesis_validators_root, } } + pub fn slot(&self) -> &Slot { + match self { + Self::Phase0(inner) => &inner.slot, + Self::Altair(inner) => &inner.slot, + Self::Bellatrix(inner) => &inner.slot, + Self::Capella(inner) => &inner.slot, + Self::Deneb(inner) => &inner.slot, + } + } pub fn slot_mut(&mut self) -> &mut Slot { match self { Self::Phase0(inner) => &mut inner.slot, @@ -1992,6 +2120,15 @@ impl< Self::Deneb(inner) => &mut inner.slot, } } + pub fn fork(&self) -> &Fork { + match self { + Self::Phase0(inner) => &inner.fork, + Self::Altair(inner) => &inner.fork, + Self::Bellatrix(inner) => &inner.fork, + Self::Capella(inner) => &inner.fork, + Self::Deneb(inner) => &inner.fork, + } + } pub fn fork_mut(&mut self) -> &mut Fork { match self { Self::Phase0(inner) => &mut inner.fork, @@ -2001,6 +2138,15 @@ impl< Self::Deneb(inner) => &mut inner.fork, } } + pub fn latest_block_header(&self) -> &BeaconBlockHeader { + match self { + Self::Phase0(inner) => &inner.latest_block_header, + Self::Altair(inner) => &inner.latest_block_header, + Self::Bellatrix(inner) => &inner.latest_block_header, + Self::Capella(inner) => &inner.latest_block_header, + Self::Deneb(inner) => &inner.latest_block_header, + } + } pub fn latest_block_header_mut(&mut self) -> &mut BeaconBlockHeader { match self { Self::Phase0(inner) => &mut inner.latest_block_header, @@ -2010,6 +2156,15 @@ impl< Self::Deneb(inner) => &mut inner.latest_block_header, } } + pub fn block_roots(&self) -> &Vector { + match self { + Self::Phase0(inner) => &inner.block_roots, + Self::Altair(inner) => &inner.block_roots, + Self::Bellatrix(inner) => &inner.block_roots, + Self::Capella(inner) => &inner.block_roots, + Self::Deneb(inner) => &inner.block_roots, + } + } pub fn block_roots_mut(&mut self) -> &mut Vector { match self { Self::Phase0(inner) => &mut inner.block_roots, @@ -2019,6 +2174,15 @@ impl< Self::Deneb(inner) => &mut inner.block_roots, } } + pub fn state_roots(&self) -> &Vector { + match self { + Self::Phase0(inner) => &inner.state_roots, + Self::Altair(inner) => &inner.state_roots, + Self::Bellatrix(inner) => &inner.state_roots, + Self::Capella(inner) => &inner.state_roots, + Self::Deneb(inner) => &inner.state_roots, + } + } pub fn state_roots_mut(&mut self) -> &mut Vector { match self { Self::Phase0(inner) => &mut inner.state_roots, @@ -2028,6 +2192,15 @@ impl< Self::Deneb(inner) => &mut inner.state_roots, } } + pub fn historical_roots(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.historical_roots, + Self::Altair(inner) => &inner.historical_roots, + Self::Bellatrix(inner) => &inner.historical_roots, + Self::Capella(inner) => &inner.historical_roots, + Self::Deneb(inner) => &inner.historical_roots, + } + } pub fn historical_roots_mut(&mut self) -> &mut List { match self { Self::Phase0(inner) => &mut inner.historical_roots, @@ -2037,6 +2210,15 @@ impl< Self::Deneb(inner) => &mut inner.historical_roots, } } + pub fn eth1_data(&self) -> &Eth1Data { + match self { + Self::Phase0(inner) => &inner.eth1_data, + Self::Altair(inner) => &inner.eth1_data, + Self::Bellatrix(inner) => &inner.eth1_data, + Self::Capella(inner) => &inner.eth1_data, + Self::Deneb(inner) => &inner.eth1_data, + } + } pub fn eth1_data_mut(&mut self) -> &mut Eth1Data { match self { Self::Phase0(inner) => &mut inner.eth1_data, @@ -2046,6 +2228,15 @@ impl< Self::Deneb(inner) => &mut inner.eth1_data, } } + pub fn eth1_data_votes(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.eth1_data_votes, + Self::Altair(inner) => &inner.eth1_data_votes, + Self::Bellatrix(inner) => &inner.eth1_data_votes, + Self::Capella(inner) => &inner.eth1_data_votes, + Self::Deneb(inner) => &inner.eth1_data_votes, + } + } pub fn eth1_data_votes_mut(&mut self) -> &mut List { match self { Self::Phase0(inner) => &mut inner.eth1_data_votes, @@ -2055,6 +2246,15 @@ impl< Self::Deneb(inner) => &mut inner.eth1_data_votes, } } + pub fn eth1_deposit_index(&self) -> &u64 { + match self { + Self::Phase0(inner) => &inner.eth1_deposit_index, + Self::Altair(inner) => &inner.eth1_deposit_index, + Self::Bellatrix(inner) => &inner.eth1_deposit_index, + Self::Capella(inner) => &inner.eth1_deposit_index, + Self::Deneb(inner) => &inner.eth1_deposit_index, + } + } pub fn eth1_deposit_index_mut(&mut self) -> &mut u64 { match self { Self::Phase0(inner) => &mut inner.eth1_deposit_index, @@ -2064,6 +2264,15 @@ impl< Self::Deneb(inner) => &mut inner.eth1_deposit_index, } } + pub fn validators(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.validators, + Self::Altair(inner) => &inner.validators, + Self::Bellatrix(inner) => &inner.validators, + Self::Capella(inner) => &inner.validators, + Self::Deneb(inner) => &inner.validators, + } + } pub fn validators_mut(&mut self) -> &mut List { match self { Self::Phase0(inner) => &mut inner.validators, @@ -2073,6 +2282,15 @@ impl< Self::Deneb(inner) => &mut inner.validators, } } + pub fn balances(&self) -> &List { + match self { + Self::Phase0(inner) => &inner.balances, + Self::Altair(inner) => &inner.balances, + Self::Bellatrix(inner) => &inner.balances, + Self::Capella(inner) => &inner.balances, + Self::Deneb(inner) => &inner.balances, + } + } pub fn balances_mut(&mut self) -> &mut List { match self { Self::Phase0(inner) => &mut inner.balances, @@ -2082,6 +2300,15 @@ impl< Self::Deneb(inner) => &mut inner.balances, } } + pub fn randao_mixes(&self) -> &Vector { + match self { + Self::Phase0(inner) => &inner.randao_mixes, + Self::Altair(inner) => &inner.randao_mixes, + Self::Bellatrix(inner) => &inner.randao_mixes, + Self::Capella(inner) => &inner.randao_mixes, + Self::Deneb(inner) => &inner.randao_mixes, + } + } pub fn randao_mixes_mut(&mut self) -> &mut Vector { match self { Self::Phase0(inner) => &mut inner.randao_mixes, @@ -2091,6 +2318,15 @@ impl< Self::Deneb(inner) => &mut inner.randao_mixes, } } + pub fn slashings(&self) -> &Vector { + match self { + Self::Phase0(inner) => &inner.slashings, + Self::Altair(inner) => &inner.slashings, + Self::Bellatrix(inner) => &inner.slashings, + Self::Capella(inner) => &inner.slashings, + Self::Deneb(inner) => &inner.slashings, + } + } pub fn slashings_mut(&mut self) -> &mut Vector { match self { Self::Phase0(inner) => &mut inner.slashings, @@ -2100,6 +2336,18 @@ impl< Self::Deneb(inner) => &mut inner.slashings, } } + pub fn previous_epoch_attestations( + &self, + ) -> Option<&List, PENDING_ATTESTATIONS_BOUND>> + { + match self { + Self::Phase0(inner) => Some(&inner.previous_epoch_attestations), + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(_) => None, + } + } pub fn previous_epoch_attestations_mut( &mut self, ) -> Option< @@ -2113,6 +2361,18 @@ impl< Self::Deneb(_) => None, } } + pub fn current_epoch_attestations( + &self, + ) -> Option<&List, PENDING_ATTESTATIONS_BOUND>> + { + match self { + Self::Phase0(inner) => Some(&inner.current_epoch_attestations), + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(_) => None, + } + } pub fn current_epoch_attestations_mut( &mut self, ) -> Option< @@ -2126,6 +2386,15 @@ impl< Self::Deneb(_) => None, } } + pub fn justification_bits(&self) -> &Bitvector { + match self { + Self::Phase0(inner) => &inner.justification_bits, + Self::Altair(inner) => &inner.justification_bits, + Self::Bellatrix(inner) => &inner.justification_bits, + Self::Capella(inner) => &inner.justification_bits, + Self::Deneb(inner) => &inner.justification_bits, + } + } pub fn justification_bits_mut(&mut self) -> &mut Bitvector { match self { Self::Phase0(inner) => &mut inner.justification_bits, @@ -2135,6 +2404,15 @@ impl< Self::Deneb(inner) => &mut inner.justification_bits, } } + pub fn previous_justified_checkpoint(&self) -> &Checkpoint { + match self { + Self::Phase0(inner) => &inner.previous_justified_checkpoint, + Self::Altair(inner) => &inner.previous_justified_checkpoint, + Self::Bellatrix(inner) => &inner.previous_justified_checkpoint, + Self::Capella(inner) => &inner.previous_justified_checkpoint, + Self::Deneb(inner) => &inner.previous_justified_checkpoint, + } + } pub fn previous_justified_checkpoint_mut(&mut self) -> &mut Checkpoint { match self { Self::Phase0(inner) => &mut inner.previous_justified_checkpoint, @@ -2144,6 +2422,15 @@ impl< Self::Deneb(inner) => &mut inner.previous_justified_checkpoint, } } + pub fn current_justified_checkpoint(&self) -> &Checkpoint { + match self { + Self::Phase0(inner) => &inner.current_justified_checkpoint, + Self::Altair(inner) => &inner.current_justified_checkpoint, + Self::Bellatrix(inner) => &inner.current_justified_checkpoint, + Self::Capella(inner) => &inner.current_justified_checkpoint, + Self::Deneb(inner) => &inner.current_justified_checkpoint, + } + } pub fn current_justified_checkpoint_mut(&mut self) -> &mut Checkpoint { match self { Self::Phase0(inner) => &mut inner.current_justified_checkpoint, @@ -2153,6 +2440,15 @@ impl< Self::Deneb(inner) => &mut inner.current_justified_checkpoint, } } + pub fn finalized_checkpoint(&self) -> &Checkpoint { + match self { + Self::Phase0(inner) => &inner.finalized_checkpoint, + Self::Altair(inner) => &inner.finalized_checkpoint, + Self::Bellatrix(inner) => &inner.finalized_checkpoint, + Self::Capella(inner) => &inner.finalized_checkpoint, + Self::Deneb(inner) => &inner.finalized_checkpoint, + } + } pub fn finalized_checkpoint_mut(&mut self) -> &mut Checkpoint { match self { Self::Phase0(inner) => &mut inner.finalized_checkpoint, @@ -2162,6 +2458,17 @@ impl< Self::Deneb(inner) => &mut inner.finalized_checkpoint, } } + pub fn previous_epoch_participation( + &self, + ) -> Option<&List> { + match self { + Self::Phase0(_) => None, + Self::Altair(inner) => Some(&inner.previous_epoch_participation), + Self::Bellatrix(inner) => Some(&inner.previous_epoch_participation), + Self::Capella(inner) => Some(&inner.previous_epoch_participation), + Self::Deneb(inner) => Some(&inner.previous_epoch_participation), + } + } pub fn previous_epoch_participation_mut( &mut self, ) -> Option<&mut List> { @@ -2173,6 +2480,17 @@ impl< Self::Deneb(inner) => Some(&mut inner.previous_epoch_participation), } } + pub fn current_epoch_participation( + &self, + ) -> Option<&List> { + match self { + Self::Phase0(_) => None, + Self::Altair(inner) => Some(&inner.current_epoch_participation), + Self::Bellatrix(inner) => Some(&inner.current_epoch_participation), + Self::Capella(inner) => Some(&inner.current_epoch_participation), + Self::Deneb(inner) => Some(&inner.current_epoch_participation), + } + } pub fn current_epoch_participation_mut( &mut self, ) -> Option<&mut List> { @@ -2184,6 +2502,15 @@ impl< Self::Deneb(inner) => Some(&mut inner.current_epoch_participation), } } + pub fn inactivity_scores(&self) -> Option<&List> { + match self { + Self::Phase0(_) => None, + Self::Altair(inner) => Some(&inner.inactivity_scores), + Self::Bellatrix(inner) => Some(&inner.inactivity_scores), + Self::Capella(inner) => Some(&inner.inactivity_scores), + Self::Deneb(inner) => Some(&inner.inactivity_scores), + } + } pub fn inactivity_scores_mut(&mut self) -> Option<&mut List> { match self { Self::Phase0(_) => None, @@ -2193,6 +2520,15 @@ impl< Self::Deneb(inner) => Some(&mut inner.inactivity_scores), } } + pub fn current_sync_committee(&self) -> Option<&SyncCommittee> { + match self { + Self::Phase0(_) => None, + Self::Altair(inner) => Some(&inner.current_sync_committee), + Self::Bellatrix(inner) => Some(&inner.current_sync_committee), + Self::Capella(inner) => Some(&inner.current_sync_committee), + Self::Deneb(inner) => Some(&inner.current_sync_committee), + } + } pub fn current_sync_committee_mut( &mut self, ) -> Option<&mut SyncCommittee> { @@ -2204,6 +2540,15 @@ impl< Self::Deneb(inner) => Some(&mut inner.current_sync_committee), } } + pub fn next_sync_committee(&self) -> Option<&SyncCommittee> { + match self { + Self::Phase0(_) => None, + Self::Altair(inner) => Some(&inner.next_sync_committee), + Self::Bellatrix(inner) => Some(&inner.next_sync_committee), + Self::Capella(inner) => Some(&inner.next_sync_committee), + Self::Deneb(inner) => Some(&inner.next_sync_committee), + } + } pub fn next_sync_committee_mut(&mut self) -> Option<&mut SyncCommittee> { match self { Self::Phase0(_) => None, @@ -2213,6 +2558,17 @@ impl< Self::Deneb(inner) => Some(&mut inner.next_sync_committee), } } + pub fn latest_execution_payload_header( + &self, + ) -> Option> { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(inner) => Some(From::from(&inner.latest_execution_payload_header)), + Self::Capella(inner) => Some(From::from(&inner.latest_execution_payload_header)), + Self::Deneb(inner) => Some(From::from(&inner.latest_execution_payload_header)), + } + } pub fn latest_execution_payload_header_mut( &mut self, ) -> Option> { @@ -2224,6 +2580,15 @@ impl< Self::Deneb(inner) => Some(From::from(&mut inner.latest_execution_payload_header)), } } + pub fn next_withdrawal_index(&self) -> Option<&WithdrawalIndex> { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.next_withdrawal_index), + Self::Deneb(inner) => Some(&inner.next_withdrawal_index), + } + } pub fn next_withdrawal_index_mut(&mut self) -> Option<&mut WithdrawalIndex> { match self { Self::Phase0(_) => None, @@ -2233,6 +2598,15 @@ impl< Self::Deneb(inner) => Some(&mut inner.next_withdrawal_index), } } + pub fn next_withdrawal_validator_index(&self) -> Option<&ValidatorIndex> { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.next_withdrawal_validator_index), + Self::Deneb(inner) => Some(&inner.next_withdrawal_validator_index), + } + } pub fn next_withdrawal_validator_index_mut(&mut self) -> Option<&mut ValidatorIndex> { match self { Self::Phase0(_) => None, @@ -2242,6 +2616,15 @@ impl< Self::Deneb(inner) => Some(&mut inner.next_withdrawal_validator_index), } } + pub fn historical_summaries(&self) -> Option<&List> { + match self { + Self::Phase0(_) => None, + Self::Altair(_) => None, + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.historical_summaries), + Self::Deneb(inner) => Some(&inner.historical_summaries), + } + } pub fn historical_summaries_mut( &mut self, ) -> Option<&mut List> { diff --git a/ethereum-consensus/src/types/blinded_beacon_block.rs b/ethereum-consensus/src/types/blinded_beacon_block.rs index 81fe027b5..8cb725bd5 100644 --- a/ethereum-consensus/src/types/blinded_beacon_block.rs +++ b/ethereum-consensus/src/types/blinded_beacon_block.rs @@ -838,6 +838,26 @@ impl< MAX_BLOB_COMMITMENTS_PER_BLOCK, > { + pub fn bellatrix( + &self, + ) -> Option< + &bellatrix::BlindedBeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + >, + > { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option< @@ -858,6 +878,27 @@ impl< _ => None, } } + pub fn capella( + &self, + ) -> Option< + &capella::BlindedBeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BLS_TO_EXECUTION_CHANGES, + >, + > { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option< @@ -879,6 +920,28 @@ impl< _ => None, } } + pub fn deneb( + &self, + ) -> Option< + &deneb::BlindedBeaconBlock< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_BLOB_COMMITMENTS_PER_BLOCK, + >, + > { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option< @@ -908,6 +971,13 @@ impl< Self::Deneb(_) => Version::Deneb, } } + pub fn slot(&self) -> &Slot { + match self { + Self::Bellatrix(inner) => &inner.slot, + Self::Capella(inner) => &inner.slot, + Self::Deneb(inner) => &inner.slot, + } + } pub fn slot_mut(&mut self) -> &mut Slot { match self { Self::Bellatrix(inner) => &mut inner.slot, @@ -915,6 +985,13 @@ impl< Self::Deneb(inner) => &mut inner.slot, } } + pub fn proposer_index(&self) -> &ValidatorIndex { + match self { + Self::Bellatrix(inner) => &inner.proposer_index, + Self::Capella(inner) => &inner.proposer_index, + Self::Deneb(inner) => &inner.proposer_index, + } + } pub fn proposer_index_mut(&mut self) -> &mut ValidatorIndex { match self { Self::Bellatrix(inner) => &mut inner.proposer_index, @@ -922,6 +999,13 @@ impl< Self::Deneb(inner) => &mut inner.proposer_index, } } + pub fn parent_root(&self) -> &Root { + match self { + Self::Bellatrix(inner) => &inner.parent_root, + Self::Capella(inner) => &inner.parent_root, + Self::Deneb(inner) => &inner.parent_root, + } + } pub fn parent_root_mut(&mut self) -> &mut Root { match self { Self::Bellatrix(inner) => &mut inner.parent_root, @@ -929,6 +1013,13 @@ impl< Self::Deneb(inner) => &mut inner.parent_root, } } + pub fn state_root(&self) -> &Root { + match self { + Self::Bellatrix(inner) => &inner.state_root, + Self::Capella(inner) => &inner.state_root, + Self::Deneb(inner) => &inner.state_root, + } + } pub fn state_root_mut(&mut self) -> &mut Root { match self { Self::Bellatrix(inner) => &mut inner.state_root, @@ -936,6 +1027,27 @@ impl< Self::Deneb(inner) => &mut inner.state_root, } } + pub fn body( + &self, + ) -> BlindedBeaconBlockBodyRef< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_BLOB_COMMITMENTS_PER_BLOCK, + > { + match self { + Self::Bellatrix(inner) => From::from(&inner.body), + Self::Capella(inner) => From::from(&inner.body), + Self::Deneb(inner) => From::from(&inner.body), + } + } pub fn body_mut( &mut self, ) -> BlindedBeaconBlockBodyRefMut< diff --git a/ethereum-consensus/src/types/blinded_beacon_block_body.rs b/ethereum-consensus/src/types/blinded_beacon_block_body.rs index fb124bc3e..cd7d8a4f4 100644 --- a/ethereum-consensus/src/types/blinded_beacon_block_body.rs +++ b/ethereum-consensus/src/types/blinded_beacon_block_body.rs @@ -980,6 +980,26 @@ impl< MAX_BLOB_COMMITMENTS_PER_BLOCK, > { + pub fn bellatrix( + &self, + ) -> Option< + &bellatrix::BlindedBeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + >, + > { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option< @@ -1000,6 +1020,27 @@ impl< _ => None, } } + pub fn capella( + &self, + ) -> Option< + &capella::BlindedBeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BLS_TO_EXECUTION_CHANGES, + >, + > { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option< @@ -1021,6 +1062,28 @@ impl< _ => None, } } + pub fn deneb( + &self, + ) -> Option< + &deneb::BlindedBeaconBlockBody< + MAX_PROPOSER_SLASHINGS, + MAX_VALIDATORS_PER_COMMITTEE, + MAX_ATTESTER_SLASHINGS, + MAX_ATTESTATIONS, + MAX_DEPOSITS, + MAX_VOLUNTARY_EXITS, + SYNC_COMMITTEE_SIZE, + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BLS_TO_EXECUTION_CHANGES, + MAX_BLOB_COMMITMENTS_PER_BLOCK, + >, + > { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option< @@ -1050,6 +1113,13 @@ impl< Self::Deneb(_) => Version::Deneb, } } + pub fn randao_reveal(&self) -> &BlsSignature { + match self { + Self::Bellatrix(inner) => &inner.randao_reveal, + Self::Capella(inner) => &inner.randao_reveal, + Self::Deneb(inner) => &inner.randao_reveal, + } + } pub fn randao_reveal_mut(&mut self) -> &mut BlsSignature { match self { Self::Bellatrix(inner) => &mut inner.randao_reveal, @@ -1057,6 +1127,13 @@ impl< Self::Deneb(inner) => &mut inner.randao_reveal, } } + pub fn eth1_data(&self) -> &Eth1Data { + match self { + Self::Bellatrix(inner) => &inner.eth1_data, + Self::Capella(inner) => &inner.eth1_data, + Self::Deneb(inner) => &inner.eth1_data, + } + } pub fn eth1_data_mut(&mut self) -> &mut Eth1Data { match self { Self::Bellatrix(inner) => &mut inner.eth1_data, @@ -1064,6 +1141,13 @@ impl< Self::Deneb(inner) => &mut inner.eth1_data, } } + pub fn graffiti(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.graffiti, + Self::Capella(inner) => &inner.graffiti, + Self::Deneb(inner) => &inner.graffiti, + } + } pub fn graffiti_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.graffiti, @@ -1071,6 +1155,13 @@ impl< Self::Deneb(inner) => &mut inner.graffiti, } } + pub fn proposer_slashings(&self) -> &List { + match self { + Self::Bellatrix(inner) => &inner.proposer_slashings, + Self::Capella(inner) => &inner.proposer_slashings, + Self::Deneb(inner) => &inner.proposer_slashings, + } + } pub fn proposer_slashings_mut( &mut self, ) -> &mut List { @@ -1080,6 +1171,15 @@ impl< Self::Deneb(inner) => &mut inner.proposer_slashings, } } + pub fn attester_slashings( + &self, + ) -> &List, MAX_ATTESTER_SLASHINGS> { + match self { + Self::Bellatrix(inner) => &inner.attester_slashings, + Self::Capella(inner) => &inner.attester_slashings, + Self::Deneb(inner) => &inner.attester_slashings, + } + } pub fn attester_slashings_mut( &mut self, ) -> &mut List, MAX_ATTESTER_SLASHINGS> { @@ -1089,6 +1189,15 @@ impl< Self::Deneb(inner) => &mut inner.attester_slashings, } } + pub fn attestations( + &self, + ) -> &List, MAX_ATTESTATIONS> { + match self { + Self::Bellatrix(inner) => &inner.attestations, + Self::Capella(inner) => &inner.attestations, + Self::Deneb(inner) => &inner.attestations, + } + } pub fn attestations_mut( &mut self, ) -> &mut List, MAX_ATTESTATIONS> { @@ -1098,6 +1207,13 @@ impl< Self::Deneb(inner) => &mut inner.attestations, } } + pub fn deposits(&self) -> &List { + match self { + Self::Bellatrix(inner) => &inner.deposits, + Self::Capella(inner) => &inner.deposits, + Self::Deneb(inner) => &inner.deposits, + } + } pub fn deposits_mut(&mut self) -> &mut List { match self { Self::Bellatrix(inner) => &mut inner.deposits, @@ -1105,6 +1221,13 @@ impl< Self::Deneb(inner) => &mut inner.deposits, } } + pub fn voluntary_exits(&self) -> &List { + match self { + Self::Bellatrix(inner) => &inner.voluntary_exits, + Self::Capella(inner) => &inner.voluntary_exits, + Self::Deneb(inner) => &inner.voluntary_exits, + } + } pub fn voluntary_exits_mut(&mut self) -> &mut List { match self { Self::Bellatrix(inner) => &mut inner.voluntary_exits, @@ -1112,6 +1235,13 @@ impl< Self::Deneb(inner) => &mut inner.voluntary_exits, } } + pub fn sync_aggregate(&self) -> &SyncAggregate { + match self { + Self::Bellatrix(inner) => &inner.sync_aggregate, + Self::Capella(inner) => &inner.sync_aggregate, + Self::Deneb(inner) => &inner.sync_aggregate, + } + } pub fn sync_aggregate_mut(&mut self) -> &mut SyncAggregate { match self { Self::Bellatrix(inner) => &mut inner.sync_aggregate, @@ -1119,6 +1249,15 @@ impl< Self::Deneb(inner) => &mut inner.sync_aggregate, } } + pub fn execution_payload_header( + &self, + ) -> ExecutionPayloadHeaderRef { + match self { + Self::Bellatrix(inner) => From::from(&inner.execution_payload_header), + Self::Capella(inner) => From::from(&inner.execution_payload_header), + Self::Deneb(inner) => From::from(&inner.execution_payload_header), + } + } pub fn execution_payload_header_mut( &mut self, ) -> ExecutionPayloadHeaderRefMut { @@ -1128,6 +1267,15 @@ impl< Self::Deneb(inner) => From::from(&mut inner.execution_payload_header), } } + pub fn bls_to_execution_changes( + &self, + ) -> Option<&List> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.bls_to_execution_changes), + Self::Deneb(inner) => Some(&inner.bls_to_execution_changes), + } + } pub fn bls_to_execution_changes_mut( &mut self, ) -> Option<&mut List> { @@ -1137,6 +1285,15 @@ impl< Self::Deneb(inner) => Some(&mut inner.bls_to_execution_changes), } } + pub fn blob_kzg_commitments( + &self, + ) -> Option<&List> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(inner) => Some(&inner.blob_kzg_commitments), + } + } pub fn blob_kzg_commitments_mut( &mut self, ) -> Option<&mut List> { diff --git a/ethereum-consensus/src/types/execution_payload.rs b/ethereum-consensus/src/types/execution_payload.rs index 02788bd5c..91f9f4dfd 100644 --- a/ethereum-consensus/src/types/execution_payload.rs +++ b/ethereum-consensus/src/types/execution_payload.rs @@ -825,6 +825,21 @@ impl< MAX_WITHDRAWALS_PER_PAYLOAD, > { + pub fn bellatrix( + &self, + ) -> Option< + &bellatrix::ExecutionPayload< + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + >, + > { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option< @@ -840,6 +855,22 @@ impl< _ => None, } } + pub fn capella( + &self, + ) -> Option< + &capella::ExecutionPayload< + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + >, + > { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option< @@ -856,6 +887,22 @@ impl< _ => None, } } + pub fn deneb( + &self, + ) -> Option< + &deneb::ExecutionPayload< + BYTES_PER_LOGS_BLOOM, + MAX_EXTRA_DATA_BYTES, + MAX_BYTES_PER_TRANSACTION, + MAX_TRANSACTIONS_PER_PAYLOAD, + MAX_WITHDRAWALS_PER_PAYLOAD, + >, + > { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option< @@ -879,6 +926,13 @@ impl< Self::Deneb(_) => Version::Deneb, } } + pub fn parent_hash(&self) -> &Hash32 { + match self { + Self::Bellatrix(inner) => &inner.parent_hash, + Self::Capella(inner) => &inner.parent_hash, + Self::Deneb(inner) => &inner.parent_hash, + } + } pub fn parent_hash_mut(&mut self) -> &mut Hash32 { match self { Self::Bellatrix(inner) => &mut inner.parent_hash, @@ -886,6 +940,13 @@ impl< Self::Deneb(inner) => &mut inner.parent_hash, } } + pub fn fee_recipient(&self) -> &ExecutionAddress { + match self { + Self::Bellatrix(inner) => &inner.fee_recipient, + Self::Capella(inner) => &inner.fee_recipient, + Self::Deneb(inner) => &inner.fee_recipient, + } + } pub fn fee_recipient_mut(&mut self) -> &mut ExecutionAddress { match self { Self::Bellatrix(inner) => &mut inner.fee_recipient, @@ -893,6 +954,13 @@ impl< Self::Deneb(inner) => &mut inner.fee_recipient, } } + pub fn state_root(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.state_root, + Self::Capella(inner) => &inner.state_root, + Self::Deneb(inner) => &inner.state_root, + } + } pub fn state_root_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.state_root, @@ -900,6 +968,13 @@ impl< Self::Deneb(inner) => &mut inner.state_root, } } + pub fn receipts_root(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.receipts_root, + Self::Capella(inner) => &inner.receipts_root, + Self::Deneb(inner) => &inner.receipts_root, + } + } pub fn receipts_root_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.receipts_root, @@ -907,6 +982,13 @@ impl< Self::Deneb(inner) => &mut inner.receipts_root, } } + pub fn logs_bloom(&self) -> &ByteVector { + match self { + Self::Bellatrix(inner) => &inner.logs_bloom, + Self::Capella(inner) => &inner.logs_bloom, + Self::Deneb(inner) => &inner.logs_bloom, + } + } pub fn logs_bloom_mut(&mut self) -> &mut ByteVector { match self { Self::Bellatrix(inner) => &mut inner.logs_bloom, @@ -914,6 +996,13 @@ impl< Self::Deneb(inner) => &mut inner.logs_bloom, } } + pub fn prev_randao(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.prev_randao, + Self::Capella(inner) => &inner.prev_randao, + Self::Deneb(inner) => &inner.prev_randao, + } + } pub fn prev_randao_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.prev_randao, @@ -921,6 +1010,13 @@ impl< Self::Deneb(inner) => &mut inner.prev_randao, } } + pub fn block_number(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.block_number, + Self::Capella(inner) => &inner.block_number, + Self::Deneb(inner) => &inner.block_number, + } + } pub fn block_number_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.block_number, @@ -928,6 +1024,13 @@ impl< Self::Deneb(inner) => &mut inner.block_number, } } + pub fn gas_limit(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.gas_limit, + Self::Capella(inner) => &inner.gas_limit, + Self::Deneb(inner) => &inner.gas_limit, + } + } pub fn gas_limit_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.gas_limit, @@ -935,6 +1038,13 @@ impl< Self::Deneb(inner) => &mut inner.gas_limit, } } + pub fn gas_used(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.gas_used, + Self::Capella(inner) => &inner.gas_used, + Self::Deneb(inner) => &inner.gas_used, + } + } pub fn gas_used_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.gas_used, @@ -942,6 +1052,13 @@ impl< Self::Deneb(inner) => &mut inner.gas_used, } } + pub fn timestamp(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.timestamp, + Self::Capella(inner) => &inner.timestamp, + Self::Deneb(inner) => &inner.timestamp, + } + } pub fn timestamp_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.timestamp, @@ -949,6 +1066,13 @@ impl< Self::Deneb(inner) => &mut inner.timestamp, } } + pub fn extra_data(&self) -> &ByteList { + match self { + Self::Bellatrix(inner) => &inner.extra_data, + Self::Capella(inner) => &inner.extra_data, + Self::Deneb(inner) => &inner.extra_data, + } + } pub fn extra_data_mut(&mut self) -> &mut ByteList { match self { Self::Bellatrix(inner) => &mut inner.extra_data, @@ -956,6 +1080,13 @@ impl< Self::Deneb(inner) => &mut inner.extra_data, } } + pub fn base_fee_per_gas(&self) -> &U256 { + match self { + Self::Bellatrix(inner) => &inner.base_fee_per_gas, + Self::Capella(inner) => &inner.base_fee_per_gas, + Self::Deneb(inner) => &inner.base_fee_per_gas, + } + } pub fn base_fee_per_gas_mut(&mut self) -> &mut U256 { match self { Self::Bellatrix(inner) => &mut inner.base_fee_per_gas, @@ -963,6 +1094,13 @@ impl< Self::Deneb(inner) => &mut inner.base_fee_per_gas, } } + pub fn block_hash(&self) -> &Hash32 { + match self { + Self::Bellatrix(inner) => &inner.block_hash, + Self::Capella(inner) => &inner.block_hash, + Self::Deneb(inner) => &inner.block_hash, + } + } pub fn block_hash_mut(&mut self) -> &mut Hash32 { match self { Self::Bellatrix(inner) => &mut inner.block_hash, @@ -970,6 +1108,15 @@ impl< Self::Deneb(inner) => &mut inner.block_hash, } } + pub fn transactions( + &self, + ) -> &List, MAX_TRANSACTIONS_PER_PAYLOAD> { + match self { + Self::Bellatrix(inner) => &inner.transactions, + Self::Capella(inner) => &inner.transactions, + Self::Deneb(inner) => &inner.transactions, + } + } pub fn transactions_mut( &mut self, ) -> &mut List, MAX_TRANSACTIONS_PER_PAYLOAD> { @@ -979,6 +1126,13 @@ impl< Self::Deneb(inner) => &mut inner.transactions, } } + pub fn withdrawals(&self) -> Option<&List> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.withdrawals), + Self::Deneb(inner) => Some(&inner.withdrawals), + } + } pub fn withdrawals_mut( &mut self, ) -> Option<&mut List> { @@ -988,6 +1142,13 @@ impl< Self::Deneb(inner) => Some(&mut inner.withdrawals), } } + pub fn blob_gas_used(&self) -> Option<&u64> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(inner) => Some(&inner.blob_gas_used), + } + } pub fn blob_gas_used_mut(&mut self) -> Option<&mut u64> { match self { Self::Bellatrix(_) => None, @@ -995,6 +1156,13 @@ impl< Self::Deneb(inner) => Some(&mut inner.blob_gas_used), } } + pub fn excess_blob_gas(&self) -> Option<&u64> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(inner) => Some(&inner.excess_blob_gas), + } + } pub fn excess_blob_gas_mut(&mut self) -> Option<&mut u64> { match self { Self::Bellatrix(_) => None, diff --git a/ethereum-consensus/src/types/execution_payload_header.rs b/ethereum-consensus/src/types/execution_payload_header.rs index 377f6396a..fa3860395 100644 --- a/ethereum-consensus/src/types/execution_payload_header.rs +++ b/ethereum-consensus/src/types/execution_payload_header.rs @@ -543,6 +543,15 @@ pub enum ExecutionPayloadHeaderRefMut< impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> ExecutionPayloadHeaderRefMut<'a, BYTES_PER_LOGS_BLOOM, MAX_EXTRA_DATA_BYTES> { + pub fn bellatrix( + &self, + ) -> Option<&bellatrix::ExecutionPayloadHeader> + { + match self { + Self::Bellatrix(inner) => Some(inner), + _ => None, + } + } pub fn bellatrix_mut( &mut self, ) -> Option<&mut bellatrix::ExecutionPayloadHeader> @@ -552,6 +561,14 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> _ => None, } } + pub fn capella( + &self, + ) -> Option<&capella::ExecutionPayloadHeader> { + match self { + Self::Capella(inner) => Some(inner), + _ => None, + } + } pub fn capella_mut( &mut self, ) -> Option<&mut capella::ExecutionPayloadHeader> @@ -561,6 +578,14 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> _ => None, } } + pub fn deneb( + &self, + ) -> Option<&deneb::ExecutionPayloadHeader> { + match self { + Self::Deneb(inner) => Some(inner), + _ => None, + } + } pub fn deneb_mut( &mut self, ) -> Option<&mut deneb::ExecutionPayloadHeader> @@ -577,6 +602,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(_) => Version::Deneb, } } + pub fn parent_hash(&self) -> &Hash32 { + match self { + Self::Bellatrix(inner) => &inner.parent_hash, + Self::Capella(inner) => &inner.parent_hash, + Self::Deneb(inner) => &inner.parent_hash, + } + } pub fn parent_hash_mut(&mut self) -> &mut Hash32 { match self { Self::Bellatrix(inner) => &mut inner.parent_hash, @@ -584,6 +616,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.parent_hash, } } + pub fn fee_recipient(&self) -> &ExecutionAddress { + match self { + Self::Bellatrix(inner) => &inner.fee_recipient, + Self::Capella(inner) => &inner.fee_recipient, + Self::Deneb(inner) => &inner.fee_recipient, + } + } pub fn fee_recipient_mut(&mut self) -> &mut ExecutionAddress { match self { Self::Bellatrix(inner) => &mut inner.fee_recipient, @@ -591,6 +630,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.fee_recipient, } } + pub fn state_root(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.state_root, + Self::Capella(inner) => &inner.state_root, + Self::Deneb(inner) => &inner.state_root, + } + } pub fn state_root_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.state_root, @@ -598,6 +644,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.state_root, } } + pub fn receipts_root(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.receipts_root, + Self::Capella(inner) => &inner.receipts_root, + Self::Deneb(inner) => &inner.receipts_root, + } + } pub fn receipts_root_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.receipts_root, @@ -605,6 +658,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.receipts_root, } } + pub fn logs_bloom(&self) -> &ByteVector { + match self { + Self::Bellatrix(inner) => &inner.logs_bloom, + Self::Capella(inner) => &inner.logs_bloom, + Self::Deneb(inner) => &inner.logs_bloom, + } + } pub fn logs_bloom_mut(&mut self) -> &mut ByteVector { match self { Self::Bellatrix(inner) => &mut inner.logs_bloom, @@ -612,6 +672,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.logs_bloom, } } + pub fn prev_randao(&self) -> &Bytes32 { + match self { + Self::Bellatrix(inner) => &inner.prev_randao, + Self::Capella(inner) => &inner.prev_randao, + Self::Deneb(inner) => &inner.prev_randao, + } + } pub fn prev_randao_mut(&mut self) -> &mut Bytes32 { match self { Self::Bellatrix(inner) => &mut inner.prev_randao, @@ -619,6 +686,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.prev_randao, } } + pub fn block_number(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.block_number, + Self::Capella(inner) => &inner.block_number, + Self::Deneb(inner) => &inner.block_number, + } + } pub fn block_number_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.block_number, @@ -626,6 +700,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.block_number, } } + pub fn gas_limit(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.gas_limit, + Self::Capella(inner) => &inner.gas_limit, + Self::Deneb(inner) => &inner.gas_limit, + } + } pub fn gas_limit_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.gas_limit, @@ -633,6 +714,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.gas_limit, } } + pub fn gas_used(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.gas_used, + Self::Capella(inner) => &inner.gas_used, + Self::Deneb(inner) => &inner.gas_used, + } + } pub fn gas_used_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.gas_used, @@ -640,6 +728,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.gas_used, } } + pub fn timestamp(&self) -> &u64 { + match self { + Self::Bellatrix(inner) => &inner.timestamp, + Self::Capella(inner) => &inner.timestamp, + Self::Deneb(inner) => &inner.timestamp, + } + } pub fn timestamp_mut(&mut self) -> &mut u64 { match self { Self::Bellatrix(inner) => &mut inner.timestamp, @@ -647,6 +742,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.timestamp, } } + pub fn extra_data(&self) -> &ByteList { + match self { + Self::Bellatrix(inner) => &inner.extra_data, + Self::Capella(inner) => &inner.extra_data, + Self::Deneb(inner) => &inner.extra_data, + } + } pub fn extra_data_mut(&mut self) -> &mut ByteList { match self { Self::Bellatrix(inner) => &mut inner.extra_data, @@ -654,6 +756,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.extra_data, } } + pub fn base_fee_per_gas(&self) -> &U256 { + match self { + Self::Bellatrix(inner) => &inner.base_fee_per_gas, + Self::Capella(inner) => &inner.base_fee_per_gas, + Self::Deneb(inner) => &inner.base_fee_per_gas, + } + } pub fn base_fee_per_gas_mut(&mut self) -> &mut U256 { match self { Self::Bellatrix(inner) => &mut inner.base_fee_per_gas, @@ -661,6 +770,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.base_fee_per_gas, } } + pub fn block_hash(&self) -> &Hash32 { + match self { + Self::Bellatrix(inner) => &inner.block_hash, + Self::Capella(inner) => &inner.block_hash, + Self::Deneb(inner) => &inner.block_hash, + } + } pub fn block_hash_mut(&mut self) -> &mut Hash32 { match self { Self::Bellatrix(inner) => &mut inner.block_hash, @@ -668,6 +784,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.block_hash, } } + pub fn transactions_root(&self) -> &Root { + match self { + Self::Bellatrix(inner) => &inner.transactions_root, + Self::Capella(inner) => &inner.transactions_root, + Self::Deneb(inner) => &inner.transactions_root, + } + } pub fn transactions_root_mut(&mut self) -> &mut Root { match self { Self::Bellatrix(inner) => &mut inner.transactions_root, @@ -675,6 +798,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => &mut inner.transactions_root, } } + pub fn withdrawals_root(&self) -> Option<&Root> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(inner) => Some(&inner.withdrawals_root), + Self::Deneb(inner) => Some(&inner.withdrawals_root), + } + } pub fn withdrawals_root_mut(&mut self) -> Option<&mut Root> { match self { Self::Bellatrix(_) => None, @@ -682,6 +812,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => Some(&mut inner.withdrawals_root), } } + pub fn blob_gas_used(&self) -> Option<&u64> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(inner) => Some(&inner.blob_gas_used), + } + } pub fn blob_gas_used_mut(&mut self) -> Option<&mut u64> { match self { Self::Bellatrix(_) => None, @@ -689,6 +826,13 @@ impl<'a, const BYTES_PER_LOGS_BLOOM: usize, const MAX_EXTRA_DATA_BYTES: usize> Self::Deneb(inner) => Some(&mut inner.blob_gas_used), } } + pub fn excess_blob_gas(&self) -> Option<&u64> { + match self { + Self::Bellatrix(_) => None, + Self::Capella(_) => None, + Self::Deneb(inner) => Some(&inner.excess_blob_gas), + } + } pub fn excess_blob_gas_mut(&mut self) -> Option<&mut u64> { match self { Self::Bellatrix(_) => None, diff --git a/spec-gen/src/type_generator.rs b/spec-gen/src/type_generator.rs index 01bde191b..b0e4321fa 100644 --- a/spec-gen/src/type_generator.rs +++ b/spec-gen/src/type_generator.rs @@ -476,7 +476,7 @@ fn derive_method_set( }; match ref_type { Some(RefType::Immutable) => vec![immut_ref], - Some(RefType::Mutable) => vec![mut_ref], + Some(RefType::Mutable) => vec![immut_ref, mut_ref], None => vec![immut_ref, mut_ref], } } @@ -566,7 +566,7 @@ fn derive_fields_impl( }; match ref_type { Some(RefType::Immutable) => vec![immut_ref], - Some(RefType::Mutable) => vec![mut_ref], + Some(RefType::Mutable) => vec![immut_ref, mut_ref], None => vec![immut_ref, mut_ref], } })