Skip to content

Add ExecutionWitness to the ExecutionPayload to support the Verge #3923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
231 changes: 124 additions & 107 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ slot_clock = { path = "../../common/slot_clock" }
eth2_hashing = "0.3.0"
eth2_ssz = "0.4.1"
eth2_ssz_types = "0.2.2"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
state_processing = { path = "../../consensus/state_processing" }
tree_hash = "0.4.1"
types = { path = "../../consensus/types" }
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/beacon_chain/src/merge_readiness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
};
}

if !el.is_synced_for_notifier().await {
if !el.is_synced().await {
// The EL is not synced.
return MergeReadiness::NotSynced;
}
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/eth1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ hex = "0.4.2"
types = { path = "../../consensus/types"}
merkle_proof = { path = "../../consensus/merkle_proof"}
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
tree_hash = "0.4.1"
parking_lot = "0.12.0"
slog = "2.5.2"
Expand Down
6 changes: 4 additions & 2 deletions beacon_node/execution_layer/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use reqwest::StatusCode;
use serde::{Deserialize, Serialize};
use strum::IntoStaticStr;
pub use types::{
Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader, FixedVector,
Hash256, Uint256, VariableList,
Address, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadHeader,
ExecutionWitness, FixedVector, Hash256, Uint256, VariableList,
};

pub mod auth;
Expand Down Expand Up @@ -114,6 +114,7 @@ pub struct ExecutionBlock {
/// Representation of an exection block with enough detail to reconstruct a payload.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(bound = "T: EthSpec")]
pub struct ExecutionBlockWithTransactions<T: EthSpec> {
pub parent_hash: ExecutionBlockHash,
#[serde(alias = "miner")]
Expand All @@ -138,6 +139,7 @@ pub struct ExecutionBlockWithTransactions<T: EthSpec> {
#[serde(rename = "hash")]
pub block_hash: ExecutionBlockHash,
pub transactions: Vec<Transaction>,
pub execution_witness: ExecutionWitness<T>,
}

#[derive(Clone, Copy, Debug, PartialEq)]
Expand Down
14 changes: 11 additions & 3 deletions beacon_node/execution_layer/src/engine_api/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ mod test {
"extraData": "0x",
"baseFeePerGas": "0x1",
"blockHash": HASH_01,
"executionWitness": "null",
});
// Take advantage of the fact that we own `transactions` and don't need to reserialize it.
json.as_object_mut()
Expand Down Expand Up @@ -1124,6 +1125,7 @@ mod test {
base_fee_per_gas: Uint256::from(1),
block_hash: ExecutionBlockHash::repeat_byte(1),
transactions: vec![].into(),
execution_witness: ExecutionWitness::default(),
})
.await;
},
Expand All @@ -1146,6 +1148,7 @@ mod test {
"baseFeePerGas": "0x1",
"blockHash": HASH_01,
"transactions": [],
"executionWitness": "null",
}]
}),
)
Expand All @@ -1169,6 +1172,7 @@ mod test {
base_fee_per_gas: Uint256::from(1),
block_hash: ExecutionBlockHash::repeat_byte(1),
transactions: vec![].into(),
execution_witness: ExecutionWitness::default(),
})
.await
})
Expand Down Expand Up @@ -1353,7 +1357,8 @@ mod test {
"extraData":"0x",
"baseFeePerGas":"0x7",
"blockHash":"0x6359b8381a370e2f54072a5784ddd78b6ed024991558c511d4452eb4f6ac898c",
"transactions":[]
"transactions":[],
"executionWitness": "null",
}
})],
|client| async move {
Expand All @@ -1376,7 +1381,8 @@ mod test {
extra_data: vec![].into(),
base_fee_per_gas: Uint256::from(7),
block_hash: ExecutionBlockHash::from_str("0x6359b8381a370e2f54072a5784ddd78b6ed024991558c511d4452eb4f6ac898c").unwrap(),
transactions: vec![].into(),
transactions: vec![].into(),
execution_witness: ExecutionWitness::default(),
};

assert_eq!(payload, expected);
Expand All @@ -1402,6 +1408,7 @@ mod test {
base_fee_per_gas: Uint256::from(7),
block_hash: ExecutionBlockHash::from_str("0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858").unwrap(),
transactions: vec![].into(),
execution_witness: ExecutionWitness::default(),
})
.await;
},
Expand All @@ -1423,7 +1430,8 @@ mod test {
"extraData":"0x",
"baseFeePerGas":"0x7",
"blockHash":"0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858",
"transactions":[]
"transactions":[],
"executionWitness":"null",
}],
})
)
Expand Down
12 changes: 11 additions & 1 deletion beacon_node/execution_layer/src/engine_api/json_structures.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use super::*;
use serde::{Deserialize, Serialize};
use strum::EnumString;
use types::{EthSpec, ExecutionBlockHash, FixedVector, Transaction, Unsigned, VariableList};
use types::{
EthSpec, ExecutionBlockHash, ExecutionWitness, FixedVector, Transaction, Unsigned, VariableList,
};

#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down Expand Up @@ -80,6 +82,7 @@ pub struct JsonExecutionPayloadHeaderV1<T: EthSpec> {
pub base_fee_per_gas: Uint256,
pub block_hash: ExecutionBlockHash,
pub transactions_root: Hash256,
pub execution_witness_root: Hash256,
}

impl<T: EthSpec> From<JsonExecutionPayloadHeaderV1<T>> for ExecutionPayloadHeader<T> {
Expand All @@ -100,6 +103,7 @@ impl<T: EthSpec> From<JsonExecutionPayloadHeaderV1<T>> for ExecutionPayloadHeade
base_fee_per_gas,
block_hash,
transactions_root,
execution_witness_root,
} = e;

Self {
Expand All @@ -117,6 +121,7 @@ impl<T: EthSpec> From<JsonExecutionPayloadHeaderV1<T>> for ExecutionPayloadHeade
base_fee_per_gas,
block_hash,
transactions_root,
execution_witness_root,
}
}
}
Expand Down Expand Up @@ -147,6 +152,7 @@ pub struct JsonExecutionPayloadV1<T: EthSpec> {
#[serde(with = "ssz_types::serde_utils::list_of_hex_var_list")]
pub transactions:
VariableList<Transaction<T::MaxBytesPerTransaction>, T::MaxTransactionsPerPayload>,
pub execution_witness: ExecutionWitness<T>,
}

impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
Expand All @@ -167,6 +173,7 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
base_fee_per_gas,
block_hash,
transactions,
execution_witness,
} = e;

Self {
Expand All @@ -184,6 +191,7 @@ impl<T: EthSpec> From<ExecutionPayload<T>> for JsonExecutionPayloadV1<T> {
base_fee_per_gas,
block_hash,
transactions,
execution_witness,
}
}
}
Expand All @@ -206,6 +214,7 @@ impl<T: EthSpec> From<JsonExecutionPayloadV1<T>> for ExecutionPayload<T> {
base_fee_per_gas,
block_hash,
transactions,
execution_witness,
} = e;

Self {
Expand All @@ -223,6 +232,7 @@ impl<T: EthSpec> From<JsonExecutionPayloadV1<T>> for ExecutionPayload<T> {
base_fee_per_gas,
block_hash,
transactions,
execution_witness,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions beacon_node/execution_layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ impl<T: EthSpec> ExecutionLayer<T> {
base_fee_per_gas: block.base_fee_per_gas,
block_hash: block.block_hash,
transactions,
execution_witness: block.execution_witness,
}))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use tree_hash::TreeHash;
use tree_hash_derive::TreeHash;
use types::{EthSpec, ExecutionBlockHash, ExecutionPayload, Hash256, Uint256};
use types::{EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionWitness, Hash256, Uint256};

const GAS_LIMIT: u64 = 16384;
const GAS_USED: u64 = GAS_LIMIT - 1;
Expand Down Expand Up @@ -89,6 +89,7 @@ impl<T: EthSpec> Block<T> {
base_fee_per_gas: payload.base_fee_per_gas,
block_hash: payload.block_hash,
transactions: vec![],
execution_witness: payload.execution_witness.clone(),
}),
Block::PoW(_) => None,
}
Expand Down Expand Up @@ -477,6 +478,7 @@ impl<T: EthSpec> ExecutionBlockGenerator<T> {
base_fee_per_gas: Uint256::one(),
block_hash: ExecutionBlockHash::zero(),
transactions: vec![].into(),
execution_witness: ExecutionWitness::default(),
};

execution_payload.block_hash =
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ eth2_ssz_types = "0.2.2"
serde = { version = "1.0.116", features = ["derive"] }
serde_derive = "1.0.116"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
slog = { version = "2.5.2", features = ["max_level_trace"] }
lighthouse_version = { path = "../../common/lighthouse_version" }
tokio = { version = "1.14.0", features = ["time", "macros"] }
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/operation_pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ parking_lot = "0.12.0"
types = { path = "../../consensus/types" }
state_processing = { path = "../../consensus/state_processing" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
rayon = "1.5.0"
serde = "1.0.116"
serde_derive = "1.0.116"
Expand Down
2 changes: 1 addition & 1 deletion beacon_node/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ leveldb = { version = "0.8.6", default-features = false }
parking_lot = "0.12.0"
itertools = "0.10.0"
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
types = { path = "../../consensus/types" }
state_processing = { path = "../../consensus/state_processing" }
slog = "2.5.2"
Expand Down
2 changes: 1 addition & 1 deletion common/eth2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bytes = "1.0.1"
account_utils = { path = "../../common/account_utils" }
sensitive_url = { path = "../../common/sensitive_url" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
futures-util = "0.3.8"
futures = "0.3.8"
store = { path = "../../beacon_node/store", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion consensus/cached_tree_hash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
ethereum-types = "0.14.1"
eth2_ssz_types = "0.2.2"
eth2_hashing = "0.3.0"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
eth2_ssz = "0.4.1"
tree_hash = "0.4.1"
smallvec = "1.6.1"
Expand Down
2 changes: 1 addition & 1 deletion consensus/fork_choice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ types = { path = "../types" }
state_processing = { path = "../state_processing" }
proto_array = { path = "../proto_array" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
slog = { version = "2.5.2", features = ["max_level_trace", "release_max_level_trace"] }

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion consensus/proto_array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ path = "src/bin.rs"
[dependencies]
types = { path = "../types" }
eth2_ssz = "0.4.1"
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_yaml = "0.8.13"
Expand Down
2 changes: 1 addition & 1 deletion consensus/ssz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "Apache-2.0"
name = "ssz"

[dev-dependencies]
eth2_ssz_derive = "0.3.0"
eth2_ssz_derive = "0.3.1"

[dependencies]
ethereum-types = "0.14.1"
Expand Down
Loading