From 02cca3478b59a9cdd6fbb547f722209f28835b4f Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Wed, 8 Feb 2023 11:26:51 +0100 Subject: [PATCH] Fix conflicts rebasing eip4844 --- Cargo.lock | 13 ------- beacon_node/beacon_chain/src/beacon_chain.rs | 34 +++++-------------- .../client/src/address_change_broadcast.rs | 6 ++-- beacon_node/execution_layer/src/lib.rs | 11 ++---- 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc8ac6960..5a73d1093 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6827,19 +6827,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -name = "serde-big-array" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18b20e7752957bbe9661cff4e0bb04d183d0948cdab2ea58cdb9df36a61dfe62" -dependencies = [ - "serde", - "serde_derive", -] - -[[package]] -======= ->>>>>>> 5ef38b590 (Fix conflicts rebasing eip4844) name = "serde_array_query" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index ed0437f5c..19159d6fc 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -4539,7 +4539,7 @@ impl BeaconChain { None, ), BeaconState::Merge(_) => { - let block_contents = block_contents + let (payload, _, _) = block_contents .ok_or(BlockProductionError::MissingExecutionPayload)? .deconstruct(); ( @@ -4559,8 +4559,7 @@ impl BeaconChain { voluntary_exits: voluntary_exits.into(), sync_aggregate: sync_aggregate .ok_or(BlockProductionError::MissingSyncAggregate)?, - execution_payload: block_contents - .payload + execution_payload: payload .try_into() .map_err(|_| BlockProductionError::InvalidPayloadFork)?, }, @@ -4569,10 +4568,9 @@ impl BeaconChain { ) } BeaconState::Capella(_) => { - let block_contents = block_contents + let (payload, _, _) = block_contents .ok_or(BlockProductionError::MissingExecutionPayload)? .deconstruct(); - ( BeaconBlock::Capella(BeaconBlockCapella { slot, @@ -4590,8 +4588,7 @@ impl BeaconChain { voluntary_exits: voluntary_exits.into(), sync_aggregate: sync_aggregate .ok_or(BlockProductionError::MissingSyncAggregate)?, - execution_payload: block_contents - .payload + execution_payload: payload .try_into() .map_err(|_| BlockProductionError::InvalidPayloadFork)?, bls_to_execution_changes: bls_to_execution_changes.into(), @@ -4601,22 +4598,9 @@ impl BeaconChain { ) } BeaconState::Eip4844(_) => { - let block_contents_unpacked = block_contents + let (payload, kzg_commitments, blobs) = block_contents .ok_or(BlockProductionError::MissingExecutionPayload)? .deconstruct(); - - let (blob_kzg_commitments, blobs) = match block_contents_unpacked.blobs_content { - Some(blobs_content) => { - let kzg_commitments: KzgCommitments = - blobs_content.kzg_commitments; - let blobs: Blobs = blobs_content.blobs; - (kzg_commitments, blobs) - } - None => { - return Err(BlockProductionError::InvalidPayloadFork); - } - }; - ( BeaconBlock::Eip4844(BeaconBlockEip4844 { slot, @@ -4634,15 +4618,15 @@ impl BeaconChain { voluntary_exits: voluntary_exits.into(), sync_aggregate: sync_aggregate .ok_or(BlockProductionError::MissingSyncAggregate)?, - execution_payload: block_contents_unpacked - .payload + execution_payload: payload .try_into() .map_err(|_| BlockProductionError::InvalidPayloadFork)?, bls_to_execution_changes: bls_to_execution_changes.into(), - blob_kzg_commitments, + blob_kzg_commitments: kzg_commitments + .ok_or(BlockProductionError::InvalidPayloadFork)?, }, }), - Some(blobs), + blobs, ) } }; diff --git a/beacon_node/client/src/address_change_broadcast.rs b/beacon_node/client/src/address_change_broadcast.rs index 272ee908f..ccc34de16 100644 --- a/beacon_node/client/src/address_change_broadcast.rs +++ b/beacon_node/client/src/address_change_broadcast.rs @@ -153,7 +153,9 @@ pub async fn broadcast_address_changes( #[cfg(test)] mod tests { use super::*; - use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType}; + use beacon_chain::test_utils::{ + BeaconChainHarness, EphemeralTestingSlotClockHarnessType as HarnessType, + }; use operation_pool::ReceivedPreCapella; use state_processing::{SigVerifiedOp, VerifyOperation}; use std::collections::HashSet; @@ -166,7 +168,7 @@ mod tests { pub const EXECUTION_ADDRESS: Address = Address::repeat_byte(42); struct Tester { - harness: BeaconChainHarness>, + harness: BeaconChainHarness>, /// Changes which should be broadcast at the Capella fork. received_pre_capella_changes: Vec>, /// Changes which should *not* be broadcast at the Capella fork. diff --git a/beacon_node/execution_layer/src/lib.rs b/beacon_node/execution_layer/src/lib.rs index 484bd65d1..2ae11525f 100644 --- a/beacon_node/execution_layer/src/lib.rs +++ b/beacon_node/execution_layer/src/lib.rs @@ -133,6 +133,7 @@ pub enum BlockProposalContents> { payload: Payload, block_value: Uint256, kzg_commitments: KzgCommitments, + blobs: Blobs, }, } @@ -147,7 +148,7 @@ pub struct BlockProposalContentsDeconstructed> BlockProposalContents { - pub fn deconstruct(self) -> BlockProposalContentsDeconstructed { + pub fn deconstruct(self) -> (Payload, Option>, Option>) { match self { Self::Payload { payload, @@ -158,13 +159,7 @@ impl> BlockProposalContents BlockProposalContentsDeconstructed { - payload, - blobs_content: Some(BlockProposalBlobsContents { - kzg_commitments, - blobs, - }), - }, + } => (payload, Some(kzg_commitments), Some(blobs)), } }