mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Fix ef tests
This commit is contained in:
@@ -1105,19 +1105,18 @@ impl HttpJsonRpc {
|
||||
execution_payload: ExecutionPayload<T>,
|
||||
versioned_hashes_opt: Option<Vec<VersionedHash>>,
|
||||
) -> Result<PayloadStatusV1, Error> {
|
||||
let engine_capabilities = self.get_engine_capabilities(None).await?;
|
||||
if engine_capabilities.new_payload_v3 {
|
||||
let Some(versioned_hashes) = versioned_hashes_opt else {
|
||||
return Err(Error::IncorrectStateVariant);
|
||||
};
|
||||
self.new_payload_v3(execution_payload, versioned_hashes)
|
||||
.await
|
||||
} else if engine_capabilities.new_payload_v2 {
|
||||
self.new_payload_v2(execution_payload).await
|
||||
} else if engine_capabilities.new_payload_v1 {
|
||||
self.new_payload_v1(execution_payload).await
|
||||
} else {
|
||||
Err(Error::RequiredMethodUnsupported("engine_newPayload"))
|
||||
// TODO(sean): opting to just use one struct one endpoint approach for simplicity,
|
||||
// also this is in the pipeline:https://github.com/ethereum/execution-apis/pull/418/files
|
||||
match execution_payload {
|
||||
ExecutionPayload::Merge(_) => self.new_payload_v1(execution_payload).await,
|
||||
ExecutionPayload::Capella(_) => self.new_payload_v2(execution_payload).await,
|
||||
ExecutionPayload::Deneb(_) => {
|
||||
let Some(versioned_hashes) = versioned_hashes_opt else {
|
||||
return Err(Error::IncorrectStateVariant);
|
||||
};
|
||||
self.new_payload_v3(execution_payload, versioned_hashes)
|
||||
.await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ excluded_paths = [
|
||||
# FIXME(sean)
|
||||
"tests/mainnet/capella/light_client/single_merkle_proof/BeaconBlockBody/*",
|
||||
"tests/mainnet/deneb/light_client/single_merkle_proof/BeaconBlockBody/*",
|
||||
"tests/general/deneb/kzg"
|
||||
"tests/general/deneb/kzg",
|
||||
"tests/.*/eip6110"
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -20,9 +20,10 @@ use state_processing::{
|
||||
use std::fmt::Debug;
|
||||
use std::path::Path;
|
||||
use types::{
|
||||
map_fork_name, map_fork_name_with, Attestation, AttesterSlashing, BeaconBlock, BeaconBlockBody,
|
||||
BeaconState, BlindedPayload, ChainSpec, Deposit, EthSpec, ExecutionPayload, ForkName,
|
||||
FullPayload, ProposerSlashing, SignedBlsToExecutionChange, SignedVoluntaryExit, SyncAggregate,
|
||||
Attestation, AttesterSlashing, BeaconBlock, BeaconBlockBody, BeaconBlockBodyCapella,
|
||||
BeaconBlockBodyDeneb, BeaconBlockBodyMerge, BeaconState, BlindedPayload, ChainSpec, Deposit,
|
||||
EthSpec, ExecutionPayload, ForkName, FullPayload, ProposerSlashing, SignedBlsToExecutionChange,
|
||||
SignedVoluntaryExit, SyncAggregate,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize)]
|
||||
@@ -275,7 +276,12 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
|
||||
|
||||
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file_with(path, |bytes| {
|
||||
Ok(map_fork_name!(fork_name, Self, <_>::from_ssz_bytes(bytes)?))
|
||||
Ok(match fork_name {
|
||||
ForkName::Merge => BeaconBlockBody::Merge(<_>::from_ssz_bytes(bytes)?),
|
||||
ForkName::Capella => BeaconBlockBody::Capella(<_>::from_ssz_bytes(bytes)?),
|
||||
ForkName::Deneb => BeaconBlockBody::Deneb(<_>::from_ssz_bytes(bytes)?),
|
||||
_ => panic!(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -311,7 +317,21 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
|
||||
|
||||
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file_with(path, |bytes| {
|
||||
Ok(map_fork_name!(fork_name, Self, <_>::from_ssz_bytes(bytes)?))
|
||||
Ok(match fork_name {
|
||||
ForkName::Merge => {
|
||||
let inner = <BeaconBlockBodyMerge<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
|
||||
BeaconBlockBody::Merge(inner.clone_as_blinded())
|
||||
}
|
||||
ForkName::Capella => {
|
||||
let inner = <BeaconBlockBodyCapella<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
|
||||
BeaconBlockBody::Capella(inner.clone_as_blinded())
|
||||
}
|
||||
ForkName::Deneb => {
|
||||
let inner = <BeaconBlockBodyDeneb<E, FullPayload<E>>>::from_ssz_bytes(bytes)?;
|
||||
BeaconBlockBody::Deneb(inner.clone_as_blinded())
|
||||
}
|
||||
_ => panic!(),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -72,14 +72,14 @@ fn operations_sync_aggregate() {
|
||||
|
||||
#[test]
|
||||
fn operations_execution_payload_full() {
|
||||
OperationsHandler::<MinimalEthSpec, FullPayload<_>>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, FullPayload<_>>::default().run();
|
||||
OperationsHandler::<MinimalEthSpec, BeaconBlockBody<_, FullPayload<_>>>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, BeaconBlockBody<_, FullPayload<_>>>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn operations_execution_payload_blinded() {
|
||||
OperationsHandler::<MinimalEthSpec, BlindedPayload<_>>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, BlindedPayload<_>>::default().run();
|
||||
OperationsHandler::<MinimalEthSpec, BeaconBlockBody<_, BlindedPayload<_>>>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, BeaconBlockBody<_, BlindedPayload<_>>>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user