Rename eip4844 to deneb (#4129)

* rename 4844 to deneb

* rename 4844 to deneb

* move excess data gas field

* get EF tests working

* fix ef tests lint

* fix the blob identifier ef test

* fix accessed files ef test script

* get beacon chain tests passing
This commit is contained in:
realbigsean
2023-03-26 11:49:16 -04:00
committed by GitHub
parent d84117c0d0
commit a5addf661c
90 changed files with 572 additions and 549 deletions

View File

@@ -53,7 +53,7 @@ pub fn slash_validator<T: EthSpec>(
BeaconState::Altair(_)
| BeaconState::Merge(_)
| BeaconState::Capella(_)
| BeaconState::Eip4844(_) => whistleblower_reward
| BeaconState::Deneb(_) => whistleblower_reward
.safe_mul(PROPOSER_WEIGHT)?
.safe_div(WEIGHT_DENOMINATOR)?,
};

View File

@@ -3,7 +3,7 @@ use super::per_block_processing::{
};
use crate::common::DepositDataTree;
use crate::upgrade::{
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_eip4844,
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb,
};
use safe_arith::{ArithError, SafeArith};
use tree_hash::TreeHash;
@@ -93,20 +93,20 @@ pub fn initialize_beacon_state_from_eth1<T: EthSpec>(
}
}
// Upgrade to eip4844 if configured from genesis
// Upgrade to deneb if configured from genesis
if spec
.eip4844_fork_epoch
.deneb_fork_epoch
.map_or(false, |fork_epoch| fork_epoch == T::genesis_epoch())
{
upgrade_to_eip4844(&mut state, spec)?;
upgrade_to_deneb(&mut state, spec)?;
// Remove intermediate Capella fork from `state.fork`.
state.fork_mut().previous_version = spec.eip4844_fork_version;
state.fork_mut().previous_version = spec.deneb_fork_version;
// Override latest execution payload header.
// See https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/beacon-chain.md#testing
if let Some(ExecutionPayloadHeader::Eip4844(header)) = execution_payload_header {
*state.latest_execution_payload_header_eip4844_mut()? = header;
// See https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/beacon-chain.md#testing
if let Some(ExecutionPayloadHeader::Deneb(header)) = execution_payload_header {
*state.latest_execution_payload_header_deneb_mut()? = header;
}
}

View File

@@ -13,7 +13,7 @@ pub use self::verify_attester_slashing::{
pub use self::verify_proposer_slashing::verify_proposer_slashing;
pub use altair::sync_committee::process_sync_aggregate;
pub use block_signature_verifier::{BlockSignatureVerifier, ParallelSignatureSets};
pub use eip4844::eip4844::process_blob_kzg_commitments;
pub use deneb::deneb::process_blob_kzg_commitments;
pub use is_valid_indexed_attestation::is_valid_indexed_attestation;
pub use process_operations::process_operations;
pub use verify_attestation::{
@@ -27,7 +27,7 @@ pub use verify_exit::verify_exit;
pub mod altair;
pub mod block_signature_verifier;
pub mod eip4844;
pub mod deneb;
pub mod errors;
mod is_valid_indexed_attestation;
pub mod process_operations;
@@ -405,9 +405,9 @@ pub fn process_execution_payload<T: EthSpec, Payload: AbstractExecPayload<T>>(
_ => return Err(BlockProcessingError::IncorrectStateType),
}
}
ExecutionPayloadHeaderRefMut::Eip4844(header_mut) => {
ExecutionPayloadHeaderRefMut::Deneb(header_mut) => {
match payload.to_execution_payload_header() {
ExecutionPayloadHeader::Eip4844(header) => *header_mut = header,
ExecutionPayloadHeader::Deneb(header) => *header_mut = header,
_ => return Err(BlockProcessingError::IncorrectStateType),
}
}
@@ -523,7 +523,7 @@ pub fn process_withdrawals<T: EthSpec, Payload: AbstractExecPayload<T>>(
) -> Result<(), BlockProcessingError> {
match state {
BeaconState::Merge(_) => Ok(()),
BeaconState::Capella(_) | BeaconState::Eip4844(_) => {
BeaconState::Capella(_) | BeaconState::Deneb(_) => {
let expected_withdrawals = get_expected_withdrawals(state, spec)?;
let expected_root = expected_withdrawals.tree_hash_root();
let withdrawals_root = payload.withdrawals_root()?;

View File

@@ -1,2 +1,2 @@
#[allow(clippy::module_inception)]
pub mod eip4844;
pub mod deneb;

View File

@@ -3,7 +3,7 @@ use eth2_hashing::hash_fixed;
use itertools::{EitherOrBoth, Itertools};
use safe_arith::SafeArith;
use ssz::Decode;
use types::consts::eip4844::{BLOB_TX_TYPE, VERSIONED_HASH_VERSION_KZG};
use types::consts::deneb::{BLOB_TX_TYPE, VERSIONED_HASH_VERSION_KZG};
use types::{
AbstractExecPayload, BeaconBlockBodyRef, EthSpec, ExecPayload, KzgCommitment, Transaction,
Transactions, VersionedHash,

View File

@@ -257,7 +257,7 @@ pub fn process_attestations<T: EthSpec, Payload: AbstractExecPayload<T>>(
BeaconBlockBodyRef::Altair(_)
| BeaconBlockBodyRef::Merge(_)
| BeaconBlockBodyRef::Capella(_)
| BeaconBlockBodyRef::Eip4844(_) => {
| BeaconBlockBodyRef::Deneb(_) => {
altair::process_attestations(
state,
block_body.attestations(),

View File

@@ -40,7 +40,7 @@ pub fn process_epoch<T: EthSpec>(
match state {
BeaconState::Base(_) => base::process_epoch(state, spec),
BeaconState::Altair(_) | BeaconState::Merge(_) => altair::process_epoch(state, spec),
BeaconState::Capella(_) | BeaconState::Eip4844(_) => capella::process_epoch(state, spec),
BeaconState::Capella(_) | BeaconState::Deneb(_) => capella::process_epoch(state, spec),
}
}

View File

@@ -1,5 +1,5 @@
use crate::upgrade::{
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_eip4844,
upgrade_to_altair, upgrade_to_bellatrix, upgrade_to_capella, upgrade_to_deneb,
};
use crate::{per_epoch_processing::EpochProcessingSummary, *};
use safe_arith::{ArithError, SafeArith};
@@ -61,9 +61,9 @@ pub fn per_slot_processing<T: EthSpec>(
if spec.capella_fork_epoch == Some(state.current_epoch()) {
upgrade_to_capella(state, spec)?;
}
// Eip4844
if spec.eip4844_fork_epoch == Some(state.current_epoch()) {
upgrade_to_eip4844(state, spec)?;
// Deneb
if spec.deneb_fork_epoch == Some(state.current_epoch()) {
upgrade_to_deneb(state, spec)?;
}
}

View File

@@ -1,9 +1,9 @@
pub mod altair;
pub mod capella;
pub mod eip4844;
pub mod deneb;
pub mod merge;
pub use altair::upgrade_to_altair;
pub use capella::upgrade_to_capella;
pub use eip4844::upgrade_to_eip4844;
pub use deneb::upgrade_to_deneb;
pub use merge::upgrade_to_bellatrix;

View File

@@ -1,8 +1,8 @@
use std::mem;
use types::{BeaconState, BeaconStateEip4844, BeaconStateError as Error, ChainSpec, EthSpec, Fork};
use types::{BeaconState, BeaconStateDeneb, BeaconStateError as Error, ChainSpec, EthSpec, Fork};
/// Transform a `Capella` state into an `Eip4844` state.
pub fn upgrade_to_eip4844<E: EthSpec>(
/// Transform a `Capella` state into an `Deneb` state.
pub fn upgrade_to_deneb<E: EthSpec>(
pre_state: &mut BeaconState<E>,
spec: &ChainSpec,
) -> Result<(), Error> {
@@ -16,14 +16,14 @@ pub fn upgrade_to_eip4844<E: EthSpec>(
//
// Fixed size vectors get cloned because replacing them would require the same size
// allocation as cloning.
let post = BeaconState::Eip4844(BeaconStateEip4844 {
let post = BeaconState::Deneb(BeaconStateDeneb {
// Versioning
genesis_time: pre.genesis_time,
genesis_validators_root: pre.genesis_validators_root,
slot: pre.slot,
fork: Fork {
previous_version: previous_fork_version,
current_version: spec.eip4844_fork_version,
current_version: spec.deneb_fork_version,
epoch,
},
// History
@@ -56,7 +56,7 @@ pub fn upgrade_to_eip4844<E: EthSpec>(
current_sync_committee: pre.current_sync_committee.clone(),
next_sync_committee: pre.next_sync_committee.clone(),
// Execution
latest_execution_payload_header: pre.latest_execution_payload_header.upgrade_to_eip4844(),
latest_execution_payload_header: pre.latest_execution_payload_header.upgrade_to_deneb(),
// Capella
next_withdrawal_index: pre.next_withdrawal_index,
next_withdrawal_validator_index: pre.next_withdrawal_validator_index,