mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 05:14:35 +00:00
get ef tests passing after capella rebase
This commit is contained in:
@@ -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!(),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user