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",
"int_to_bytes",
"itertools",
"kzg",
"lazy_static",
"lighthouse_metrics",
"logging",

View File

@ -3706,10 +3706,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
bls_to_execution_changes,
} = partial_beacon_block;
let (payload, kzg_commitments_opt, blobs) = block_contents.deconstruct();
let inner_block = match &state {
BeaconState::Base(_) => BeaconBlock::Base(BeaconBlockBase {
let (inner_block, blobs_opt) = match &state {
BeaconState::Base(_) => (BeaconBlock::Base(BeaconBlockBase {
slot,
proposer_index,
parent_root,
@ -3725,8 +3723,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
voluntary_exits: voluntary_exits.into(),
_phantom: PhantomData,
},
}),
BeaconState::Altair(_) => BeaconBlock::Altair(BeaconBlockAltair {
}), None),
BeaconState::Altair(_) => (BeaconBlock::Altair(BeaconBlockAltair {
slot,
proposer_index,
parent_root,
@ -3744,57 +3742,62 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.ok_or(BlockProductionError::MissingSyncAggregate)?,
_phantom: PhantomData,
},
}),
BeaconState::Merge(_) => BeaconBlock::Merge(BeaconBlockMerge {
slot,
proposer_index,
parent_root,
state_root: Hash256::zero(),
body: BeaconBlockBodyMerge {
randao_reveal,
eth1_data,
graffiti,
proposer_slashings: proposer_slashings.into(),
attester_slashings: attester_slashings.into(),
attestations: attestations.into(),
deposits: deposits.into(),
voluntary_exits: voluntary_exits.into(),
sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: payload
.ok_or(BlockProductionError::MissingExecutionPayload)?
.try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
},
}),
BeaconState::Capella(_) => BeaconBlock::Capella(BeaconBlockCapella {
slot,
proposer_index,
parent_root,
state_root: Hash256::zero(),
body: BeaconBlockBodyCapella {
randao_reveal,
eth1_data,
graffiti,
proposer_slashings: proposer_slashings.into(),
attester_slashings: attester_slashings.into(),
attestations: attestations.into(),
deposits: deposits.into(),
voluntary_exits: voluntary_exits.into(),
sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: payload
.ok_or(BlockProductionError::MissingExecutionPayload)?
.try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
#[cfg(feature = "withdrawals")]
bls_to_execution_changes: bls_to_execution_changes.into(),
},
}),
}), None),
BeaconState::Merge(_) => {
let (payload, _, _) = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?.deconstruct();
(BeaconBlock::Merge(BeaconBlockMerge {
slot,
proposer_index,
parent_root,
state_root: Hash256::zero(),
body: BeaconBlockBodyMerge {
randao_reveal,
eth1_data,
graffiti,
proposer_slashings: proposer_slashings.into(),
attester_slashings: attester_slashings.into(),
attestations: attestations.into(),
deposits: deposits.into(),
voluntary_exits: voluntary_exits.into(),
sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: payload
.try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
},
}), None)
},
BeaconState::Capella(_) => {
let (payload, _, _) = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?.deconstruct();
(BeaconBlock::Capella(BeaconBlockCapella {
slot,
proposer_index,
parent_root,
state_root: Hash256::zero(),
body: BeaconBlockBodyCapella {
randao_reveal,
eth1_data,
graffiti,
proposer_slashings: proposer_slashings.into(),
attester_slashings: attester_slashings.into(),
attestations: attestations.into(),
deposits: deposits.into(),
voluntary_exits: voluntary_exits.into(),
sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: payload
.try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
#[cfg(feature = "withdrawals")]
bls_to_execution_changes: bls_to_execution_changes.into(),
},
}), None)
},
BeaconState::Eip4844(_) => {
let kzg_commitments =
kzg_commitments_opt.ok_or(BlockProductionError::InvalidPayloadFork)?;
BeaconBlock::Eip4844(BeaconBlockEip4844 {
let (payload, kzg_commitments, blobs) = block_contents.ok_or(BlockProductionError::MissingExecutionPayload)?.deconstruct();
(BeaconBlock::Eip4844(BeaconBlockEip4844 {
slot,
proposer_index,
parent_root,
@ -3811,14 +3814,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
sync_aggregate: sync_aggregate
.ok_or(BlockProductionError::MissingSyncAggregate)?,
execution_payload: payload
.ok_or(BlockProductionError::MissingExecutionPayload)?
.try_into()
.map_err(|_| BlockProductionError::InvalidPayloadFork)?,
#[cfg(feature = "withdrawals")]
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)
// - generate kzg proof
// - 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 blobs_sidecar = BlobsSidecar {
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 SlotsPerEth1VotingPeriod = U32; // 4 epochs * 8 slots per epoch
type MaxWithdrawalsPerPayload = U4;
type FieldElementsPerBlob = U4; //FIXME(sean) this is spec'd out currently but will likely change
params_from_eth_spec!(MainnetEthSpec {
JustificationBitsLength,
@ -360,7 +361,6 @@ impl EthSpec for MinimalEthSpec {
MaxExtraDataBytes,
MaxBlsToExecutionChanges,
MaxBlobsPerBlock,
FieldElementsPerBlob,
BytesPerFieldElement,
BytesPerBlob
});

View File

@ -9,6 +9,8 @@ edition = "2021"
ef_tests = []
milagro = ["bls/milagro"]
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]
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
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::testing_spec;
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::{
process_bls_to_execution_changes, process_bls_to_execution_changes,
process_bls_to_execution_changes,
};
use state_processing::{
per_block_processing::{
@ -22,6 +22,7 @@ use state_processing::{
};
use std::fmt::Debug;
use std::path::Path;
use state_processing::per_block_processing::process_withdrawals;
use types::{
Attestation, AttesterSlashing, BeaconBlock, BeaconState, BlindedPayload, ChainSpec, Deposit,
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> {
fn handler_name() -> String {
"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 {
fn handler_name() -> String {
"bls_to_execution_change".into()