ef-test fixes

This commit is contained in:
realbigsean 2022-11-23 11:27:37 -05:00
parent 62f8a5ee10
commit 7aa52a4141
No known key found for this signature in database
GPG Key ID: B372B64D866BF8CC
6 changed files with 73 additions and 66 deletions

1
Cargo.lock generated
View File

@ -403,6 +403,7 @@ dependencies = [
"hex", "hex",
"int_to_bytes", "int_to_bytes",
"itertools", "itertools",
"kzg",
"lazy_static", "lazy_static",
"lighthouse_metrics", "lighthouse_metrics",
"logging", "logging",

View File

@ -3706,10 +3706,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
bls_to_execution_changes, bls_to_execution_changes,
} = partial_beacon_block; } = partial_beacon_block;
let (payload, kzg_commitments_opt, blobs) = block_contents.deconstruct(); let (inner_block, blobs_opt) = match &state {
BeaconState::Base(_) => (BeaconBlock::Base(BeaconBlockBase {
let inner_block = match &state {
BeaconState::Base(_) => BeaconBlock::Base(BeaconBlockBase {
slot, slot,
proposer_index, proposer_index,
parent_root, parent_root,
@ -3725,8 +3723,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
voluntary_exits: voluntary_exits.into(), voluntary_exits: voluntary_exits.into(),
_phantom: PhantomData, _phantom: PhantomData,
}, },
}), }), None),
BeaconState::Altair(_) => BeaconBlock::Altair(BeaconBlockAltair { BeaconState::Altair(_) => (BeaconBlock::Altair(BeaconBlockAltair {
slot, slot,
proposer_index, proposer_index,
parent_root, parent_root,
@ -3744,57 +3742,62 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.ok_or(BlockProductionError::MissingSyncAggregate)?, .ok_or(BlockProductionError::MissingSyncAggregate)?,
_phantom: PhantomData, _phantom: PhantomData,
}, },
}), }), None),
BeaconState::Merge(_) => BeaconBlock::Merge(BeaconBlockMerge { BeaconState::Merge(_) => {
slot, let (payload, _, _) = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?.deconstruct();
proposer_index, (BeaconBlock::Merge(BeaconBlockMerge {
parent_root, slot,
state_root: Hash256::zero(), proposer_index,
body: BeaconBlockBodyMerge { parent_root,
randao_reveal, state_root: Hash256::zero(),
eth1_data, body: BeaconBlockBodyMerge {
graffiti, randao_reveal,
proposer_slashings: proposer_slashings.into(), eth1_data,
attester_slashings: attester_slashings.into(), graffiti,
attestations: attestations.into(), proposer_slashings: proposer_slashings.into(),
deposits: deposits.into(), attester_slashings: attester_slashings.into(),
voluntary_exits: voluntary_exits.into(), attestations: attestations.into(),
sync_aggregate: sync_aggregate deposits: deposits.into(),
.ok_or(BlockProductionError::MissingSyncAggregate)?, voluntary_exits: voluntary_exits.into(),
execution_payload: payload sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingExecutionPayload)? .ok_or(BlockProductionError::MissingSyncAggregate)?,
.try_into() execution_payload: payload
.map_err(|_| BlockProductionError::InvalidPayloadFork)?, .try_into()
}, .map_err(|_| BlockProductionError::InvalidPayloadFork)?,
}), },
BeaconState::Capella(_) => BeaconBlock::Capella(BeaconBlockCapella { }), None)
slot, },
proposer_index, BeaconState::Capella(_) => {
parent_root, let (payload, _, _) = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?.deconstruct();
state_root: Hash256::zero(),
body: BeaconBlockBodyCapella { (BeaconBlock::Capella(BeaconBlockCapella {
randao_reveal, slot,
eth1_data, proposer_index,
graffiti, parent_root,
proposer_slashings: proposer_slashings.into(), state_root: Hash256::zero(),
attester_slashings: attester_slashings.into(), body: BeaconBlockBodyCapella {
attestations: attestations.into(), randao_reveal,
deposits: deposits.into(), eth1_data,
voluntary_exits: voluntary_exits.into(), graffiti,
sync_aggregate: sync_aggregate proposer_slashings: proposer_slashings.into(),
.ok_or(BlockProductionError::MissingSyncAggregate)?, attester_slashings: attester_slashings.into(),
execution_payload: payload attestations: attestations.into(),
.ok_or(BlockProductionError::MissingExecutionPayload)? deposits: deposits.into(),
.try_into() voluntary_exits: voluntary_exits.into(),
.map_err(|_| BlockProductionError::InvalidPayloadFork)?, sync_aggregate: sync_aggregate
#[cfg(feature = "withdrawals")] .ok_or(BlockProductionError::MissingSyncAggregate)?,
bls_to_execution_changes: bls_to_execution_changes.into(), execution_payload: payload
}, .try_into()
}), .map_err(|_| BlockProductionError::InvalidPayloadFork)?,
#[cfg(feature = "withdrawals")]
bls_to_execution_changes: bls_to_execution_changes.into(),
},
}), None)
},
BeaconState::Eip4844(_) => { BeaconState::Eip4844(_) => {
let kzg_commitments = let (payload, kzg_commitments, blobs) = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?.deconstruct();
kzg_commitments_opt.ok_or(BlockProductionError::InvalidPayloadFork)?;
BeaconBlock::Eip4844(BeaconBlockEip4844 { (BeaconBlock::Eip4844(BeaconBlockEip4844 {
slot, slot,
proposer_index, proposer_index,
parent_root, parent_root,
@ -3811,14 +3814,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
sync_aggregate: sync_aggregate sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingSyncAggregate)?, .ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: payload execution_payload: payload
.ok_or(BlockProductionError::MissingExecutionPayload)?
.try_into() .try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?, .map_err(|_| BlockProductionError::InvalidPayloadFork)?,
#[cfg(feature = "withdrawals")] #[cfg(feature = "withdrawals")]
bls_to_execution_changes: bls_to_execution_changes.into(), bls_to_execution_changes: bls_to_execution_changes.into(),
blob_kzg_commitments: VariableList::from(kzg_commitments), blob_kzg_commitments: VariableList::from(kzg_commitments.ok_or(BlockProductionError::InvalidPayloadFork)?),
}, },
}) }), blobs)
} }
}; };
@ -3873,7 +3875,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
//FIXME(sean) //FIXME(sean)
// - generate kzg proof // - generate kzg proof
// - validate blobs then cache them // - validate blobs then cache them
if let Some(blobs) = blobs { // - add a new timer for processing here
if let Some(blobs) = blobs_opt {
let beacon_block_root = block.canonical_root(); let beacon_block_root = block.canonical_root();
let blobs_sidecar = BlobsSidecar { let blobs_sidecar = BlobsSidecar {
beacon_block_slot: slot, beacon_block_slot: slot,

View File

@ -338,6 +338,7 @@ impl EthSpec for MinimalEthSpec {
type MaxPendingAttestations = U1024; // 128 max attestations * 8 slots per epoch type MaxPendingAttestations = U1024; // 128 max attestations * 8 slots per epoch
type SlotsPerEth1VotingPeriod = U32; // 4 epochs * 8 slots per epoch type SlotsPerEth1VotingPeriod = U32; // 4 epochs * 8 slots per epoch
type MaxWithdrawalsPerPayload = U4; type MaxWithdrawalsPerPayload = U4;
type FieldElementsPerBlob = U4; //FIXME(sean) this is spec'd out currently but will likely change
params_from_eth_spec!(MainnetEthSpec { params_from_eth_spec!(MainnetEthSpec {
JustificationBitsLength, JustificationBitsLength,
@ -360,7 +361,6 @@ impl EthSpec for MinimalEthSpec {
MaxExtraDataBytes, MaxExtraDataBytes,
MaxBlsToExecutionChanges, MaxBlsToExecutionChanges,
MaxBlobsPerBlock, MaxBlobsPerBlock,
FieldElementsPerBlob,
BytesPerFieldElement, BytesPerFieldElement,
BytesPerBlob BytesPerBlob
}); });

View File

@ -9,6 +9,8 @@ edition = "2021"
ef_tests = [] ef_tests = []
milagro = ["bls/milagro"] milagro = ["bls/milagro"]
fake_crypto = ["bls/fake_crypto"] fake_crypto = ["bls/fake_crypto"]
withdrawals = ["state_processing/withdrawals", "store/withdrawals", "beacon_chain/withdrawals", "types/withdrawals", "execution_layer/withdrawals"]
withdrawals-processing = ["state_processing/withdrawals-processing", "store/withdrawals-processing", "beacon_chain/withdrawals-processing", "execution_layer/withdrawals-processing"]
[dependencies] [dependencies]
bls = { path = "../../crypto/bls", default-features = false } bls = { path = "../../crypto/bls", default-features = false }

View File

@ -1,4 +1,4 @@
TESTS_TAG := f5c7cf78 TESTS_TAG := v1.3.0-alpha.1-hotfix
TESTS = general minimal mainnet TESTS = general minimal mainnet
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS)) TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))

View File

@ -4,9 +4,9 @@ use crate::case_result::compare_beacon_state_results_without_caches;
use crate::decode::{ssz_decode_file, ssz_decode_file_with, ssz_decode_state, yaml_decode_file}; use crate::decode::{ssz_decode_file, ssz_decode_file_with, ssz_decode_state, yaml_decode_file};
use crate::testing_spec; use crate::testing_spec;
use serde_derive::Deserialize; use serde_derive::Deserialize;
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))] // #[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
use state_processing::per_block_processing::process_operations::{ use state_processing::per_block_processing::process_operations::{
process_bls_to_execution_changes, process_bls_to_execution_changes, process_bls_to_execution_changes,
}; };
use state_processing::{ use state_processing::{
per_block_processing::{ per_block_processing::{
@ -22,6 +22,7 @@ use state_processing::{
}; };
use std::fmt::Debug; use std::fmt::Debug;
use std::path::Path; use std::path::Path;
use state_processing::per_block_processing::process_withdrawals;
use types::{ use types::{
Attestation, AttesterSlashing, BeaconBlock, BeaconState, BlindedPayload, ChainSpec, Deposit, Attestation, AttesterSlashing, BeaconBlock, BeaconState, BlindedPayload, ChainSpec, Deposit,
EthSpec, ExecutionPayload, ForkName, FullPayload, ProposerSlashing, SignedBlsToExecutionChange, EthSpec, ExecutionPayload, ForkName, FullPayload, ProposerSlashing, SignedBlsToExecutionChange,
@ -344,7 +345,7 @@ impl<E: EthSpec> Operation<E> for BlindedPayload<E> {
} }
} }
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))] // #[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> { impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
fn handler_name() -> String { fn handler_name() -> String {
"withdrawals".into() "withdrawals".into()
@ -377,7 +378,7 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
} }
} }
#[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))] // #[cfg(all(feature = "withdrawals", feature = "withdrawals-processing"))]
impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange { impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
fn handler_name() -> String { fn handler_name() -> String {
"bls_to_execution_change".into() "bls_to_execution_change".into()