Fix conflicts rebasing eip4844

This commit is contained in:
Emilia Hane 2023-02-08 11:26:51 +01:00
parent 1f3eef2c5f
commit 02cca3478b
No known key found for this signature in database
GPG Key ID: E73394F9C09206FA
4 changed files with 16 additions and 48 deletions

13
Cargo.lock generated
View File

@ -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"

View File

@ -4539,7 +4539,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
None,
),
BeaconState::Merge(_) => {
let block_contents = block_contents
let (payload, _, _) = block_contents
.ok_or(BlockProductionError::MissingExecutionPayload)?
.deconstruct();
(
@ -4559,8 +4559,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
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<T: BeaconChainTypes> BeaconChain<T> {
)
}
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<T: BeaconChainTypes> BeaconChain<T> {
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<T: BeaconChainTypes> BeaconChain<T> {
)
}
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<T::EthSpec> =
blobs_content.kzg_commitments;
let blobs: Blobs<T::EthSpec> = blobs_content.blobs;
(kzg_commitments, blobs)
}
None => {
return Err(BlockProductionError::InvalidPayloadFork);
}
};
(
BeaconBlock::Eip4844(BeaconBlockEip4844 {
slot,
@ -4634,15 +4618,15 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
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,
)
}
};

View File

@ -153,7 +153,9 @@ pub async fn broadcast_address_changes<T: BeaconChainTypes>(
#[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<EphemeralHarnessType<E>>,
harness: BeaconChainHarness<HarnessType<E>>,
/// Changes which should be broadcast at the Capella fork.
received_pre_capella_changes: Vec<SigVerifiedOp<SignedBlsToExecutionChange, E>>,
/// Changes which should *not* be broadcast at the Capella fork.

View File

@ -133,6 +133,7 @@ pub enum BlockProposalContents<T: EthSpec, Payload: AbstractExecPayload<T>> {
payload: Payload,
block_value: Uint256,
kzg_commitments: KzgCommitments<T>,
blobs: Blobs<T>,
},
}
@ -147,7 +148,7 @@ pub struct BlockProposalContentsDeconstructed<T: EthSpec, Payload: AbstractExecP
}
impl<T: EthSpec, Payload: AbstractExecPayload<T>> BlockProposalContents<T, Payload> {
pub fn deconstruct(self) -> BlockProposalContentsDeconstructed<T, Payload> {
pub fn deconstruct(self) -> (Payload, Option<KzgCommitments<T>>, Option<Blobs<T>>) {
match self {
Self::Payload {
payload,
@ -158,13 +159,7 @@ impl<T: EthSpec, Payload: AbstractExecPayload<T>> BlockProposalContents<T, Paylo
block_value: _,
kzg_commitments,
blobs,
} => BlockProposalContentsDeconstructed {
payload,
blobs_content: Some(BlockProposalBlobsContents {
kzg_commitments,
blobs,
}),
},
} => (payload, Some(kzg_commitments), Some(blobs)),
}
}