Update to consensus-specs v1.1.9 (#3016)
## Issue Addressed Closes #3014 ## Proposed Changes - Rename `receipt_root` to `receipts_root` - Rename `execute_payload` to `notify_new_payload` - This is slightly weird since we modify everything except the actual HTTP call to the engine API. That change is expected to be implemented in #2985 (cc @ethDreamer) - Enable "random" tests for Bellatrix. ## Notes This will break *partially* compatibility with Kintusgi testnets in order to gain compatibility with [Kiln](https://hackmd.io/@n0ble/kiln-spec) testnets. I think it will only break the BN APIs due to the `receipts_root` change, however it might have some other effects too. Co-authored-by: Michael Sproul <micsproul@gmail.com>
This commit is contained in:
parent
886afd684a
commit
2f8531dc60
@ -41,7 +41,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
use crate::execution_payload::{
|
use crate::execution_payload::{
|
||||||
execute_payload, validate_execution_payload_for_gossip, validate_merge_block,
|
notify_new_payload, validate_execution_payload_for_gossip, validate_merge_block,
|
||||||
};
|
};
|
||||||
use crate::snapshot_cache::PreProcessingSnapshot;
|
use crate::snapshot_cache::PreProcessingSnapshot;
|
||||||
use crate::validator_monitor::HISTORIC_EPOCHS as VALIDATOR_MONITOR_HISTORIC_EPOCHS;
|
use crate::validator_monitor::HISTORIC_EPOCHS as VALIDATOR_MONITOR_HISTORIC_EPOCHS;
|
||||||
@ -1125,7 +1125,7 @@ impl<'a, T: BeaconChainTypes> FullyVerifiedBlock<'a, T> {
|
|||||||
//
|
//
|
||||||
// It is important that this function is called *after* `per_slot_processing`, since the
|
// It is important that this function is called *after* `per_slot_processing`, since the
|
||||||
// `randao` may change.
|
// `randao` may change.
|
||||||
let payload_verification_status = execute_payload(chain, &state, block.message())?;
|
let payload_verification_status = notify_new_payload(chain, &state, block.message())?;
|
||||||
|
|
||||||
// If the block is sufficiently recent, notify the validator monitor.
|
// If the block is sufficiently recent, notify the validator monitor.
|
||||||
if let Some(slot) = chain.slot_clock.now() {
|
if let Some(slot) = chain.slot_clock.now() {
|
||||||
|
@ -27,11 +27,11 @@ use types::*;
|
|||||||
///
|
///
|
||||||
/// ## Specification
|
/// ## Specification
|
||||||
///
|
///
|
||||||
/// Equivalent to the `execute_payload` function in the merge Beacon Chain Changes, although it
|
/// Equivalent to the `notify_new_payload` function in the merge Beacon Chain Changes, although it
|
||||||
/// contains a few extra checks by running `partially_verify_execution_payload` first:
|
/// contains a few extra checks by running `partially_verify_execution_payload` first:
|
||||||
///
|
///
|
||||||
/// https://github.com/ethereum/consensus-specs/blob/v1.1.5/specs/merge/beacon-chain.md#execute_payload
|
/// https://github.com/ethereum/consensus-specs/blob/v1.1.9/specs/bellatrix/beacon-chain.md#notify_new_payload
|
||||||
pub fn execute_payload<T: BeaconChainTypes>(
|
pub fn notify_new_payload<T: BeaconChainTypes>(
|
||||||
chain: &BeaconChain<T>,
|
chain: &BeaconChain<T>,
|
||||||
state: &BeaconState<T::EthSpec>,
|
state: &BeaconState<T::EthSpec>,
|
||||||
block: BeaconBlockRef<T::EthSpec>,
|
block: BeaconBlockRef<T::EthSpec>,
|
||||||
@ -53,10 +53,10 @@ pub fn execute_payload<T: BeaconChainTypes>(
|
|||||||
.execution_layer
|
.execution_layer
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or(ExecutionPayloadError::NoExecutionConnection)?;
|
.ok_or(ExecutionPayloadError::NoExecutionConnection)?;
|
||||||
let execute_payload_response = execution_layer
|
let notify_new_payload_response = execution_layer
|
||||||
.block_on(|execution_layer| execution_layer.execute_payload(execution_payload));
|
.block_on(|execution_layer| execution_layer.notify_new_payload(execution_payload));
|
||||||
|
|
||||||
match execute_payload_response {
|
match notify_new_payload_response {
|
||||||
Ok((status, _latest_valid_hash)) => match status {
|
Ok((status, _latest_valid_hash)) => match status {
|
||||||
ExecutePayloadResponseStatus::Valid => Ok(PayloadVerificationStatus::Verified),
|
ExecutePayloadResponseStatus::Valid => Ok(PayloadVerificationStatus::Verified),
|
||||||
// TODO(merge): invalidate any invalid ancestors of this block in fork choice.
|
// TODO(merge): invalidate any invalid ancestors of this block in fork choice.
|
||||||
|
@ -55,7 +55,7 @@ pub trait EngineApi {
|
|||||||
block_hash: Hash256,
|
block_hash: Hash256,
|
||||||
) -> Result<Option<ExecutionBlock>, Error>;
|
) -> Result<Option<ExecutionBlock>, Error>;
|
||||||
|
|
||||||
async fn execute_payload_v1<T: EthSpec>(
|
async fn notify_new_payload_v1<T: EthSpec>(
|
||||||
&self,
|
&self,
|
||||||
execution_payload: ExecutionPayload<T>,
|
execution_payload: ExecutionPayload<T>,
|
||||||
) -> Result<ExecutePayloadResponse, Error>;
|
) -> Result<ExecutePayloadResponse, Error>;
|
||||||
|
@ -133,7 +133,7 @@ impl EngineApi for HttpJsonRpc {
|
|||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn execute_payload_v1<T: EthSpec>(
|
async fn notify_new_payload_v1<T: EthSpec>(
|
||||||
&self,
|
&self,
|
||||||
execution_payload: ExecutionPayload<T>,
|
execution_payload: ExecutionPayload<T>,
|
||||||
) -> Result<ExecutePayloadResponse, Error> {
|
) -> Result<ExecutePayloadResponse, Error> {
|
||||||
@ -486,16 +486,16 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn execute_payload_v1_request() {
|
async fn notify_new_payload_v1_request() {
|
||||||
Tester::new()
|
Tester::new()
|
||||||
.assert_request_equals(
|
.assert_request_equals(
|
||||||
|client| async move {
|
|client| async move {
|
||||||
let _ = client
|
let _ = client
|
||||||
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload {
|
.notify_new_payload_v1::<MainnetEthSpec>(ExecutionPayload {
|
||||||
parent_hash: Hash256::repeat_byte(0),
|
parent_hash: Hash256::repeat_byte(0),
|
||||||
fee_recipient: Address::repeat_byte(1),
|
fee_recipient: Address::repeat_byte(1),
|
||||||
state_root: Hash256::repeat_byte(1),
|
state_root: Hash256::repeat_byte(1),
|
||||||
receipt_root: Hash256::repeat_byte(0),
|
receipts_root: Hash256::repeat_byte(0),
|
||||||
logs_bloom: vec![1; 256].into(),
|
logs_bloom: vec![1; 256].into(),
|
||||||
random: Hash256::repeat_byte(1),
|
random: Hash256::repeat_byte(1),
|
||||||
block_number: 0,
|
block_number: 0,
|
||||||
@ -702,7 +702,7 @@ mod test {
|
|||||||
parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(),
|
parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(),
|
||||||
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||||
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
|
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
|
||||||
receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
receipts_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||||
logs_bloom: vec![0; 256].into(),
|
logs_bloom: vec![0; 256].into(),
|
||||||
random: Hash256::zero(),
|
random: Hash256::zero(),
|
||||||
block_number: 1,
|
block_number: 1,
|
||||||
@ -723,11 +723,11 @@ mod test {
|
|||||||
// engine_executePayloadV1 REQUEST validation
|
// engine_executePayloadV1 REQUEST validation
|
||||||
|client| async move {
|
|client| async move {
|
||||||
let _ = client
|
let _ = client
|
||||||
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload {
|
.notify_new_payload_v1::<MainnetEthSpec>(ExecutionPayload {
|
||||||
parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(),
|
parent_hash: Hash256::from_str("0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a").unwrap(),
|
||||||
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
fee_recipient: Address::from_str("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b").unwrap(),
|
||||||
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
|
state_root: Hash256::from_str("0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45").unwrap(),
|
||||||
receipt_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
receipts_root: Hash256::from_str("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421").unwrap(),
|
||||||
logs_bloom: vec![0; 256].into(),
|
logs_bloom: vec![0; 256].into(),
|
||||||
random: Hash256::zero(),
|
random: Hash256::zero(),
|
||||||
block_number: 1,
|
block_number: 1,
|
||||||
@ -776,7 +776,7 @@ mod test {
|
|||||||
})],
|
})],
|
||||||
|client| async move {
|
|client| async move {
|
||||||
let response = client
|
let response = client
|
||||||
.execute_payload_v1::<MainnetEthSpec>(ExecutionPayload::default())
|
.notify_new_payload_v1::<MainnetEthSpec>(ExecutionPayload::default())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
|
|||||||
parent_hash,
|
parent_hash,
|
||||||
fee_recipient,
|
fee_recipient,
|
||||||
state_root,
|
state_root,
|
||||||
receipt_root,
|
receipts_root,
|
||||||
logs_bloom,
|
logs_bloom,
|
||||||
random,
|
random,
|
||||||
block_number,
|
block_number,
|
||||||
@ -106,7 +106,7 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
|
|||||||
parent_hash,
|
parent_hash,
|
||||||
fee_recipient,
|
fee_recipient,
|
||||||
state_root,
|
state_root,
|
||||||
receipts_root: receipt_root,
|
receipts_root,
|
||||||
logs_bloom,
|
logs_bloom,
|
||||||
random,
|
random,
|
||||||
block_number,
|
block_number,
|
||||||
@ -145,7 +145,7 @@ impl<T: EthSpec> From<JsonExecutionPayloadV1<T>> for ExecutionPayload<T> {
|
|||||||
parent_hash,
|
parent_hash,
|
||||||
fee_recipient,
|
fee_recipient,
|
||||||
state_root,
|
state_root,
|
||||||
receipt_root: receipts_root,
|
receipts_root,
|
||||||
logs_bloom,
|
logs_bloom,
|
||||||
random,
|
random,
|
||||||
block_number,
|
block_number,
|
||||||
|
@ -441,7 +441,7 @@ impl ExecutionLayer {
|
|||||||
.map_err(Error::EngineErrors)
|
.map_err(Error::EngineErrors)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Maps to the `engine_executePayload` JSON-RPC call.
|
/// Maps to the `engine_newPayload` JSON-RPC call.
|
||||||
///
|
///
|
||||||
/// ## Fallback Behaviour
|
/// ## Fallback Behaviour
|
||||||
///
|
///
|
||||||
@ -453,7 +453,7 @@ impl ExecutionLayer {
|
|||||||
/// - Invalid, if any nodes return invalid.
|
/// - Invalid, if any nodes return invalid.
|
||||||
/// - Syncing, if any nodes return syncing.
|
/// - Syncing, if any nodes return syncing.
|
||||||
/// - An error, if all nodes return an error.
|
/// - An error, if all nodes return an error.
|
||||||
pub async fn execute_payload<T: EthSpec>(
|
pub async fn notify_new_payload<T: EthSpec>(
|
||||||
&self,
|
&self,
|
||||||
execution_payload: &ExecutionPayload<T>,
|
execution_payload: &ExecutionPayload<T>,
|
||||||
) -> Result<(ExecutePayloadResponseStatus, Option<Hash256>), Error> {
|
) -> Result<(ExecutePayloadResponseStatus, Option<Hash256>), Error> {
|
||||||
@ -467,7 +467,7 @@ impl ExecutionLayer {
|
|||||||
|
|
||||||
let broadcast_results = self
|
let broadcast_results = self
|
||||||
.engines()
|
.engines()
|
||||||
.broadcast(|engine| engine.api.execute_payload_v1(execution_payload.clone()))
|
.broadcast(|engine| engine.api.notify_new_payload_v1(execution_payload.clone()))
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let mut errors = vec![];
|
let mut errors = vec![];
|
||||||
@ -486,7 +486,7 @@ impl ExecutionLayer {
|
|||||||
id: "unknown".to_string(),
|
id: "unknown".to_string(),
|
||||||
error: engine_api::Error::BadResponse(
|
error: engine_api::Error::BadResponse(
|
||||||
format!(
|
format!(
|
||||||
"execute_payload: response.status = Valid but invalid latest_valid_hash. Expected({:?}) Found({:?})",
|
"notify_new_payload: response.status = Valid but invalid latest_valid_hash. Expected({:?}) Found({:?})",
|
||||||
execution_payload.block_hash,
|
execution_payload.block_hash,
|
||||||
latest_hash,
|
latest_hash,
|
||||||
)
|
)
|
||||||
@ -503,7 +503,7 @@ impl ExecutionLayer {
|
|||||||
Ok((None, status)) => errors.push(EngineError::Api {
|
Ok((None, status)) => errors.push(EngineError::Api {
|
||||||
id: "unknown".to_string(),
|
id: "unknown".to_string(),
|
||||||
error: engine_api::Error::BadResponse(format!(
|
error: engine_api::Error::BadResponse(format!(
|
||||||
"execute_payload: status {:?} returned with null latest_valid_hash",
|
"notify_new_payload: status {:?} returned with null latest_valid_hash",
|
||||||
status
|
status
|
||||||
)),
|
)),
|
||||||
}),
|
}),
|
||||||
@ -515,7 +515,7 @@ impl ExecutionLayer {
|
|||||||
crit!(
|
crit!(
|
||||||
self.log(),
|
self.log(),
|
||||||
"Consensus failure between execution nodes";
|
"Consensus failure between execution nodes";
|
||||||
"method" => "execute_payload"
|
"method" => "notify_new_payload"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
|||||||
self.payload_ids.remove(id)
|
self.payload_ids.remove(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_payload(&mut self, payload: ExecutionPayload<T>) -> ExecutePayloadResponse {
|
pub fn notify_new_payload(&mut self, payload: ExecutionPayload<T>) -> ExecutePayloadResponse {
|
||||||
let parent = if let Some(parent) = self.blocks.get(&payload.parent_hash) {
|
let parent = if let Some(parent) = self.blocks.get(&payload.parent_hash) {
|
||||||
parent
|
parent
|
||||||
} else {
|
} else {
|
||||||
@ -325,7 +325,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
|
|||||||
let mut execution_payload = ExecutionPayload {
|
let mut execution_payload = ExecutionPayload {
|
||||||
parent_hash: forkchoice_state.head_block_hash,
|
parent_hash: forkchoice_state.head_block_hash,
|
||||||
fee_recipient: attributes.suggested_fee_recipient,
|
fee_recipient: attributes.suggested_fee_recipient,
|
||||||
receipt_root: Hash256::repeat_byte(42),
|
receipts_root: Hash256::repeat_byte(42),
|
||||||
state_root: Hash256::repeat_byte(43),
|
state_root: Hash256::repeat_byte(43),
|
||||||
logs_bloom: vec![0; 256].into(),
|
logs_bloom: vec![0; 256].into(),
|
||||||
random: attributes.random,
|
random: attributes.random,
|
||||||
|
@ -57,7 +57,7 @@ pub async fn handle_rpc<T: EthSpec>(
|
|||||||
ENGINE_EXECUTE_PAYLOAD_V1 => {
|
ENGINE_EXECUTE_PAYLOAD_V1 => {
|
||||||
let request: JsonExecutionPayloadV1<T> = get_param(params, 0)?;
|
let request: JsonExecutionPayloadV1<T> = get_param(params, 0)?;
|
||||||
|
|
||||||
let response = if let Some(status) = *ctx.static_execute_payload_response.lock() {
|
let response = if let Some(status) = *ctx.static_notify_new_payload_response.lock() {
|
||||||
match status {
|
match status {
|
||||||
ExecutePayloadResponseStatus::Valid => ExecutePayloadResponse {
|
ExecutePayloadResponseStatus::Valid => ExecutePayloadResponse {
|
||||||
status,
|
status,
|
||||||
@ -74,7 +74,7 @@ pub async fn handle_rpc<T: EthSpec>(
|
|||||||
} else {
|
} else {
|
||||||
ctx.execution_block_generator
|
ctx.execution_block_generator
|
||||||
.write()
|
.write()
|
||||||
.execute_payload(request.into())
|
.notify_new_payload(request.into())
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(serde_json::to_value(JsonExecutePayloadV1Response::from(response)).unwrap())
|
Ok(serde_json::to_value(JsonExecutePayloadV1Response::from(response)).unwrap())
|
||||||
|
@ -146,7 +146,7 @@ impl<T: EthSpec> MockExecutionLayer<T> {
|
|||||||
assert_eq!(payload.random, random);
|
assert_eq!(payload.random, random);
|
||||||
|
|
||||||
let (payload_response, latest_valid_hash) =
|
let (payload_response, latest_valid_hash) =
|
||||||
self.el.execute_payload(&payload).await.unwrap();
|
self.el.notify_new_payload(&payload).await.unwrap();
|
||||||
assert_eq!(payload_response, ExecutePayloadResponseStatus::Valid);
|
assert_eq!(payload_response, ExecutePayloadResponseStatus::Valid);
|
||||||
assert_eq!(latest_valid_hash, Some(payload.block_hash));
|
assert_eq!(latest_valid_hash, Some(payload.block_hash));
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ impl<T: EthSpec> MockServer<T> {
|
|||||||
last_echo_request: last_echo_request.clone(),
|
last_echo_request: last_echo_request.clone(),
|
||||||
execution_block_generator: RwLock::new(execution_block_generator),
|
execution_block_generator: RwLock::new(execution_block_generator),
|
||||||
preloaded_responses,
|
preloaded_responses,
|
||||||
static_execute_payload_response: <_>::default(),
|
static_notify_new_payload_response: <_>::default(),
|
||||||
_phantom: PhantomData,
|
_phantom: PhantomData,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -117,7 +117,8 @@ impl<T: EthSpec> MockServer<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn all_payloads_valid(&self) {
|
pub fn all_payloads_valid(&self) {
|
||||||
*self.ctx.static_execute_payload_response.lock() = Some(ExecutePayloadResponseStatus::Valid)
|
*self.ctx.static_notify_new_payload_response.lock() =
|
||||||
|
Some(ExecutePayloadResponseStatus::Valid)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_pow_block(
|
pub fn insert_pow_block(
|
||||||
@ -187,7 +188,7 @@ pub struct Context<T: EthSpec> {
|
|||||||
pub last_echo_request: Arc<RwLock<Option<Bytes>>>,
|
pub last_echo_request: Arc<RwLock<Option<Bytes>>>,
|
||||||
pub execution_block_generator: RwLock<ExecutionBlockGenerator<T>>,
|
pub execution_block_generator: RwLock<ExecutionBlockGenerator<T>>,
|
||||||
pub preloaded_responses: Arc<Mutex<Vec<serde_json::Value>>>,
|
pub preloaded_responses: Arc<Mutex<Vec<serde_json::Value>>>,
|
||||||
pub static_execute_payload_response: Arc<Mutex<Option<ExecutePayloadResponseStatus>>>,
|
pub static_notify_new_payload_response: Arc<Mutex<Option<ExecutePayloadResponseStatus>>>,
|
||||||
pub _phantom: PhantomData<T>,
|
pub _phantom: PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Gnosis Beacon Chain config
|
# Gnosis Beacon Chain config
|
||||||
|
|
||||||
# Extends the gnosis preset
|
# Extends the gnosis preset
|
||||||
|
CONFIG_NAME: 'gnosis'
|
||||||
PRESET_BASE: 'gnosis'
|
PRESET_BASE: 'gnosis'
|
||||||
|
|
||||||
# Transition
|
# Transition
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Mainnet config
|
# Mainnet config
|
||||||
|
|
||||||
# Extends the mainnet preset
|
# Extends the mainnet preset
|
||||||
|
CONFIG_NAME: 'mainnet'
|
||||||
PRESET_BASE: 'mainnet'
|
PRESET_BASE: 'mainnet'
|
||||||
|
|
||||||
# Transition
|
# Transition
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Prater config
|
# Prater config
|
||||||
|
|
||||||
# Extends the mainnet preset
|
# Extends the mainnet preset
|
||||||
|
CONFIG_NAME: 'prater'
|
||||||
PRESET_BASE: 'mainnet'
|
PRESET_BASE: 'mainnet'
|
||||||
|
|
||||||
# Transition
|
# Transition
|
||||||
|
@ -275,6 +275,7 @@ mod tests {
|
|||||||
"{:?}",
|
"{:?}",
|
||||||
net.name
|
net.name
|
||||||
);
|
);
|
||||||
|
assert_eq!(config.config.config_name, Some(net.name.to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ pub fn process_execution_payload<T: EthSpec>(
|
|||||||
parent_hash: payload.parent_hash,
|
parent_hash: payload.parent_hash,
|
||||||
fee_recipient: payload.fee_recipient,
|
fee_recipient: payload.fee_recipient,
|
||||||
state_root: payload.state_root,
|
state_root: payload.state_root,
|
||||||
receipt_root: payload.receipt_root,
|
receipts_root: payload.receipts_root,
|
||||||
logs_bloom: payload.logs_bloom.clone(),
|
logs_bloom: payload.logs_bloom.clone(),
|
||||||
random: payload.random,
|
random: payload.random,
|
||||||
block_number: payload.block_number,
|
block_number: payload.block_number,
|
||||||
|
@ -28,6 +28,11 @@ pub enum Domain {
|
|||||||
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||||
#[derive(PartialEq, Debug, Clone)]
|
#[derive(PartialEq, Debug, Clone)]
|
||||||
pub struct ChainSpec {
|
pub struct ChainSpec {
|
||||||
|
/*
|
||||||
|
* Config name
|
||||||
|
*/
|
||||||
|
pub config_name: Option<String>,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -405,6 +410,10 @@ impl ChainSpec {
|
|||||||
/// Returns a `ChainSpec` compatible with the Ethereum Foundation specification.
|
/// Returns a `ChainSpec` compatible with the Ethereum Foundation specification.
|
||||||
pub fn mainnet() -> Self {
|
pub fn mainnet() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
/*
|
||||||
|
* Config name
|
||||||
|
*/
|
||||||
|
config_name: Some("mainnet".to_string()),
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -563,6 +572,7 @@ impl ChainSpec {
|
|||||||
let boot_nodes = vec![];
|
let boot_nodes = vec![];
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
config_name: None,
|
||||||
max_committees_per_slot: 4,
|
max_committees_per_slot: 4,
|
||||||
target_committee_size: 4,
|
target_committee_size: 4,
|
||||||
churn_limit_quotient: 32,
|
churn_limit_quotient: 32,
|
||||||
@ -600,6 +610,7 @@ impl ChainSpec {
|
|||||||
/// Returns a `ChainSpec` compatible with the Gnosis Beacon Chain specification.
|
/// Returns a `ChainSpec` compatible with the Gnosis Beacon Chain specification.
|
||||||
pub fn gnosis() -> Self {
|
pub fn gnosis() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
config_name: Some("gnosis".to_string()),
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -763,6 +774,10 @@ impl Default for ChainSpec {
|
|||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
|
||||||
#[serde(rename_all = "UPPERCASE")]
|
#[serde(rename_all = "UPPERCASE")]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
#[serde(default)]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub config_name: Option<String>,
|
||||||
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub preset_base: String,
|
pub preset_base: String,
|
||||||
|
|
||||||
@ -914,6 +929,7 @@ impl Config {
|
|||||||
|
|
||||||
pub fn from_chain_spec<T: EthSpec>(spec: &ChainSpec) -> Self {
|
pub fn from_chain_spec<T: EthSpec>(spec: &ChainSpec) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
config_name: spec.config_name.clone(),
|
||||||
preset_base: T::spec_name().to_string(),
|
preset_base: T::spec_name().to_string(),
|
||||||
|
|
||||||
terminal_total_difficulty: spec.terminal_total_difficulty,
|
terminal_total_difficulty: spec.terminal_total_difficulty,
|
||||||
@ -964,6 +980,7 @@ impl Config {
|
|||||||
pub fn apply_to_chain_spec<T: EthSpec>(&self, chain_spec: &ChainSpec) -> Option<ChainSpec> {
|
pub fn apply_to_chain_spec<T: EthSpec>(&self, chain_spec: &ChainSpec) -> Option<ChainSpec> {
|
||||||
// Pattern match here to avoid missing any fields.
|
// Pattern match here to avoid missing any fields.
|
||||||
let &Config {
|
let &Config {
|
||||||
|
ref config_name,
|
||||||
ref preset_base,
|
ref preset_base,
|
||||||
terminal_total_difficulty,
|
terminal_total_difficulty,
|
||||||
terminal_block_hash,
|
terminal_block_hash,
|
||||||
@ -997,6 +1014,7 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Some(ChainSpec {
|
Some(ChainSpec {
|
||||||
|
config_name: config_name.clone(),
|
||||||
min_genesis_active_validator_count,
|
min_genesis_active_validator_count,
|
||||||
min_genesis_time,
|
min_genesis_time,
|
||||||
genesis_fork_version,
|
genesis_fork_version,
|
||||||
|
@ -46,7 +46,6 @@ impl ConfigAndPreset {
|
|||||||
let u32_hex = |v: u32| hex_string(&v.to_le_bytes());
|
let u32_hex = |v: u32| hex_string(&v.to_le_bytes());
|
||||||
let u8_hex = |v: u8| hex_string(&v.to_le_bytes());
|
let u8_hex = |v: u8| hex_string(&v.to_le_bytes());
|
||||||
let fields = vec![
|
let fields = vec![
|
||||||
("config_name", self.config.preset_base.clone()),
|
|
||||||
(
|
(
|
||||||
"bls_withdrawal_prefix",
|
"bls_withdrawal_prefix",
|
||||||
u8_hex(spec.bls_withdrawal_prefix_byte),
|
u8_hex(spec.bls_withdrawal_prefix_byte),
|
||||||
|
@ -18,7 +18,7 @@ pub struct ExecutionPayload<T: EthSpec> {
|
|||||||
pub parent_hash: Hash256,
|
pub parent_hash: Hash256,
|
||||||
pub fee_recipient: Address,
|
pub fee_recipient: Address,
|
||||||
pub state_root: Hash256,
|
pub state_root: Hash256,
|
||||||
pub receipt_root: Hash256,
|
pub receipts_root: Hash256,
|
||||||
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
|
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
|
||||||
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
||||||
pub random: Hash256,
|
pub random: Hash256,
|
||||||
|
@ -12,7 +12,7 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
|
|||||||
pub parent_hash: Hash256,
|
pub parent_hash: Hash256,
|
||||||
pub fee_recipient: Address,
|
pub fee_recipient: Address,
|
||||||
pub state_root: Hash256,
|
pub state_root: Hash256,
|
||||||
pub receipt_root: Hash256,
|
pub receipts_root: Hash256,
|
||||||
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
|
#[serde(with = "ssz_types::serde_utils::hex_fixed_vec")]
|
||||||
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
pub logs_bloom: FixedVector<u8, T::BytesPerLogsBloom>,
|
||||||
pub random: Hash256,
|
pub random: Hash256,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
TESTS_TAG := v1.1.8
|
TESTS_TAG := v1.1.9
|
||||||
TESTS = general minimal mainnet
|
TESTS = general minimal mainnet
|
||||||
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))
|
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))
|
||||||
|
|
||||||
|
@ -307,11 +307,6 @@ pub struct RandomHandler<E>(PhantomData<E>);
|
|||||||
impl<E: EthSpec + TypeName> Handler for RandomHandler<E> {
|
impl<E: EthSpec + TypeName> Handler for RandomHandler<E> {
|
||||||
type Case = cases::SanityBlocks<E>;
|
type Case = cases::SanityBlocks<E>;
|
||||||
|
|
||||||
// FIXME(merge): enable merge tests once available
|
|
||||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
|
||||||
fork_name != ForkName::Merge
|
|
||||||
}
|
|
||||||
|
|
||||||
fn config_name() -> &'static str {
|
fn config_name() -> &'static str {
|
||||||
E::name()
|
E::name()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user