get ef tests passing after capella rebase
This commit is contained in:
parent
438126f19a
commit
f7f351784a
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -401,6 +401,7 @@ dependencies = [
|
||||
"eth1",
|
||||
"eth2",
|
||||
"eth2_hashing",
|
||||
"eth2_network_config",
|
||||
"eth2_ssz",
|
||||
"eth2_ssz_derive",
|
||||
"eth2_ssz_types",
|
||||
|
@ -22,6 +22,8 @@ environment = { path = "../../lighthouse/environment" }
|
||||
serde_json = "1.0.58"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.58"
|
||||
eth2_network_config = { path = "../../common/eth2_network_config"}
|
||||
merkle_proof = { path = "../../consensus/merkle_proof" }
|
||||
store = { path = "../store" }
|
||||
parking_lot = "0.12.0"
|
||||
|
@ -23,6 +23,7 @@ use fork_choice::CountUnrealized;
|
||||
use futures::channel::mpsc::Receiver;
|
||||
pub use genesis::{interop_genesis_state, DEFAULT_ETH1_BLOCK_HASH};
|
||||
use int_to_bytes::int_to_bytes32;
|
||||
use kzg::TrustedSetup;
|
||||
use merkle_proof::MerkleTree;
|
||||
use parking_lot::Mutex;
|
||||
use parking_lot::RwLockWriteGuard;
|
||||
@ -493,6 +494,10 @@ where
|
||||
let validator_keypairs = self
|
||||
.validator_keypairs
|
||||
.expect("cannot build without validator keypairs");
|
||||
let trusted_setup: TrustedSetup =
|
||||
serde_json::from_reader(eth2_network_config::TRUSTED_SETUP)
|
||||
.map_err(|e| format!("Unable to read trusted setup file: {}", e))
|
||||
.unwrap();
|
||||
|
||||
let mut builder = BeaconChainBuilder::new(self.eth_spec_instance)
|
||||
.logger(log.clone())
|
||||
@ -509,7 +514,8 @@ where
|
||||
log.clone(),
|
||||
5,
|
||||
)))
|
||||
.monitor_validators(true, vec![], log);
|
||||
.monitor_validators(true, vec![], log)
|
||||
.trusted_setup(trusted_setup);
|
||||
|
||||
builder = if let Some(mutator) = self.initial_mutator {
|
||||
mutator(builder)
|
||||
|
@ -889,11 +889,11 @@ impl HttpJsonRpc {
|
||||
pub async fn supported_apis_v1(&self) -> Result<SupportedApis, Error> {
|
||||
Ok(SupportedApis {
|
||||
new_payload_v1: true,
|
||||
new_payload_v2: cfg!(any(feature = "withdrawals-processing", test)),
|
||||
new_payload_v2: cfg!(test),
|
||||
forkchoice_updated_v1: true,
|
||||
forkchoice_updated_v2: cfg!(any(feature = "withdrawals-processing", test)),
|
||||
forkchoice_updated_v2: cfg!(test),
|
||||
get_payload_v1: true,
|
||||
get_payload_v2: cfg!(any(feature = "withdrawals-processing", test)),
|
||||
get_payload_v2: cfg!(test),
|
||||
exchange_transition_configuration_v1: true,
|
||||
})
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
.unwrap())
|
||||
}
|
||||
}
|
||||
ENGINE_NEW_PAYLOAD_V1 | ENGINE_NEW_PAYLOAD_V2 => {
|
||||
ENGINE_NEW_PAYLOAD_V1 | ENGINE_NEW_PAYLOAD_V2 | ENGINE_NEW_PAYLOAD_V3 => {
|
||||
let request = match method {
|
||||
ENGINE_NEW_PAYLOAD_V1 => {
|
||||
JsonExecutionPayload::V1(get_param::<JsonExecutionPayloadV1<T>>(params, 0)?)
|
||||
@ -82,7 +82,9 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
ENGINE_NEW_PAYLOAD_V2 => {
|
||||
JsonExecutionPayload::V2(get_param::<JsonExecutionPayloadV2<T>>(params, 0)?)
|
||||
}
|
||||
// TODO(4844) add that here..
|
||||
ENGINE_NEW_PAYLOAD_V3 => {
|
||||
JsonExecutionPayload::V2(get_param::<JsonExecutionPayloadV2<T>>(params, 0)?)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@ -114,7 +116,30 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
));
|
||||
}
|
||||
}
|
||||
// TODO(4844) add 4844 error checking here
|
||||
ForkName::Eip4844 => {
|
||||
//FIXME(sean)
|
||||
if method == ENGINE_NEW_PAYLOAD_V1 {
|
||||
return Err(format!("{} called after capella fork!", method));
|
||||
}
|
||||
if request.withdrawals().is_err()
|
||||
|| (request.withdrawals().is_ok()
|
||||
&& request.withdrawals().unwrap().is_none())
|
||||
{
|
||||
return Err(format!(
|
||||
"{} called without `withdrawals` after eip4844 fork!",
|
||||
method
|
||||
));
|
||||
}
|
||||
if request.excess_data_gas().is_err()
|
||||
|| (request.excess_data_gas().is_ok()
|
||||
&& request.excess_data_gas().unwrap().is_none())
|
||||
{
|
||||
return Err(format!(
|
||||
"{} called without `excess_data_gas` after eip4844 fork!",
|
||||
method
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
@ -148,7 +173,7 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
|
||||
Ok(serde_json::to_value(JsonPayloadStatusV1::from(response)).unwrap())
|
||||
}
|
||||
ENGINE_GET_PAYLOAD_V1 | ENGINE_GET_PAYLOAD_V2 => {
|
||||
ENGINE_GET_PAYLOAD_V1 | ENGINE_GET_PAYLOAD_V2 | ENGINE_GET_PAYLOAD_V3 => {
|
||||
let request: JsonPayloadIdRequest = get_param(params, 0)?;
|
||||
let id = request.into();
|
||||
|
||||
@ -168,7 +193,17 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
{
|
||||
return Err(format!("{} called after capella fork!", method));
|
||||
}
|
||||
// TODO(4844) add 4844 error checking here
|
||||
// validate method called correctly according to eip4844 fork time
|
||||
if ctx
|
||||
.execution_block_generator
|
||||
.read()
|
||||
.get_fork_at_timestamp(response.timestamp())
|
||||
== ForkName::Eip4844
|
||||
//FIXME(sean)
|
||||
&& method == ENGINE_GET_PAYLOAD_V1
|
||||
{
|
||||
return Err(format!("{} called after capella fork!", method));
|
||||
}
|
||||
|
||||
match method {
|
||||
ENGINE_GET_PAYLOAD_V1 => Ok(serde_json::to_value(
|
||||
@ -224,7 +259,20 @@ pub async fn handle_rpc<T: EthSpec>(
|
||||
));
|
||||
}
|
||||
}
|
||||
// TODO(4844) add 4844 error checking here
|
||||
ForkName::Eip4844 => {
|
||||
//FIXME(sean)
|
||||
if method == ENGINE_FORKCHOICE_UPDATED_V1 {
|
||||
return Err(format!("{} called after capella fork!", method));
|
||||
}
|
||||
if pa.withdrawals().is_err()
|
||||
|| (pa.withdrawals().is_ok() && pa.withdrawals().unwrap().is_none())
|
||||
{
|
||||
return Err(format!(
|
||||
"{} called without `withdrawals` after capella fork!",
|
||||
method
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
|
@ -477,10 +477,6 @@ pub fn get_expected_withdrawals<T: EthSpec>(
|
||||
let mut validator_index = state.next_withdrawal_validator_index()?;
|
||||
let mut withdrawals = vec![];
|
||||
|
||||
if cfg!(not(feature = "withdrawals-processing")) {
|
||||
return Ok(withdrawals.into());
|
||||
}
|
||||
|
||||
let bound = std::cmp::min(
|
||||
state.validators().len() as u64,
|
||||
spec.max_validators_per_withdrawals_sweep,
|
||||
@ -528,9 +524,6 @@ pub fn process_withdrawals<'payload, T: EthSpec, Payload: AbstractExecPayload<T>
|
||||
payload: Payload::Ref<'payload>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
if cfg!(not(feature = "withdrawals-processing")) {
|
||||
return Ok(());
|
||||
}
|
||||
match state {
|
||||
BeaconState::Merge(_) => Ok(()),
|
||||
BeaconState::Capella(_) | BeaconState::Eip4844(_) => {
|
||||
|
@ -300,9 +300,6 @@ pub fn process_bls_to_execution_changes<T: EthSpec>(
|
||||
verify_signatures: VerifySignatures,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
if cfg!(not(feature = "withdrawals-processing")) {
|
||||
return Ok(());
|
||||
}
|
||||
for (i, signed_address_change) in bls_to_execution_changes.iter().enumerate() {
|
||||
verify_bls_to_execution_change(state, signed_address_change, verify_signatures, spec)
|
||||
.map_err(|e| e.into_with_index(i))?;
|
||||
|
@ -344,10 +344,6 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
if fork_name == ForkName::Capella && !cfg!(feature = "withdrawals-processing") {
|
||||
return false;
|
||||
}
|
||||
|
||||
fork_name != ForkName::Base && fork_name != ForkName::Altair && fork_name != ForkName::Merge
|
||||
}
|
||||
|
||||
@ -366,12 +362,7 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
|
||||
spec: &ChainSpec,
|
||||
_: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
//FIXME(sean) remove this once the spec tests sort this out
|
||||
if matches!(state, BeaconState::Eip4844(_)) {
|
||||
Ok(())
|
||||
} else {
|
||||
process_withdrawals::<_, FullPayload<_>>(state, self.payload.to_ref(), spec)
|
||||
}
|
||||
process_withdrawals::<_, FullPayload<_>>(state, self.payload.to_ref(), spec)
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,9 +376,6 @@ impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
if fork_name == ForkName::Capella && !cfg!(feature = "withdrawals-processing") {
|
||||
return false;
|
||||
}
|
||||
fork_name != ForkName::Base && fork_name != ForkName::Altair && fork_name != ForkName::Merge
|
||||
}
|
||||
|
||||
@ -401,12 +389,7 @@ impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
|
||||
spec: &ChainSpec,
|
||||
_extra: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
//FIXME(sean) remove this once the spec tests sort this out
|
||||
if matches!(state, BeaconState::Eip4844(_)) {
|
||||
Ok(())
|
||||
} else {
|
||||
process_bls_to_execution_changes(state, &[self.clone()], VerifySignatures::True, spec)
|
||||
}
|
||||
process_bls_to_execution_changes(state, &[self.clone()], VerifySignatures::True, spec)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,14 +60,6 @@ impl<E: EthSpec> Case for SanityBlocks<E> {
|
||||
}
|
||||
|
||||
fn result(&self, _case_index: usize, fork_name: ForkName) -> Result<(), Error> {
|
||||
if cfg!(feature = "withdrawals-processing") && fork_name == ForkName::Eip4844 {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if !cfg!(feature = "withdrawals-processing") && fork_name == ForkName::Capella {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
self.metadata.bls_setting.unwrap_or_default().check()?;
|
||||
|
||||
let mut bulk_state = self.pre.clone();
|
||||
|
Loading…
Reference in New Issue
Block a user