Changes for devnet-8 (#4518)

* Addressed #4487

Add override threshold flag
Added tests for Override Threshold Flag
Override default shown in decimal

* Addressed #4445

Addressed Jimmy's Comments
No need for matches
Fix Mock Execution Engine Tests
Fix clippy
fix fcuv3 bug

* Fix Block Root Calculation post-Deneb

* Addressed #4444

Attestation Verification Post-Deneb
Fix Gossip Attestation Verification Test

* Addressed #4443

Fix Exit Signing for EIP-7044
Fix cross exit test
Move 7044 Logic to signing_context()

* Update EF Tests

* Addressed #4560

* Added Comments around EIP7045

* Combine Altair Deneb to Eliminate Duplicated Code
This commit is contained in:
ethDreamer
2023-08-09 14:44:47 -05:00
committed by GitHub
parent 02c7a2eaf5
commit 2b5385fb46
36 changed files with 843 additions and 281 deletions

View File

@@ -26,8 +26,9 @@ use metastruct::metastruct;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[metastruct(mappings(map_execution_block_header_fields_except_withdrawals(exclude(
withdrawals_root,
data_gas_used,
excess_data_gas
blob_gas_used,
excess_blob_gas,
parent_beacon_block_root
)),))]
pub struct ExecutionBlockHeader {
pub parent_hash: Hash256,
@@ -47,8 +48,9 @@ pub struct ExecutionBlockHeader {
pub nonce: Hash64,
pub base_fee_per_gas: Uint256,
pub withdrawals_root: Option<Hash256>,
pub data_gas_used: Option<u64>,
pub excess_data_gas: Option<u64>,
pub blob_gas_used: Option<u64>,
pub excess_blob_gas: Option<u64>,
pub parent_beacon_block_root: Option<Hash256>,
}
impl ExecutionBlockHeader {
@@ -57,8 +59,9 @@ impl ExecutionBlockHeader {
rlp_empty_list_root: Hash256,
rlp_transactions_root: Hash256,
rlp_withdrawals_root: Option<Hash256>,
rlp_data_gas_used: Option<u64>,
rlp_excess_data_gas: Option<u64>,
rlp_blob_gas_used: Option<u64>,
rlp_excess_blob_gas: Option<u64>,
rlp_parent_beacon_block_root: Option<Hash256>,
) -> Self {
// Most of these field mappings are defined in EIP-3675 except for `mixHash`, which is
// defined in EIP-4399.
@@ -80,8 +83,9 @@ impl ExecutionBlockHeader {
nonce: Hash64::zero(),
base_fee_per_gas: payload.base_fee_per_gas(),
withdrawals_root: rlp_withdrawals_root,
data_gas_used: rlp_data_gas_used,
excess_data_gas: rlp_excess_data_gas,
blob_gas_used: rlp_blob_gas_used,
excess_blob_gas: rlp_excess_blob_gas,
parent_beacon_block_root: rlp_parent_beacon_block_root,
}
}
}

View File

@@ -83,14 +83,12 @@ pub struct ExecutionPayload<T: EthSpec> {
pub transactions: Transactions<T>,
#[superstruct(only(Capella, Deneb))]
pub withdrawals: Withdrawals<T>,
#[superstruct(only(Deneb))]
#[superstruct(only(Deneb), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub data_gas_used: u64,
#[superstruct(only(Deneb))]
pub blob_gas_used: u64,
#[superstruct(only(Deneb), partial_getter(copy))]
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub excess_data_gas: u64,
pub excess_blob_gas: u64,
}
impl<'a, T: EthSpec> ExecutionPayloadRef<'a, T> {

View File

@@ -80,11 +80,11 @@ pub struct ExecutionPayloadHeader<T: EthSpec> {
#[superstruct(only(Deneb))]
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub data_gas_used: u64,
pub blob_gas_used: u64,
#[superstruct(only(Deneb))]
#[serde(with = "serde_utils::quoted_u64")]
#[superstruct(getter(copy))]
pub excess_data_gas: u64,
pub excess_blob_gas: u64,
}
impl<T: EthSpec> ExecutionPayloadHeader<T> {
@@ -155,8 +155,8 @@ impl<T: EthSpec> ExecutionPayloadHeaderCapella<T> {
block_hash: self.block_hash,
transactions_root: self.transactions_root,
withdrawals_root: self.withdrawals_root,
data_gas_used: 0,
excess_data_gas: 0,
blob_gas_used: 0,
excess_blob_gas: 0,
}
}
}
@@ -221,8 +221,8 @@ impl<'a, T: EthSpec> From<&'a ExecutionPayloadDeneb<T>> for ExecutionPayloadHead
block_hash: payload.block_hash,
transactions_root: payload.transactions.tree_hash_root(),
withdrawals_root: payload.withdrawals.tree_hash_root(),
data_gas_used: payload.data_gas_used,
excess_data_gas: payload.excess_data_gas,
blob_gas_used: payload.blob_gas_used,
excess_blob_gas: payload.excess_blob_gas,
}
}
}

View File

@@ -1,5 +1,5 @@
use crate::{
test_utils::TestRandom, ChainSpec, Domain, Epoch, Fork, Hash256, SecretKey, SignedRoot,
test_utils::TestRandom, ChainSpec, Domain, Epoch, ForkName, Hash256, SecretKey, SignedRoot,
SignedVoluntaryExit,
};
@@ -37,16 +37,20 @@ impl VoluntaryExit {
pub fn sign(
self,
secret_key: &SecretKey,
fork: &Fork,
genesis_validators_root: Hash256,
spec: &ChainSpec,
) -> SignedVoluntaryExit {
let domain = spec.get_domain(
self.epoch,
Domain::VoluntaryExit,
fork,
genesis_validators_root,
);
let fork_name = spec.fork_name_at_epoch(self.epoch);
let fork_version = match fork_name {
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {
spec.fork_version_for_name(fork_name)
}
// EIP-7044
ForkName::Deneb => spec.fork_version_for_name(ForkName::Capella),
};
let domain =
spec.compute_domain(Domain::VoluntaryExit, fork_version, genesis_validators_root);
let message = self.signing_root(domain);
SignedVoluntaryExit {
message: self,