diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index b342e4afd7..e3be20eb71 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -2106,7 +2106,7 @@ impl BeaconChain { pub async fn produce_inclusion_list( self: &Arc, request_slot: Slot, - ) -> Result>, Error> { + ) -> Result>, Error> { let execution_layer = self .execution_layer .clone() @@ -5864,6 +5864,7 @@ impl BeaconChain { ) } BeaconState::Eip7805(_) => { + tracing::error!("BeaconState::Eip7805"); let ( payload, kzg_commitments, diff --git a/beacon_node/beacon_chain/src/execution_payload.rs b/beacon_node/beacon_chain/src/execution_payload.rs index 236e8c9cb4..ac8dca3e0e 100644 --- a/beacon_node/beacon_chain/src/execution_payload.rs +++ b/beacon_node/beacon_chain/src/execution_payload.rs @@ -52,7 +52,7 @@ pub enum NotifyExecutionLayer { pub struct PayloadNotifier { pub chain: Arc>, pub block: Arc>, - pub inclusion_list_transactions: InclusionListTransactions, + pub inclusion_list_transactions: Transactions, payload_verification_status: Option, } @@ -156,7 +156,7 @@ impl PayloadNotifier { async fn notify_new_payload( chain: &Arc>, block: BeaconBlockRef<'_, T::EthSpec>, - il_transactions: InclusionListTransactions, + il_transactions: Transactions, ) -> Result { let execution_layer = chain .execution_layer @@ -165,10 +165,14 @@ async fn notify_new_payload( let execution_block_hash = block.execution_payload()?.block_hash(); - info!( - il_tx_count = il_transactions.len(), - "Submit new payload with il_transactions" - ); + // TODO(eip-7805) we can remove this later + if il_transactions.len() > 0 { + info!( + il_tx_count = il_transactions.len(), + "Submit new payload with il_transactions" + ); + } + let new_payload_response = execution_layer .notify_new_payload(NewPayloadRequest::try_from_block_and_il_transactions( block, diff --git a/beacon_node/beacon_chain/src/inclusion_list_verification.rs b/beacon_node/beacon_chain/src/inclusion_list_verification.rs index 48096d91f7..bbffe480da 100644 --- a/beacon_node/beacon_chain/src/inclusion_list_verification.rs +++ b/beacon_node/beacon_chain/src/inclusion_list_verification.rs @@ -42,26 +42,27 @@ impl GossipVerifiedInclusionList { .now() .ok_or(BeaconChainError::UnableToReadSlot)?; - if message_slot != current_slot + 1 { + if message_slot != current_slot && message_slot != current_slot - 1 { return Err(GossipInclusionListError::InvalidSlot { message_slot, current_slot, }); } - // TODO: the slot is equal to the current slot or the previous slot and the current time is + // TODO(focil): the slot is equal to the current slot or the previous slot and the current time is // not past the attestation deadline - // TODO: the IL committee root is equal to the hash tree root of the expected committee + // TODO(focil): the IL committee root is equal to the hash tree root of the expected committee - // TODO: the validator index is contained in the committee corresponding to the committee + // TODO(focil): the validator index is contained in the committee corresponding to the committee // root // the transaction length is less than or equal to the specified maximum - if signed_il.message.transactions.len() > T::EthSpec::max_transactions_per_inclusion_list() - { - return Err(GossipInclusionListError::TooManyTransactions); - } + // TODO(focil) review this + // if signed_il.message.transactions.len() > T::EthSpec::max_bytes_per_inclusion_list() + // { + // return Err(GossipInclusionListError::TooManyTransactions); + // } // TODO: the message is the first or second valid message received from the validator // corresponding to the validator index @@ -84,7 +85,10 @@ impl GossipVerifiedInclusionList { BeaconChainError::ValidatorIndexUnknown(validator_index), ))); }; - signed_il.signature.verify(&pubkey, message); + // TODO(focil) fix inclusion list verify + if !signed_il.signature.verify(&pubkey, message) { + return Err(GossipInclusionListError::InvalidSignature); + } Ok(Self { signed_il: signed_il.clone(), diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index bbf700c63b..4bea055416 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -1561,7 +1561,6 @@ where .validator_index(pubkey) .expect("should find validator index") .expect("pubkey should exist in the beacon chain"); - let sync_message = SyncCommitteeMessage::new::( message_slot, head_block_root, @@ -3162,6 +3161,7 @@ where for (_, contribution_and_proof) in sync_contributions { let signed_contribution_and_proof = contribution_and_proof.unwrap(); + println!("1"); let verified_contribution = self .chain .verify_sync_contribution_for_gossip(signed_contribution_and_proof)?; @@ -3170,6 +3170,7 @@ where } for verified_contribution in verified_contributions { + println!("2"); self.chain .add_contribution_to_block_inclusion_pool(verified_contribution)?; } @@ -3297,6 +3298,25 @@ pub fn generate_rand_block_and_blobs( message.body.blob_kzg_commitments = bundle.commitments.clone(); bundle } + SignedBeaconBlock::Eip7805(SignedBeaconBlockEip7805 { + ref mut message, .. + }) => { + // Get either zero blobs or a random number of blobs between 1 and Max Blobs. + let payload: &mut FullPayloadEip7805 = &mut message.body.execution_payload; + let num_blobs = match num_blobs { + NumBlobs::Random => rng.gen_range(1..=max_blobs), + NumBlobs::Number(n) => n, + NumBlobs::None => 0, + }; + let (bundle, transactions) = + execution_layer::test_utils::generate_blobs::(num_blobs, fork_name).unwrap(); + payload.execution_payload.transactions = <_>::default(); + for tx in Vec::from(transactions) { + payload.execution_payload.transactions.push(tx).unwrap(); + } + message.body.blob_kzg_commitments = bundle.commitments.clone(); + bundle + } SignedBeaconBlock::Fulu(SignedBeaconBlockFulu { ref mut message, .. }) => { diff --git a/beacon_node/execution_layer/src/engine_api/http.rs b/beacon_node/execution_layer/src/engine_api/http.rs index 01ef33c4b1..7457422ae9 100644 --- a/beacon_node/execution_layer/src/engine_api/http.rs +++ b/beacon_node/execution_layer/src/engine_api/http.rs @@ -42,7 +42,7 @@ pub const ENGINE_GET_PAYLOAD_V1: &str = "engine_getPayloadV1"; pub const ENGINE_GET_PAYLOAD_V2: &str = "engine_getPayloadV2"; pub const ENGINE_GET_PAYLOAD_V3: &str = "engine_getPayloadV3"; pub const ENGINE_GET_PAYLOAD_V4: &str = "engine_getPayloadV4"; -pub const ENGINE_GET_PAYLOAD_V5: &str = "engine_getPayloadV5"; +pub const ENGINE_GET_PAYLOAD_V5: &str = "engine_getPayloadV4"; pub const ENGINE_GET_PAYLOAD_TIMEOUT: Duration = Duration::from_secs(2); pub const ENGINE_FORKCHOICE_UPDATED_V1: &str = "engine_forkchoiceUpdatedV1"; @@ -1041,6 +1041,19 @@ impl HttpJsonRpc { .try_into() .map_err(Error::BadResponse) } + ForkName::Eip7805 => { + let response: JsonGetPayloadResponseV5 = self + .rpc_request( + ENGINE_GET_PAYLOAD_V4, + params, + ENGINE_GET_PAYLOAD_TIMEOUT * self.execution_timeout_multiplier, + ) + .await?; + + JsonGetPayloadResponse::V5(response) + .try_into() + .map_err(Error::BadResponse) + } _ => Err(Error::UnsupportedForkVariant(format!( "called get_payload_v4 with {}", fork_name @@ -1394,10 +1407,10 @@ impl HttpJsonRpc { } } ForkName::Eip7805 => { - if engine_capabilities.get_payload_v5 { - self.get_payload_v5(fork_name, payload_id).await + if engine_capabilities.get_payload_v4 { + self.get_payload_v4(fork_name, payload_id).await } else { - Err(Error::RequiredMethodUnsupported("engine_getPayloadv5")) + Err(Error::RequiredMethodUnsupported("engine_getPayloadv4")) } } ForkName::Fulu => { diff --git a/beacon_node/execution_layer/src/engine_api/json_structures.rs b/beacon_node/execution_layer/src/engine_api/json_structures.rs index 97305ed700..e25c15dbed 100644 --- a/beacon_node/execution_layer/src/engine_api/json_structures.rs +++ b/beacon_node/execution_layer/src/engine_api/json_structures.rs @@ -65,7 +65,7 @@ pub struct JsonPayloadIdResponse { } #[superstruct( - variants(V1, V2, V3, V4, V5), + variants(V1, V2, V3, V4, V5, V6), variant_attributes( derive(Debug, PartialEq, Default, Serialize, Deserialize,), serde(bound = "E: EthSpec", rename_all = "camelCase"), @@ -100,12 +100,12 @@ pub struct JsonExecutionPayload { pub block_hash: ExecutionBlockHash, #[serde(with = "ssz_types::serde_utils::list_of_hex_var_list")] pub transactions: Transactions, - #[superstruct(only(V2, V3, V4, V5))] + #[superstruct(only(V2, V3, V4, V5, V6))] pub withdrawals: VariableList, - #[superstruct(only(V3, V4, V5))] + #[superstruct(only(V3, V4, V5, V6))] #[serde(with = "serde_utils::u64_hex_be")] pub blob_gas_used: u64, - #[superstruct(only(V3, V4, V5))] + #[superstruct(only(V3, V4, V5, V6))] #[serde(with = "serde_utils::u64_hex_be")] pub excess_blob_gas: u64, } @@ -243,6 +243,35 @@ impl From> for JsonExecutionPayloadV5 } } +impl From> for JsonExecutionPayloadV6 { + fn from(payload: ExecutionPayloadFulu) -> Self { + JsonExecutionPayloadV6 { + parent_hash: payload.parent_hash, + fee_recipient: payload.fee_recipient, + state_root: payload.state_root, + receipts_root: payload.receipts_root, + logs_bloom: payload.logs_bloom, + prev_randao: payload.prev_randao, + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: payload.extra_data, + base_fee_per_gas: payload.base_fee_per_gas, + block_hash: payload.block_hash, + transactions: payload.transactions, + withdrawals: payload + .withdrawals + .into_iter() + .map(Into::into) + .collect::>() + .into(), + blob_gas_used: payload.blob_gas_used, + excess_blob_gas: payload.excess_blob_gas, + } + } +} + impl From> for JsonExecutionPayload { fn from(execution_payload: ExecutionPayload) -> Self { match execution_payload { @@ -251,7 +280,7 @@ impl From> for JsonExecutionPayload { ExecutionPayload::Deneb(payload) => JsonExecutionPayload::V3(payload.into()), ExecutionPayload::Electra(payload) => JsonExecutionPayload::V4(payload.into()), ExecutionPayload::Eip7805(payload) => JsonExecutionPayload::V5(payload.into()), - ExecutionPayload::Fulu(_) => unreachable!("DONT USE FULU"), + ExecutionPayload::Fulu(payload) => JsonExecutionPayload::V6(payload.into()), } } } @@ -390,6 +419,35 @@ impl From> for ExecutionPayloadEip7805 } } +impl From> for ExecutionPayloadFulu { + fn from(payload: JsonExecutionPayloadV6) -> Self { + ExecutionPayloadFulu { + parent_hash: payload.parent_hash, + fee_recipient: payload.fee_recipient, + state_root: payload.state_root, + receipts_root: payload.receipts_root, + logs_bloom: payload.logs_bloom, + prev_randao: payload.prev_randao, + block_number: payload.block_number, + gas_limit: payload.gas_limit, + gas_used: payload.gas_used, + timestamp: payload.timestamp, + extra_data: payload.extra_data, + base_fee_per_gas: payload.base_fee_per_gas, + block_hash: payload.block_hash, + transactions: payload.transactions, + withdrawals: payload + .withdrawals + .into_iter() + .map(Into::into) + .collect::>() + .into(), + blob_gas_used: payload.blob_gas_used, + excess_blob_gas: payload.excess_blob_gas, + } + } +} + impl From> for ExecutionPayload { fn from(json_execution_payload: JsonExecutionPayload) -> Self { match json_execution_payload { @@ -398,6 +456,7 @@ impl From> for ExecutionPayload { JsonExecutionPayload::V3(payload) => ExecutionPayload::Deneb(payload.into()), JsonExecutionPayload::V4(payload) => ExecutionPayload::Electra(payload.into()), JsonExecutionPayload::V5(payload) => ExecutionPayload::Eip7805(payload.into()), + JsonExecutionPayload::V6(payload) => ExecutionPayload::Fulu(payload.into()), } } } @@ -483,7 +542,7 @@ impl TryFrom for ExecutionRequests { } #[superstruct( - variants(V1, V2, V3, V4, V5), + variants(V1, V2, V3, V4, V5, V6), variant_attributes( derive(Debug, PartialEq, Serialize, Deserialize), serde(bound = "E: EthSpec", rename_all = "camelCase") @@ -504,13 +563,15 @@ pub struct JsonGetPayloadResponse { pub execution_payload: JsonExecutionPayloadV4, #[superstruct(only(V5), partial_getter(rename = "execution_payload_v5"))] pub execution_payload: JsonExecutionPayloadV5, + #[superstruct(only(V6), partial_getter(rename = "execution_payload_v6"))] + pub execution_payload: JsonExecutionPayloadV6, #[serde(with = "serde_utils::u256_hex_be")] pub block_value: Uint256, - #[superstruct(only(V3, V4, V5))] + #[superstruct(only(V3, V4, V5, V6))] pub blobs_bundle: JsonBlobsBundleV1, - #[superstruct(only(V3, V4, V5))] + #[superstruct(only(V3, V4, V5, V6))] pub should_override_builder: bool, - #[superstruct(only(V4, V5))] + #[superstruct(only(V4, V5, V6))] pub execution_requests: JsonExecutionRequests, } @@ -560,6 +621,17 @@ impl TryFrom> for GetPayloadResponse { })?, })) } + JsonGetPayloadResponse::V6(response) => { + Ok(GetPayloadResponse::Fulu(GetPayloadResponseFulu { + execution_payload: response.execution_payload.into(), + block_value: response.block_value, + blobs_bundle: response.blobs_bundle.into(), + should_override_builder: response.should_override_builder, + requests: response.execution_requests.try_into().map_err(|e| { + format!("Failed to convert json to execution requests {:?}", e) + })?, + })) + } } } } diff --git a/beacon_node/execution_layer/src/engine_api/new_payload_request.rs b/beacon_node/execution_layer/src/engine_api/new_payload_request.rs index c286dacda2..53b4627b5a 100644 --- a/beacon_node/execution_layer/src/engine_api/new_payload_request.rs +++ b/beacon_node/execution_layer/src/engine_api/new_payload_request.rs @@ -1,11 +1,11 @@ -use crate::{block_hash::calculate_execution_block_hash, metrics, Error}; +use crate::{block_hash::calculate_execution_block_hash, metrics, Error, Transactions}; use crate::versioned_hashes::verify_versioned_hashes; use state_processing::per_block_processing::deneb::kzg_commitment_to_versioned_hash; use superstruct::superstruct; use types::{ BeaconBlockRef, BeaconStateError, EthSpec, ExecutionBlockHash, ExecutionPayload, - ExecutionPayloadRef, Hash256, InclusionListTransactions, VersionedHash, + ExecutionPayloadRef, Hash256, VersionedHash, }; use types::{ ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadDeneb, @@ -50,7 +50,7 @@ pub struct NewPayloadRequest<'block, E: EthSpec> { #[superstruct(only(Electra, Eip7805, Fulu))] pub execution_requests: &'block ExecutionRequests, #[superstruct(only(Eip7805, Fulu))] - pub il_transactions: InclusionListTransactions, + pub il_transactions: Transactions, } impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { @@ -177,7 +177,7 @@ impl<'block, E: EthSpec> NewPayloadRequest<'block, E> { impl<'a, E: EthSpec> NewPayloadRequest<'a, E> { pub fn try_from_block_and_il_transactions( block: BeaconBlockRef<'a, E>, - il_transactions: InclusionListTransactions, + il_transactions: Transactions, ) -> Result { match block { BeaconBlockRef::Base(_) | BeaconBlockRef::Altair(_) => { diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index 4ad453934f..e0a2efcc56 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -56,8 +56,7 @@ use types::{ use types::{ BeaconStateError, BlindedPayload, ChainSpec, Epoch, ExecPayload, ExecutionPayloadBellatrix, ExecutionPayloadCapella, ExecutionPayloadEip7805, ExecutionPayloadElectra, - ExecutionPayloadFulu, FullPayload, InclusionListTransactions, ProposerPreparationData, - PublicKeyBytes, Signature, Slot, + ExecutionPayloadFulu, FullPayload, ProposerPreparationData, PublicKeyBytes, Signature, Slot, }; mod block_hash; @@ -1983,17 +1982,14 @@ impl ExecutionLayer { } } - pub async fn get_inclusion_list( - &self, - parent_hash: Hash256, - ) -> Result, Error> { + pub async fn get_inclusion_list(&self, parent_hash: Hash256) -> Result, Error> { debug!(%parent_hash, "Requesting inclusion list from EL"); let raw_transactions = self .engine() .api .get_inclusion_list::(parent_hash) .await?; - // TODO(focil) clean this up? + let mut transactions = vec![]; let Some(raw_transactions) = raw_transactions else { diff --git a/beacon_node/execution_layer/src/test_utils/handle_rpc.rs b/beacon_node/execution_layer/src/test_utils/handle_rpc.rs index 7255145c62..24c83f3cf9 100644 --- a/beacon_node/execution_layer/src/test_utils/handle_rpc.rs +++ b/beacon_node/execution_layer/src/test_utils/handle_rpc.rs @@ -3,11 +3,10 @@ use crate::engine_api::{http::*, *}; use crate::json_structures::*; use crate::test_utils::{DEFAULT_CLIENT_VERSION, DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI}; use crate::EthersTransaction; +use crate::Transactions; use serde::{de::DeserializeOwned, Deserialize}; use serde_json::Value as JsonValue; -use ssz_types::VariableList; use std::sync::Arc; -use types::InclusionListTransactions; pub const GENERIC_ERROR_CODE: i64 = -1234; pub const BAD_PARAMS_ERROR_CODE: i64 = -32602; @@ -128,6 +127,9 @@ pub async fn handle_rpc( ENGINE_NEW_PAYLOAD_V5 => get_param::>(params, 0) .map(|jep| JsonExecutionPayload::V5(jep)) .map_err(|s| (s, BAD_PARAMS_ERROR_CODE))?, + ENGINE_NEW_PAYLOAD_V5 => get_param::>(params, 0) + .map(|jep| JsonExecutionPayload::V5(jep)) + .map_err(|s| (s, BAD_PARAMS_ERROR_CODE))?, _ => unreachable!(), }; @@ -251,7 +253,7 @@ pub async fn handle_rpc( if matches!(request, JsonExecutionPayload::V2(_)) { return Err(( format!( - "{} called with `ExecutionPayloadV2` after Electra fork!", + "{} called with `ExecutionPayloadV2` after Eip7805 fork!", method ), GENERIC_ERROR_CODE, @@ -260,7 +262,7 @@ pub async fn handle_rpc( if matches!(request, JsonExecutionPayload::V3(_)) { return Err(( format!( - "{} called with `ExecutionPayloadV3` after Electra fork!", + "{} called with `ExecutionPayloadV3` after Eip7805 fork!", method ), GENERIC_ERROR_CODE, @@ -355,8 +357,7 @@ pub async fn handle_rpc( ENGINE_GET_PAYLOAD_V1 | ENGINE_GET_PAYLOAD_V2 | ENGINE_GET_PAYLOAD_V3 - | ENGINE_GET_PAYLOAD_V4 - | ENGINE_GET_PAYLOAD_V5 => { + | ENGINE_GET_PAYLOAD_V4 => { let request: JsonPayloadIdRequest = get_param(params, 0).map_err(|s| (s, BAD_PARAMS_ERROR_CODE))?; let id = request.into(); @@ -416,6 +417,22 @@ pub async fn handle_rpc( )); } + // validate method called correctly according to prague fork time + if ctx + .execution_block_generator + .read() + .get_fork_at_timestamp(response.timestamp()) + == ForkName::Eip7805 + && (method == ENGINE_GET_PAYLOAD_V1 + || method == ENGINE_GET_PAYLOAD_V2 + || method == ENGINE_GET_PAYLOAD_V3) + { + return Err(( + format!("{} called after EIP7805 fork!", method), + FORK_REQUEST_MISMATCH_ERROR_CODE, + )); + } + // validate method called correctly according to fulu fork time if ctx .execution_block_generator @@ -424,8 +441,7 @@ pub async fn handle_rpc( == ForkName::Fulu && (method == ENGINE_GET_PAYLOAD_V1 || method == ENGINE_GET_PAYLOAD_V2 - || method == ENGINE_GET_PAYLOAD_V3 - || method == ENGINE_GET_PAYLOAD_V4) + || method == ENGINE_GET_PAYLOAD_V3) { return Err(( format!("{} called after Fulu fork!", method), @@ -491,9 +507,6 @@ pub async fn handle_rpc( }) .unwrap() } - _ => unreachable!(), - }), - ENGINE_GET_PAYLOAD_V5 => Ok(match JsonExecutionPayload::from(response) { JsonExecutionPayload::V5(execution_payload) => { serde_json::to_value(JsonGetPayloadResponseV5 { execution_payload, @@ -505,17 +518,18 @@ pub async fn handle_rpc( ))? .into(), should_override_builder: false, + // TODO(electra): add EL requests in mock el execution_requests: Default::default(), }) .unwrap() } - JsonExecutionPayload::V4(execution_payload) => { - serde_json::to_value(JsonGetPayloadResponseV4 { + JsonExecutionPayload::V6(execution_payload) => { + serde_json::to_value(JsonGetPayloadResponseV6 { execution_payload, block_value: Uint256::from(DEFAULT_MOCK_EL_PAYLOAD_VALUE_WEI), blobs_bundle: maybe_blobs .ok_or(( - "No blobs returned despite V4 Payload".to_string(), + "No blobs returned despite V5 Payload".to_string(), GENERIC_ERROR_CODE, ))? .into(), @@ -525,7 +539,7 @@ pub async fn handle_rpc( }) .unwrap() } - other => unreachable!("check {:?}", other), + _ => unreachable!(), }), _ => unreachable!(), } @@ -747,11 +761,7 @@ pub async fn handle_rpc( }"#, ) .unwrap(); - let tx_list: InclusionListTransactions = - vec![VariableList::new(transaction.rlp().to_vec()) - .map_err(|e| format!("Failed to convert transaction to SSZ: {:?}", e)) - .unwrap()] - .into(); + let tx_list: Transactions = vec![transaction.rlp().to_vec().into()].into(); Ok(serde_json::to_value(tx_list).unwrap()) } diff --git a/beacon_node/http_api/src/publish_inclusion_lists.rs b/beacon_node/http_api/src/publish_inclusion_lists.rs index 0ae7aa78e1..d0330ff164 100644 --- a/beacon_node/http_api/src/publish_inclusion_lists.rs +++ b/beacon_node/http_api/src/publish_inclusion_lists.rs @@ -135,7 +135,7 @@ pub async fn publish_inclusion_lists( request_index = index, validator_index, il_slot = ?slot, - "Failure verifying attestation for gossip" + "Failure verifying inclusion list for gossip" ); failures.push(Failure::new(index, format!("{e:?}"))); } else { diff --git a/beacon_node/http_api/tests/interactive_tests.rs b/beacon_node/http_api/tests/interactive_tests.rs index 4f3cd6c828..9f6935461b 100644 --- a/beacon_node/http_api/tests/interactive_tests.rs +++ b/beacon_node/http_api/tests/interactive_tests.rs @@ -58,7 +58,7 @@ async fn state_by_root_pruned_from_fork_choice() { type E = MinimalEthSpec; let validator_count = 24; - let spec = ForkName::latest().make_genesis_spec(E::default_spec()); + let spec = ForkName::Eip7805.make_genesis_spec(E::default_spec()); let tester = InteractiveTester::::new_with_initializer_and_mutator( Some(spec.clone()), @@ -396,7 +396,7 @@ pub async fn proposer_boost_re_org_test( assert!(head_slot > 0); // Test using the latest fork so that we simulate conditions as similar to mainnet as possible. - let mut spec = ForkName::latest().make_genesis_spec(E::default_spec()); + let mut spec = ForkName::Eip7805.make_genesis_spec(E::default_spec()); spec.terminal_total_difficulty = Uint256::from(1); // Ensure there are enough validators to have `attesters_per_slot`. diff --git a/beacon_node/http_api/tests/status_tests.rs b/beacon_node/http_api/tests/status_tests.rs index dd481f23ba..b8a42ce2cc 100644 --- a/beacon_node/http_api/tests/status_tests.rs +++ b/beacon_node/http_api/tests/status_tests.rs @@ -13,7 +13,7 @@ type E = MinimalEthSpec; /// Create a new test environment that is post-merge with `chain_depth` blocks. async fn post_merge_tester(chain_depth: u64, validator_count: u64) -> InteractiveTester { // Test using latest fork so that we simulate conditions as similar to mainnet as possible. - let mut spec = ForkName::latest().make_genesis_spec(E::default_spec()); + let mut spec = ForkName::Eip7805.make_genesis_spec(E::default_spec()); spec.terminal_total_difficulty = Uint256::from(1); let tester = InteractiveTester::::new(Some(spec), validator_count as usize).await; diff --git a/beacon_node/http_api/tests/tests.rs b/beacon_node/http_api/tests/tests.rs index c97fec5a06..89dfff0b57 100644 --- a/beacon_node/http_api/tests/tests.rs +++ b/beacon_node/http_api/tests/tests.rs @@ -2837,6 +2837,7 @@ impl ApiTester { pub async fn test_post_validator_duties_inclusion_list(self) -> Self { let current_epoch = self.chain.epoch().unwrap(); + let state = self.harness.get_current_state(); let slot = self.chain.slot().unwrap(); self.harness.extend_to_slot(slot).await; for validator_indices in self.interesting_validator_indices() { @@ -2845,7 +2846,6 @@ impl ApiTester { .post_validator_duties_inclusion_list(current_epoch, &validator_indices) .await .unwrap(); - println!("{:?}", res) } self } @@ -6252,14 +6252,15 @@ impl ApiTester { let state = self.chain.head_beacon_state_cloned(); let slot = self.harness.chain.slot().unwrap(); self.harness.extend_to_slot(slot).await; + println!("1"); let inclusion_list_committee = state .get_inclusion_list_committee(slot + 1, &self.chain.spec) .unwrap(); - + println!("2"); self.harness .make_signed_inclusion_lists(inclusion_list_committee, &state, slot + 1) .await; - + println!("3"); self } diff --git a/beacon_node/lighthouse_network/src/types/topics.rs b/beacon_node/lighthouse_network/src/types/topics.rs index 31158fb1c5..394c7e79aa 100644 --- a/beacon_node/lighthouse_network/src/types/topics.rs +++ b/beacon_node/lighthouse_network/src/types/topics.rs @@ -80,7 +80,7 @@ pub fn core_topics_to_subscribe( } } - if fork_name.electra_enabled() { + if fork_name.eip7805_enabled() { topics.push(GossipKind::InclusionList); } diff --git a/common/eth2/src/lib.rs b/common/eth2/src/lib.rs index c1ec41d19c..323f548eea 100644 --- a/common/eth2/src/lib.rs +++ b/common/eth2/src/lib.rs @@ -2612,7 +2612,7 @@ impl BeaconNodeHttpClient { pub async fn get_validator_inclusion_list( &self, slot: Slot, - ) -> Result>>, Error> { + ) -> Result>>, Error> { let mut path = self.eth_path(V1)?; path.path_segments_mut() diff --git a/common/eth2/src/types.rs b/common/eth2/src/types.rs index db850bdd84..ddb0c8ee24 100644 --- a/common/eth2/src/types.rs +++ b/common/eth2/src/types.rs @@ -2342,6 +2342,9 @@ mod test { ExecutionPayload::Electra(ExecutionPayloadElectra::::random_for_test( rng, )), + ExecutionPayload::Eip7805(ExecutionPayloadEip7805::::random_for_test( + rng, + )), ExecutionPayload::Fulu(ExecutionPayloadFulu::::random_for_test(rng)), ]; let merged_forks = &ForkName::list_all()[2..]; @@ -2386,6 +2389,17 @@ mod test { blobs_bundle, } }, + { + let execution_payload = + ExecutionPayload::Eip7805( + ExecutionPayloadEip7805::::random_for_test(rng), + ); + let blobs_bundle = BlobsBundle::random_for_test(rng); + ExecutionPayloadAndBlobs { + execution_payload, + blobs_bundle, + } + }, { let execution_payload = ExecutionPayload::Fulu( diff --git a/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml b/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml index b02ecf2c49..2158f97c09 100644 --- a/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml +++ b/common/eth2_network_config/built_in_network_configs/gnosis/config.yaml @@ -48,7 +48,7 @@ ELECTRA_FORK_EPOCH: 1337856 # 2025-04-30T14:03:40.000Z EIP7805_FORK_VERSION: 0x06000000 EIP7805_FORK_EPOCH: 18446744073709551615 # Fulu -FULU_FORK_VERSION: 0x06000064 +FULU_FORK_VERSION: 0x07000000 FULU_FORK_EPOCH: 18446744073709551615 # Time parameters diff --git a/common/eth2_network_config/built_in_network_configs/mainnet/config.yaml b/common/eth2_network_config/built_in_network_configs/mainnet/config.yaml index 85a662bc07..88a8773b3a 100644 --- a/common/eth2_network_config/built_in_network_configs/mainnet/config.yaml +++ b/common/eth2_network_config/built_in_network_configs/mainnet/config.yaml @@ -54,7 +54,7 @@ ELECTRA_FORK_EPOCH: 364032 # May 7, 2025, 10:05:11am UTC EIP7805_FORK_VERSION: 0x06000000 EIP7805_FORK_EPOCH: 18446744073709551615 # Fulu -FULU_FORK_VERSION: 0x06000000 +FULU_FORK_VERSION: 0x07000000 FULU_FORK_EPOCH: 18446744073709551615 # Time parameters @@ -162,3 +162,12 @@ DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 SAMPLES_PER_SLOT: 8 CUSTODY_REQUIREMENT: 4 MAX_BLOBS_PER_BLOCK_FULU: 12 + +# EIP 7805 +ATTESTATION_DEADLINE: 4 +PROPOSER_INCLUSION_LIST_CUT_OFF: 11 +VIEW_FREEZE_DEADLINE: 9 +# 2**4 (= 16) +MAX_REQUEST_INCLUSION_LIST: 16 +# 2**13 (= 8192) +MAX_BYTES_PER_INCLUSION_LIST: 8192 \ No newline at end of file diff --git a/consensus/state_processing/src/genesis.rs b/consensus/state_processing/src/genesis.rs index ebeb798b7d..9c9e183be8 100644 --- a/consensus/state_processing/src/genesis.rs +++ b/consensus/state_processing/src/genesis.rs @@ -2,10 +2,10 @@ use super::per_block_processing::{ errors::BlockProcessingError, process_operations::apply_deposit, }; use crate::common::DepositDataTree; -use crate::upgrade::eip7805::upgrade_state_to_eip7805; use crate::upgrade::electra::upgrade_state_to_electra; use crate::upgrade::{ - upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb, upgrade_to_fulu, + upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb, + upgrade_to_eip7805, upgrade_to_fulu, }; use safe_arith::{ArithError, SafeArith}; use std::sync::Arc; @@ -145,24 +145,12 @@ pub fn initialize_beacon_state_from_eth1( .eip7805_fork_epoch .is_some_and(|fork_epoch| fork_epoch == E::genesis_epoch()) { - let post = upgrade_state_to_eip7805(&mut state, Epoch::new(0), Epoch::new(0), spec)?; - state = post; + upgrade_to_eip7805(&mut state, spec)?; - // Remove intermediate Deneb fork from `state.fork`. - state.fork_mut().previous_version = spec.electra_fork_version; - - // TODO(electra): think about this more and determine the best way to - // do this. The spec tests will expect that the sync committees are - // calculated using the electra value for MAX_EFFECTIVE_BALANCE when - // calling `initialize_beacon_state_from_eth1()`. But the sync committees - // are actually calcuated back in `upgrade_to_altair()`. We need to - // re-calculate the sync committees here now that the state is `Electra` - let sync_committee = Arc::new(state.get_next_sync_committee(spec)?); - *state.current_sync_committee_mut()? = sync_committee.clone(); - *state.next_sync_committee_mut()? = sync_committee; + // Remove intermediate Electra fork from `state.fork`. + state.fork_mut().previous_version = spec.eip7805_fork_version; // Override latest execution payload header. - // See https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#testing if let Some(ExecutionPayloadHeader::Eip7805(ref header)) = execution_payload_header { *state.latest_execution_payload_header_eip7805_mut()? = header.clone(); } diff --git a/consensus/state_processing/src/per_slot_processing.rs b/consensus/state_processing/src/per_slot_processing.rs index e5091db179..7dae5fcbb6 100644 --- a/consensus/state_processing/src/per_slot_processing.rs +++ b/consensus/state_processing/src/per_slot_processing.rs @@ -74,7 +74,6 @@ pub fn per_slot_processing( if spec.eip7805_fork_epoch == Some(state.current_epoch()) { upgrade_to_eip7805(state, spec)?; } - // Fulu. if spec.fulu_fork_epoch == Some(state.current_epoch()) { upgrade_to_fulu(state, spec)?; diff --git a/consensus/state_processing/src/upgrade/eip7805.rs b/consensus/state_processing/src/upgrade/eip7805.rs index 164cca3930..a40c1fbbe7 100644 --- a/consensus/state_processing/src/upgrade/eip7805.rs +++ b/consensus/state_processing/src/upgrade/eip7805.rs @@ -1,91 +1,14 @@ -use bls::Signature; -use itertools::Itertools; -use safe_arith::SafeArith; use std::mem; -use types::{ - BeaconState, BeaconStateEip7805, BeaconStateError as Error, ChainSpec, Epoch, EpochCache, - EthSpec, Fork, PendingDeposit, -}; +use types::{BeaconState, BeaconStateEip7805, BeaconStateError as Error, ChainSpec, EthSpec, Fork}; /// Transform a `Electra` state into an `Eip7805s` state. pub fn upgrade_to_eip7805( pre_state: &mut BeaconState, spec: &ChainSpec, ) -> Result<(), Error> { - let epoch = pre_state.current_epoch(); + let _epoch = pre_state.current_epoch(); - let activation_exit_epoch = spec.compute_activation_exit_epoch(epoch)?; - let earliest_exit_epoch = pre_state - .validators() - .iter() - .filter(|v| v.exit_epoch != spec.far_future_epoch) - .map(|v| v.exit_epoch) - .max() - .unwrap_or(activation_exit_epoch) - .max(activation_exit_epoch) - .safe_add(1)?; - - // The total active balance cache must be built before the consolidation churn limit - // is calculated. - pre_state.build_total_active_balance_cache(spec)?; - let earliest_consolidation_epoch = spec.compute_activation_exit_epoch(epoch)?; - - let mut post = upgrade_state_to_eip7805( - pre_state, - earliest_exit_epoch, - earliest_consolidation_epoch, - spec, - )?; - - *post.exit_balance_to_consume_mut()? = post.get_activation_exit_churn_limit(spec)?; - *post.consolidation_balance_to_consume_mut()? = post.get_consolidation_churn_limit(spec)?; - - // Add validators that are not yet active to pending balance deposits - let validators = post.validators().clone(); - let pre_activation = validators - .iter() - .enumerate() - .filter(|(_, validator)| validator.activation_epoch == spec.far_future_epoch) - .sorted_by_key(|(index, validator)| (validator.activation_eligibility_epoch, *index)) - .map(|(index, _)| index) - .collect::>(); - - // Process validators to queue entire balance and reset them - for index in pre_activation { - let balance = post - .balances_mut() - .get_mut(index) - .ok_or(Error::UnknownValidator(index))?; - let balance_copy = *balance; - *balance = 0_u64; - - let validator = post - .validators_mut() - .get_mut(index) - .ok_or(Error::UnknownValidator(index))?; - validator.effective_balance = 0; - validator.activation_eligibility_epoch = spec.far_future_epoch; - let pubkey = validator.pubkey; - let withdrawal_credentials = validator.withdrawal_credentials; - - post.pending_deposits_mut()? - .push(PendingDeposit { - pubkey, - withdrawal_credentials, - amount: balance_copy, - signature: Signature::infinity()?.into(), - slot: spec.genesis_slot, - }) - .map_err(Error::MilhouseError)?; - } - - // Ensure early adopters of compounding credentials go through the activation churn - let validators = post.validators().clone(); - for (index, validator) in validators.iter().enumerate() { - if validator.has_compounding_withdrawal_credential(spec) { - post.queue_excess_active_balance(index, spec)?; - } - } + let post = upgrade_state_to_eip7805(pre_state, spec)?; *pre_state = post; @@ -94,8 +17,6 @@ pub fn upgrade_to_eip7805( pub fn upgrade_state_to_eip7805( pre_state: &mut BeaconState, - earliest_exit_epoch: Epoch, - earliest_consolidation_epoch: Epoch, spec: &ChainSpec, ) -> Result, Error> { let epoch = pre_state.current_epoch(); @@ -112,7 +33,7 @@ pub fn upgrade_state_to_eip7805( slot: pre.slot, fork: Fork { previous_version: pre.fork.current_version, - current_version: spec.electra_fork_version, + current_version: spec.eip7805_fork_version, epoch, }, // History @@ -151,15 +72,15 @@ pub fn upgrade_state_to_eip7805( next_withdrawal_validator_index: pre.next_withdrawal_validator_index, historical_summaries: pre.historical_summaries.clone(), // Electra - deposit_requests_start_index: spec.unset_deposit_requests_start_index, - deposit_balance_to_consume: 0, - exit_balance_to_consume: 0, - earliest_exit_epoch, - consolidation_balance_to_consume: 0, - earliest_consolidation_epoch, - pending_deposits: Default::default(), - pending_partial_withdrawals: Default::default(), - pending_consolidations: Default::default(), + deposit_requests_start_index: pre.deposit_requests_start_index, + deposit_balance_to_consume: pre.deposit_balance_to_consume, + exit_balance_to_consume: pre.exit_balance_to_consume, + earliest_exit_epoch: pre.earliest_exit_epoch, + consolidation_balance_to_consume: pre.consolidation_balance_to_consume, + earliest_consolidation_epoch: pre.earliest_consolidation_epoch, + pending_deposits: pre.pending_deposits.clone(), + pending_partial_withdrawals: pre.pending_partial_withdrawals.clone(), + pending_consolidations: pre.pending_consolidations.clone(), // Caches total_active_balance: pre.total_active_balance, progressive_balances_cache: mem::take(&mut pre.progressive_balances_cache), @@ -167,7 +88,7 @@ pub fn upgrade_state_to_eip7805( pubkey_cache: mem::take(&mut pre.pubkey_cache), exit_cache: mem::take(&mut pre.exit_cache), slashings_cache: mem::take(&mut pre.slashings_cache), - epoch_cache: EpochCache::default(), + epoch_cache: mem::take(&mut pre.epoch_cache), }); Ok(post) } diff --git a/consensus/types/src/beacon_state/inclusion_list_cache.rs b/consensus/types/src/beacon_state/inclusion_list_cache.rs index 49ff673cb2..a096f532d6 100644 --- a/consensus/types/src/beacon_state/inclusion_list_cache.rs +++ b/consensus/types/src/beacon_state/inclusion_list_cache.rs @@ -1,4 +1,6 @@ -use super::{EthSpec, InclusionListTransactions, SignedInclusionList, Slot, Transaction}; +use crate::Transactions; + +use super::{EthSpec, SignedInclusionList, Slot, Transaction}; use std::collections::{HashMap, HashSet}; use tracing::debug; @@ -81,10 +83,7 @@ impl InclusionListCache { ); } - pub fn get_inclusion_list_transactions( - &self, - slot: Slot, - ) -> Option> { + pub fn get_inclusion_list_transactions(&self, slot: Slot) -> Option> { let Some(inner) = self.inner_map.get(&slot) else { return None; }; diff --git a/consensus/types/src/builder_bid.rs b/consensus/types/src/builder_bid.rs index 29e07895d4..775902f78f 100644 --- a/consensus/types/src/builder_bid.rs +++ b/consensus/types/src/builder_bid.rs @@ -1,10 +1,11 @@ use crate::beacon_block_body::KzgCommitments; +use crate::test_utils::TestRandom; use crate::{ ChainSpec, ContextDeserialize, EthSpec, ExecutionPayloadHeaderBellatrix, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderEip7805, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderFulu, ExecutionPayloadHeaderRef, - ExecutionPayloadHeaderRefMut, ExecutionRequests, ForkName, ForkVersionDecode, - SignedRoot, Uint256, + ExecutionPayloadHeaderRefMut, ExecutionRequests, ForkName, ForkVersionDecode, SignedRoot, + Uint256, }; use bls::PublicKeyBytes; use bls::Signature; @@ -12,7 +13,6 @@ use serde::{Deserialize, Deserializer, Serialize}; use ssz::Decode; use ssz_derive::{Decode, Encode}; use superstruct::superstruct; -use crate::test_utils::TestRandom; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index f7797da9f2..2020244d59 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -983,7 +983,7 @@ impl ChainSpec { /* * Fulu hard fork params */ - fulu_fork_version: [0x06, 0x00, 0x00, 0x00], + fulu_fork_version: [0x07, 0x00, 0x00, 0x00], fulu_fork_epoch: None, custody_requirement: 4, number_of_custody_groups: 128, @@ -1113,7 +1113,7 @@ impl ChainSpec { eip7805_fork_epoch: None, eip7805_fork_version: [0x06, 0x00, 0x00, 0x00], // Fulu - fulu_fork_version: [0x06, 0x00, 0x00, 0x01], + fulu_fork_version: [0x07, 0x00, 0x00, 0x00], fulu_fork_epoch: None, // Other network_id: 2, // lighthouse testnet network id @@ -1328,7 +1328,7 @@ impl ChainSpec { /* * Fulu hard fork params */ - fulu_fork_version: [0x06, 0x00, 0x00, 0x64], + fulu_fork_version: [0x07, 0x00, 0x00, 0x00], fulu_fork_epoch: None, custody_requirement: 4, number_of_custody_groups: 128, diff --git a/consensus/types/src/config_and_preset.rs b/consensus/types/src/config_and_preset.rs index 0533db79c6..fd37cfd7c4 100644 --- a/consensus/types/src/config_and_preset.rs +++ b/consensus/types/src/config_and_preset.rs @@ -1,6 +1,6 @@ use crate::{ consts::altair, consts::deneb, AltairPreset, BasePreset, BellatrixPreset, CapellaPreset, - ChainSpec, Config, DenebPreset, ElectraPreset, EthSpec, ForkName, FuluPreset, + ChainSpec, Config, DenebPreset, Eip7805Preset, ElectraPreset, EthSpec, ForkName, FuluPreset, }; use maplit::hashmap; use serde::{Deserialize, Serialize}; @@ -34,6 +34,9 @@ pub struct ConfigAndPreset { #[superstruct(only(Electra, Eip7805, Fulu))] #[serde(flatten)] pub electra_preset: ElectraPreset, + #[superstruct(only(Eip7805, Fulu))] + #[serde(flatten)] + pub eip7805_preset: Eip7805Preset, #[superstruct(only(Fulu))] #[serde(flatten)] pub fulu_preset: FuluPreset, @@ -58,6 +61,7 @@ impl ConfigAndPreset { || fork_name == Some(ForkName::Fulu) { let electra_preset = ElectraPreset::from_chain_spec::(spec); + let eip7805_preset = Eip7805Preset::from_chain_spec::(spec); let fulu_preset = FuluPreset::from_chain_spec::(spec); ConfigAndPreset::Fulu(ConfigAndPresetFulu { @@ -68,9 +72,28 @@ impl ConfigAndPreset { capella_preset, deneb_preset, electra_preset, + eip7805_preset, fulu_preset, extra_fields, }) + } else if spec.electra_fork_epoch.is_some() + || fork_name.is_none() + || fork_name == Some(ForkName::Eip7805) + { + let electra_preset = ElectraPreset::from_chain_spec::(spec); + let eip7805_preset = Eip7805Preset::from_chain_spec::(spec); + + ConfigAndPreset::Eip7805(ConfigAndPresetEip7805 { + config, + base_preset, + altair_preset, + bellatrix_preset, + capella_preset, + deneb_preset, + electra_preset, + eip7805_preset, + extra_fields, + }) } else if spec.electra_fork_epoch.is_some() || fork_name.is_none() || fork_name == Some(ForkName::Electra) diff --git a/consensus/types/src/inclusion_list.rs b/consensus/types/src/inclusion_list.rs index 8ee55f0ee7..226f48c13a 100644 --- a/consensus/types/src/inclusion_list.rs +++ b/consensus/types/src/inclusion_list.rs @@ -1,18 +1,12 @@ use crate::test_utils::TestRandom; -use crate::{EthSpec, Hash256, Signature, SignedRoot, Slot, Transaction}; +use crate::{EthSpec, Hash256, Signature, SignedRoot, Slot, Transactions}; use derivative::Derivative; use serde::{Deserialize, Serialize}; use ssz_derive::{Decode, Encode}; -use ssz_types::VariableList; use test_random_derive::TestRandom; use tree_hash_derive::TreeHash; -pub type InclusionListTransactions = VariableList< - Transaction<::MaxBytesPerTransaction>, - ::MaxTransactionsPerInclusionList, ->; - #[derive( Debug, Clone, @@ -33,7 +27,7 @@ pub struct InclusionList { #[serde(with = "serde_utils::quoted_u64")] pub validator_index: u64, pub inclusion_list_committee_root: Hash256, - pub transactions: InclusionListTransactions, + pub transactions: Transactions, } impl SignedRoot for InclusionList {} diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 60a3cafa8e..33586da28a 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -186,7 +186,7 @@ pub use crate::fork_data::ForkData; pub use crate::fork_name::{ForkName, InconsistentFork}; pub use crate::graffiti::{Graffiti, GRAFFITI_BYTES_LEN}; pub use crate::historical_batch::HistoricalBatch; -pub use crate::inclusion_list::{InclusionList, InclusionListTransactions, SignedInclusionList}; +pub use crate::inclusion_list::{InclusionList, SignedInclusionList}; pub use crate::inclusion_list_committee::InclusionListCommittee; pub use crate::inclusion_list_duty::InclusionListDuty; pub use crate::indexed_attestation::{ diff --git a/consensus/types/src/light_client_bootstrap.rs b/consensus/types/src/light_client_bootstrap.rs index 60b1dd9209..0f62b3b32f 100644 --- a/consensus/types/src/light_client_bootstrap.rs +++ b/consensus/types/src/light_client_bootstrap.rs @@ -245,7 +245,7 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for LightClientBootstrap ForkName::Deneb => { Self::Deneb(Deserialize::deserialize(deserializer).map_err(convert_err)?) } - ForkName::Electra | ForkName::Eip7805 => { + ForkName::Electra | ForkName::Eip7805 => { Self::Electra(Deserialize::deserialize(deserializer).map_err(convert_err)?) } ForkName::Fulu => { diff --git a/consensus/types/src/light_client_finality_update.rs b/consensus/types/src/light_client_finality_update.rs index 927b93ee1d..6ab5d3dafc 100644 --- a/consensus/types/src/light_client_finality_update.rs +++ b/consensus/types/src/light_client_finality_update.rs @@ -263,7 +263,7 @@ impl<'de, E: EthSpec> ContextDeserialize<'de, ForkName> for LightClientFinalityU ForkName::Deneb => { Self::Deneb(Deserialize::deserialize(deserializer).map_err(convert_err)?) } - ForkName::Electra | ForkName::Eip7805 => { + ForkName::Electra | ForkName::Eip7805 => { Self::Electra(Deserialize::deserialize(deserializer).map_err(convert_err)?) } ForkName::Fulu => { diff --git a/consensus/types/src/preset.rs b/consensus/types/src/preset.rs index 6ad9aaa4e5..1013b68579 100644 --- a/consensus/types/src/preset.rs +++ b/consensus/types/src/preset.rs @@ -291,52 +291,17 @@ impl ElectraPreset { #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[serde(rename_all = "UPPERCASE")] pub struct Eip7805Preset { + #[serde(with = "serde_utils::quoted_u32")] + pub domain_inclusion_list_committee: u32, #[serde(with = "serde_utils::quoted_u64")] - pub min_activation_balance: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_effective_balance_electra: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub min_slashing_penalty_quotient_electra: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub whistleblower_reward_quotient_electra: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_pending_partials_per_withdrawals_sweep: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub pending_deposits_limit: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub pending_partial_withdrawals_limit: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub pending_consolidations_limit: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_consolidation_requests_per_payload: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_deposit_requests_per_payload: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_attester_slashings_electra: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_attestations_electra: u64, - #[serde(with = "serde_utils::quoted_u64")] - pub max_withdrawal_requests_per_payload: u64, + pub inclusion_list_committee_size: u64, } impl Eip7805Preset { pub fn from_chain_spec(spec: &ChainSpec) -> Self { Self { - min_activation_balance: spec.min_activation_balance, - max_effective_balance_electra: spec.max_effective_balance_electra, - min_slashing_penalty_quotient_electra: spec.min_slashing_penalty_quotient_electra, - whistleblower_reward_quotient_electra: spec.whistleblower_reward_quotient_electra, - max_pending_partials_per_withdrawals_sweep: spec - .max_pending_partials_per_withdrawals_sweep, - pending_deposits_limit: E::pending_deposits_limit() as u64, - pending_partial_withdrawals_limit: E::pending_partial_withdrawals_limit() as u64, - pending_consolidations_limit: E::pending_consolidations_limit() as u64, - max_consolidation_requests_per_payload: E::max_consolidation_requests_per_payload() - as u64, - max_deposit_requests_per_payload: E::max_deposit_requests_per_payload() as u64, - max_attester_slashings_electra: E::max_attester_slashings_electra() as u64, - max_attestations_electra: E::max_attestations_electra() as u64, - max_withdrawal_requests_per_payload: E::max_withdrawal_requests_per_payload() as u64, + domain_inclusion_list_committee: spec.domain_inclusion_list_committee, + inclusion_list_committee_size: spec.inclusion_list_committee_size, } } } diff --git a/consensus/types/src/signed_beacon_block.rs b/consensus/types/src/signed_beacon_block.rs index 37c938f8f7..73f86827c0 100644 --- a/consensus/types/src/signed_beacon_block.rs +++ b/consensus/types/src/signed_beacon_block.rs @@ -873,12 +873,12 @@ pub mod ssz_tagged_signed_beacon_block { ForkName::Deneb => Ok(SignedBeaconBlock::Deneb( SignedBeaconBlockDeneb::from_ssz_bytes(body)?, )), - ForkName::Eip7805 => Ok(SignedBeaconBlock::Eip7805( - SignedBeaconBlockEip7805::from_ssz_bytes(body)?, - )), ForkName::Electra => Ok(SignedBeaconBlock::Electra( SignedBeaconBlockElectra::from_ssz_bytes(body)?, )), + ForkName::Eip7805 => Ok(SignedBeaconBlock::Eip7805( + SignedBeaconBlockEip7805::from_ssz_bytes(body)?, + )), ForkName::Fulu => Ok(SignedBeaconBlock::Fulu( SignedBeaconBlockFulu::from_ssz_bytes(body)?, )),