From 4cdf1b546d368599d3825c99d0c43f2f2da94604 Mon Sep 17 00:00:00 2001 From: realbigsean Date: Sat, 19 Feb 2022 11:42:11 -0700 Subject: [PATCH] add shanghai fork version and epoch --- beacon_node/lighthouse_network/src/config.rs | 2 +- .../src/rpc/codec/ssz_snappy.rs | 18 ++++-- .../lighthouse_network/src/types/pubsub.rs | 8 +-- .../process_operations.rs | 2 +- consensus/types/src/beacon_block.rs | 12 ++-- consensus/types/src/beacon_block_body.rs | 10 +-- ...con_block_and_blobs.rs => blob_wrapper.rs} | 11 ++-- consensus/types/src/chain_spec.rs | 63 +++++++++++++++---- consensus/types/src/eth_spec.rs | 2 +- consensus/types/src/fork_context.rs | 7 +++ consensus/types/src/fork_name.rs | 17 +++-- consensus/types/src/lib.rs | 10 +-- consensus/types/src/signed_beacon_block.rs | 10 +-- testing/ef_tests/src/cases/common.rs | 2 +- .../ef_tests/src/cases/epoch_processing.rs | 2 +- testing/ef_tests/src/cases/fork.rs | 2 +- testing/ef_tests/src/cases/transition.rs | 7 +-- .../src/signing_method/web3signer.rs | 4 +- 18 files changed, 121 insertions(+), 68 deletions(-) rename consensus/types/src/{beacon_block_and_blobs.rs => blob_wrapper.rs} (58%) diff --git a/beacon_node/lighthouse_network/src/config.rs b/beacon_node/lighthouse_network/src/config.rs index ca2178432..05139e558 100644 --- a/beacon_node/lighthouse_network/src/config.rs +++ b/beacon_node/lighthouse_network/src/config.rs @@ -297,7 +297,7 @@ pub fn gossipsub_config(network_load: u8, fork_context: Arc) -> Gos // according to: https://github.com/ethereum/consensus-specs/blob/dev/specs/merge/p2p-interface.md#the-gossip-domain-gossipsub // the derivation of the message-id remains the same in the merge //TODO(sean): figure this out - ForkName::Altair | ForkName::Merge | ForkName::Dank => { + ForkName::Altair | ForkName::Merge | ForkName::Shanghai => { let topic_len_bytes = topic_bytes.len().to_le_bytes(); let mut vec = Vec::with_capacity( prefix.len() + topic_len_bytes.len() + topic_bytes.len() + message.data.len(), diff --git a/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs b/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs index 699d877ef..9c84305e4 100644 --- a/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs +++ b/beacon_node/lighthouse_network/src/rpc/codec/ssz_snappy.rs @@ -17,7 +17,7 @@ use std::sync::Arc; use tokio_util::codec::{Decoder, Encoder}; use types::{ EthSpec, ForkContext, ForkName, SignedBeaconBlock, SignedBeaconBlockAltair, - SignedBeaconBlockBase, SignedBeaconBlockDank, SignedBeaconBlockMerge, + SignedBeaconBlockBase, SignedBeaconBlockMerge, SignedBeaconBlockShanghai, }; use unsigned_varint::codec::Uvi; @@ -407,7 +407,9 @@ fn context_bytes( return match **ref_box_block { // NOTE: If you are adding another fork type here, be sure to modify the // `fork_context.to_context_bytes()` function to support it as well! - SignedBeaconBlock::Dank { .. } => fork_context.to_context_bytes(ForkName::Dank), + SignedBeaconBlock::Shanghai { .. } => { + fork_context.to_context_bytes(ForkName::Shanghai) + } SignedBeaconBlock::Merge { .. } => { // Merge context being `None` implies that "merge never happened". fork_context.to_context_bytes(ForkName::Merge) @@ -587,8 +589,10 @@ fn handle_v2_response( decoded_buffer, )?), )))), - ForkName::Dank => Ok(Some(RPCResponse::BlocksByRange(Box::new( - SignedBeaconBlock::Dank(SignedBeaconBlockDank::from_ssz_bytes(decoded_buffer)?), + ForkName::Shanghai => Ok(Some(RPCResponse::BlocksByRange(Box::new( + SignedBeaconBlock::Shanghai(SignedBeaconBlockShanghai::from_ssz_bytes( + decoded_buffer, + )?), )))), }, Protocol::BlocksByRoot => match fork_name { @@ -605,8 +609,10 @@ fn handle_v2_response( decoded_buffer, )?), )))), - ForkName::Dank => Ok(Some(RPCResponse::BlocksByRoot(Box::new( - SignedBeaconBlock::Dank(SignedBeaconBlockDank::from_ssz_bytes(decoded_buffer)?), + ForkName::Shanghai => Ok(Some(RPCResponse::BlocksByRoot(Box::new( + SignedBeaconBlock::Shanghai(SignedBeaconBlockShanghai::from_ssz_bytes( + decoded_buffer, + )?), )))), }, _ => Err(RPCError::ErrorResponse( diff --git a/beacon_node/lighthouse_network/src/types/pubsub.rs b/beacon_node/lighthouse_network/src/types/pubsub.rs index 291cde46c..b8a3c3361 100644 --- a/beacon_node/lighthouse_network/src/types/pubsub.rs +++ b/beacon_node/lighthouse_network/src/types/pubsub.rs @@ -11,8 +11,8 @@ use std::sync::Arc; use types::{ Attestation, AttesterSlashing, EthSpec, ForkContext, ForkName, ProposerSlashing, SignedAggregateAndProof, SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, - SignedBeaconBlockDank, SignedBeaconBlockMerge, SignedContributionAndProof, SignedVoluntaryExit, - SubnetId, SyncCommitteeMessage, SyncSubnetId, + SignedBeaconBlockMerge, SignedBeaconBlockShanghai, SignedContributionAndProof, + SignedVoluntaryExit, SubnetId, SyncCommitteeMessage, SyncSubnetId, }; #[derive(Debug, Clone, PartialEq)] @@ -167,8 +167,8 @@ impl PubsubMessage { SignedBeaconBlockMerge::from_ssz_bytes(data) .map_err(|e| format!("{:?}", e))?, ), - Some(ForkName::Dank) => SignedBeaconBlock::::Dank( - SignedBeaconBlockDank::from_ssz_bytes(data) + Some(ForkName::Shanghai) => SignedBeaconBlock::::Shanghai( + SignedBeaconBlockShanghai::from_ssz_bytes(data) .map_err(|e| format!("{:?}", e))?, ), None => { diff --git a/consensus/state_processing/src/per_block_processing/process_operations.rs b/consensus/state_processing/src/per_block_processing/process_operations.rs index 0d74ac4dc..10b0e5f9b 100644 --- a/consensus/state_processing/src/per_block_processing/process_operations.rs +++ b/consensus/state_processing/src/per_block_processing/process_operations.rs @@ -232,7 +232,7 @@ pub fn process_attestations<'a, T: EthSpec, Payload: ExecPayload>( } BeaconBlockBodyRef::Altair(_) | BeaconBlockBodyRef::Merge(_) - | BeaconBlockBodyRef::Dank(_) => { + | BeaconBlockBodyRef::Shanghai(_) => { altair::process_attestations( state, block_body.attestations(), diff --git a/consensus/types/src/beacon_block.rs b/consensus/types/src/beacon_block.rs index f9f2d8651..dee3292a8 100644 --- a/consensus/types/src/beacon_block.rs +++ b/consensus/types/src/beacon_block.rs @@ -1,6 +1,6 @@ use crate::beacon_block_body::{ - BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyDank, BeaconBlockBodyMerge, - BeaconBlockBodyRef, BeaconBlockBodyRefMut, + BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyMerge, BeaconBlockBodyRef, + BeaconBlockBodyRefMut, BeaconBlockBodyShanghai, }; use crate::test_utils::TestRandom; use crate::*; @@ -17,7 +17,7 @@ use tree_hash_derive::TreeHash; /// A block of the `BeaconChain`. #[superstruct( - variants(Base, Altair, Merge, Dank), + variants(Base, Altair, Merge, Shanghai), variant_attributes( derive( Debug, @@ -64,8 +64,8 @@ pub struct BeaconBlock = FullPayload> { pub body: BeaconBlockBodyAltair, #[superstruct(only(Merge), partial_getter(rename = "body_merge"))] pub body: BeaconBlockBodyMerge, - #[superstruct(only(Dank), partial_getter(rename = "body_dank"))] - pub body: BeaconBlockBodyDank, + #[superstruct(only(Shanghai), partial_getter(rename = "body_shanghai"))] + pub body: BeaconBlockBodyShanghai, } pub type BlindedBeaconBlock = BeaconBlock>; @@ -191,7 +191,7 @@ impl<'a, T: EthSpec, Payload: ExecPayload> BeaconBlockRef<'a, T, Payload> { BeaconBlockRef::Base { .. } => ForkName::Base, BeaconBlockRef::Altair { .. } => ForkName::Altair, BeaconBlockRef::Merge { .. } => ForkName::Merge, - BeaconBlockRef::Dank { .. } => ForkName::Dank, + BeaconBlockRef::Shanghai { .. } => ForkName::Shanghai, }; if fork_at_slot == object_fork { diff --git a/consensus/types/src/beacon_block_body.rs b/consensus/types/src/beacon_block_body.rs index e8c66d2d3..438d9535c 100644 --- a/consensus/types/src/beacon_block_body.rs +++ b/consensus/types/src/beacon_block_body.rs @@ -13,7 +13,7 @@ use tree_hash_derive::TreeHash; /// /// This *superstruct* abstracts over the hard-fork. #[superstruct( - variants(Base, Altair, Merge, Dank), + variants(Base, Altair, Merge, Shanghai), variant_attributes( derive( Debug, @@ -47,15 +47,15 @@ pub struct BeaconBlockBody = FullPayload> pub attestations: VariableList, T::MaxAttestations>, pub deposits: VariableList, pub voluntary_exits: VariableList, - #[superstruct(only(Altair, Merge, Dank))] + #[superstruct(only(Altair, Merge, Shanghai))] pub sync_aggregate: SyncAggregate, // We flatten the execution payload so that serde can use the name of the inner type, // either `execution_payload` for full payloads, or `execution_payload_header` for blinded // payloads. - #[superstruct(only(Merge, Dank))] + #[superstruct(only(Merge, Shanghai))] #[serde(flatten)] pub execution_payload: Payload, - #[superstruct(only(Dank))] + #[superstruct(only(Shanghai))] pub blob_kzgs: VariableList, #[superstruct(only(Base, Altair))] #[ssz(skip_serializing, skip_deserializing)] @@ -71,7 +71,7 @@ impl<'a, T: EthSpec> BeaconBlockBodyRef<'a, T> { BeaconBlockBodyRef::Base { .. } => ForkName::Base, BeaconBlockBodyRef::Altair { .. } => ForkName::Altair, BeaconBlockBodyRef::Merge { .. } => ForkName::Merge, - BeaconBlockBodyRef::Dank { .. } => ForkName::Dank, + BeaconBlockBodyRef::Shanghai { .. } => ForkName::Shanghai, } } } diff --git a/consensus/types/src/beacon_block_and_blobs.rs b/consensus/types/src/blob_wrapper.rs similarity index 58% rename from consensus/types/src/beacon_block_and_blobs.rs rename to consensus/types/src/blob_wrapper.rs index a24b751ad..23f685e1e 100644 --- a/consensus/types/src/beacon_block_and_blobs.rs +++ b/consensus/types/src/blob_wrapper.rs @@ -1,13 +1,14 @@ -use crate::{Blob, EthSpec, SignedBeaconBlock}; +use crate::{Blob, EthSpec, Hash256, SignedBeaconBlock, Slot}; use serde_derive::{Deserialize, Serialize}; -use ssz_derive::{Encode}; -use ssz_types::{VariableList}; +use ssz_derive::Encode; +use ssz_types::VariableList; use tree_hash::TreeHash; use tree_hash_derive::TreeHash; #[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, Serialize, Deserialize, Encode, TreeHash)] -pub struct BeaconBlockAndBlobs { - pub block: SignedBeaconBlock, +pub struct BlobWrapper { + pub beacon_block_root: Hash256, + pub beacon_block_slot: Slot, pub blobs: VariableList, E::MaxObjectListSize>, } diff --git a/consensus/types/src/chain_spec.rs b/consensus/types/src/chain_spec.rs index 6bfae08a4..8887061e4 100644 --- a/consensus/types/src/chain_spec.rs +++ b/consensus/types/src/chain_spec.rs @@ -151,8 +151,10 @@ pub struct ChainSpec { pub safe_slots_to_import_optimistically: u64, /* - * Danksharding hard fork params - */ + * Shanghai hard fork params + */ + pub shanghai_fork_version: [u8; 4], + pub shanghai_fork_epoch: Option, /* * Networking @@ -234,11 +236,14 @@ impl ChainSpec { /// Returns the name of the fork which is active at `epoch`. pub fn fork_name_at_epoch(&self, epoch: Epoch) -> ForkName { - match self.bellatrix_fork_epoch { - Some(fork_epoch) if epoch >= fork_epoch => ForkName::Merge, - _ => match self.altair_fork_epoch { - Some(fork_epoch) if epoch >= fork_epoch => ForkName::Altair, - _ => ForkName::Base, + match self.shanghai_fork_epoch { + Some(fork_epoch) if epoch >= fork_epoch => ForkName::Shanghai, + _ => match self.bellatrix_fork_epoch { + Some(fork_epoch) if epoch >= fork_epoch => ForkName::Merge, + _ => match self.altair_fork_epoch { + Some(fork_epoch) if epoch >= fork_epoch => ForkName::Altair, + _ => ForkName::Base, + }, }, } } @@ -249,8 +254,7 @@ impl ChainSpec { ForkName::Base => self.genesis_fork_version, ForkName::Altair => self.altair_fork_version, ForkName::Merge => self.bellatrix_fork_version, - //TODO: update this - ForkName::Dank => self.bellatrix_fork_version, + ForkName::Shanghai => self.shanghai_fork_version, } } @@ -260,8 +264,7 @@ impl ChainSpec { ForkName::Base => Some(Epoch::new(0)), ForkName::Altair => self.altair_fork_epoch, ForkName::Merge => self.bellatrix_fork_epoch, - //TODO: update this - ForkName::Dank => self.bellatrix_fork_epoch, + ForkName::Shanghai => self.shanghai_fork_epoch, } } @@ -576,6 +579,13 @@ impl ChainSpec { terminal_block_hash_activation_epoch: Epoch::new(u64::MAX), safe_slots_to_import_optimistically: 128u64, + /* + * Shanghai hardfork params + */ + //FIXME(sean) + shanghai_fork_version: [0x03, 0x00, 0x00, 0x00], + shanghai_fork_epoch: None, + /* * Network specific */ @@ -631,6 +641,10 @@ impl ChainSpec { // `Uint256::MAX` which is `2*256- 1`. .checked_add(Uint256::one()) .expect("addition does not overflow"), + // Shanghai + //FIXME(sean) + shanghai_fork_version: [0x03, 0x00, 0x00, 0x01], + shanghai_fork_epoch: None, // Other network_id: 2, // lighthouse testnet network id deposit_chain_id: 5, @@ -786,6 +800,10 @@ impl ChainSpec { terminal_block_hash_activation_epoch: Epoch::new(u64::MAX), safe_slots_to_import_optimistically: 128u64, + //FIXME(sean) + shanghai_fork_version: [0x03, 0x00, 0x00, 0x64], + shanghai_fork_epoch: None, + /* * Network specific */ @@ -861,6 +879,16 @@ pub struct Config { #[serde(deserialize_with = "deserialize_fork_epoch")] pub bellatrix_fork_epoch: Option>, + // FIXME(sean): remove this default + #[serde(default = "default_shanghai_fork_version")] + #[serde(with = "eth2_serde_utils::bytes_4_hex")] + shanghai_fork_version: [u8; 4], + // FIXME(sean): remove this default + #[serde(default = "default_shanghai_fork_epoch")] + #[serde(serialize_with = "serialize_fork_epoch")] + #[serde(deserialize_with = "deserialize_fork_epoch")] + pub shanghai_fork_epoch: Option>, + #[serde(with = "eth2_serde_utils::quoted_u64")] seconds_per_slot: u64, #[serde(with = "eth2_serde_utils::quoted_u64")] @@ -898,6 +926,11 @@ fn default_bellatrix_fork_version() -> [u8; 4] { [0xff, 0xff, 0xff, 0xff] } +fn default_shanghai_fork_version() -> [u8; 4] { + // This value shouldn't be used. + [0xff, 0xff, 0xff, 0xff] +} + /// Placeholder value: 2^256-2^10 (115792089237316195423570985008687907853269984665640564039457584007913129638912). /// /// Taken from https://github.com/ethereum/consensus-specs/blob/d5e4828aecafaf1c57ef67a5f23c4ae7b08c5137/configs/mainnet.yaml#L15-L16 @@ -994,6 +1027,10 @@ impl Config { bellatrix_fork_epoch: spec .bellatrix_fork_epoch .map(|epoch| MaybeQuoted { value: epoch }), + shanghai_fork_version: spec.shanghai_fork_version, + shanghai_fork_epoch: spec + .shanghai_fork_epoch + .map(|epoch| MaybeQuoted { value: epoch }), seconds_per_slot: spec.seconds_per_slot, seconds_per_eth1_block: spec.seconds_per_eth1_block, @@ -1039,6 +1076,8 @@ impl Config { altair_fork_epoch, bellatrix_fork_epoch, bellatrix_fork_version, + shanghai_fork_epoch, + shanghai_fork_version, seconds_per_slot, seconds_per_eth1_block, min_validator_withdrawability_delay, @@ -1069,6 +1108,8 @@ impl Config { altair_fork_epoch: altair_fork_epoch.map(|q| q.value), bellatrix_fork_epoch: bellatrix_fork_epoch.map(|q| q.value), bellatrix_fork_version, + shanghai_fork_epoch: shanghai_fork_epoch.map(|q| q.value), + shanghai_fork_version, seconds_per_slot, seconds_per_eth1_block, min_validator_withdrawability_delay, diff --git a/consensus/types/src/eth_spec.rs b/consensus/types/src/eth_spec.rs index 742a90ad3..3089380b5 100644 --- a/consensus/types/src/eth_spec.rs +++ b/consensus/types/src/eth_spec.rs @@ -96,7 +96,7 @@ pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq + type MinGasLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq; type MaxExtraDataBytes: Unsigned + Clone + Sync + Send + Debug + PartialEq; /* - * New in Danksharding + * New in Shanghaisharding */ type MaxObjectListSize: Unsigned + Clone + Sync + Send + Debug + PartialEq; type ChunksPerBlob: Unsigned + Clone + Sync + Send + Debug + PartialEq; diff --git a/consensus/types/src/fork_context.rs b/consensus/types/src/fork_context.rs index 52b9294c8..742136ca9 100644 --- a/consensus/types/src/fork_context.rs +++ b/consensus/types/src/fork_context.rs @@ -47,6 +47,13 @@ impl ForkContext { )); } + if spec.shanghai_fork_epoch.is_some() { + fork_to_digest.push(( + ForkName::Shanghai, + ChainSpec::compute_fork_digest(spec.shanghai_fork_version, genesis_validators_root), + )); + } + let fork_to_digest: HashMap = fork_to_digest.into_iter().collect(); let digest_to_fork = fork_to_digest diff --git a/consensus/types/src/fork_name.rs b/consensus/types/src/fork_name.rs index f64726a59..88108ffa3 100644 --- a/consensus/types/src/fork_name.rs +++ b/consensus/types/src/fork_name.rs @@ -11,7 +11,7 @@ pub enum ForkName { Base, Altair, Merge, - Dank, + Shanghai, } impl ForkName { @@ -39,10 +39,9 @@ impl ForkName { spec.bellatrix_fork_epoch = Some(Epoch::new(0)); spec } - //TODO(sean): update - ForkName::Dank => { - spec.altair_fork_epoch = Some(Epoch::new(0)); + ForkName::Shanghai => { spec.bellatrix_fork_epoch = Some(Epoch::new(0)); + spec.shanghai_fork_epoch = Some(Epoch::new(0)); spec } } @@ -56,7 +55,7 @@ impl ForkName { ForkName::Base => None, ForkName::Altair => Some(ForkName::Base), ForkName::Merge => Some(ForkName::Altair), - ForkName::Dank => Some(ForkName::Merge), + ForkName::Shanghai => Some(ForkName::Merge), } } @@ -67,8 +66,8 @@ impl ForkName { match self { ForkName::Base => Some(ForkName::Altair), ForkName::Altair => Some(ForkName::Merge), - ForkName::Merge => Some(ForkName::Dank), - ForkName::Dank => None, + ForkName::Merge => Some(ForkName::Shanghai), + ForkName::Shanghai => None, } } } @@ -111,7 +110,7 @@ macro_rules! map_fork_name_with { ($t::Merge(value), extra_data) } //TODO: don't have a beacon state variant for the new fork yet - ForkName::Dank => { + ForkName::Shanghai => { let (value, extra_data) = $body; ($t::Merge(value), extra_data) } @@ -138,7 +137,7 @@ impl Display for ForkName { ForkName::Base => "phase0".fmt(f), ForkName::Altair => "altair".fmt(f), ForkName::Merge => "bellatrix".fmt(f), - ForkName::Dank => "dank".fmt(f), + ForkName::Shanghai => "shanghai".fmt(f), } } } diff --git a/consensus/types/src/lib.rs b/consensus/types/src/lib.rs index 87871aac8..e11bab770 100644 --- a/consensus/types/src/lib.rs +++ b/consensus/types/src/lib.rs @@ -86,7 +86,7 @@ pub mod sync_subnet_id; mod tree_hash_impls; pub mod validator_registration_data; -mod beacon_block_and_blobs; +mod blob_wrapper; mod kzg_commitment; pub mod slot_data; #[cfg(feature = "sqlite")] @@ -101,12 +101,12 @@ pub use crate::attestation_data::AttestationData; pub use crate::attestation_duty::AttestationDuty; pub use crate::attester_slashing::AttesterSlashing; pub use crate::beacon_block::{ - BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockDank, BeaconBlockMerge, BeaconBlockRef, + BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockShanghai, BeaconBlockMerge, BeaconBlockRef, BeaconBlockRefMut, BlindedBeaconBlock, }; pub use crate::beacon_block_body::{ - BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyDank, - BeaconBlockBodyMerge, BeaconBlockBodyRef, BeaconBlockBodyRefMut, + BeaconBlockBody, BeaconBlockBodyAltair, BeaconBlockBodyBase, BeaconBlockBodyMerge, + BeaconBlockBodyRef, BeaconBlockBodyRefMut, BeaconBlockBodyShanghai, }; pub use crate::beacon_block_header::BeaconBlockHeader; pub use crate::beacon_committee::{BeaconCommittee, OwnedBeaconCommittee}; @@ -147,7 +147,7 @@ pub use crate::shuffling_id::AttestationShufflingId; pub use crate::signed_aggregate_and_proof::SignedAggregateAndProof; pub use crate::signed_beacon_block::{ SignedBeaconBlock, SignedBeaconBlockAltair, SignedBeaconBlockBase, SignedBeaconBlockHash, - SignedBeaconBlockMerge, SignedBlindedBeaconBlock,SignedBeaconBlockDank + SignedBeaconBlockMerge, SignedBlindedBeaconBlock,SignedBeaconBlockShanghai }; pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader; pub use crate::signed_contribution_and_proof::SignedContributionAndProof; diff --git a/consensus/types/src/signed_beacon_block.rs b/consensus/types/src/signed_beacon_block.rs index 317cfddca..49822da82 100644 --- a/consensus/types/src/signed_beacon_block.rs +++ b/consensus/types/src/signed_beacon_block.rs @@ -38,7 +38,7 @@ impl From for Hash256 { /// A `BeaconBlock` and a signature from its proposer. #[superstruct( - variants(Base, Altair, Merge, Dank), + variants(Base, Altair, Merge, Shanghai), variant_attributes( derive( Debug, @@ -72,8 +72,8 @@ pub struct SignedBeaconBlock = FullPayload, #[superstruct(only(Merge), partial_getter(rename = "message_merge"))] pub message: BeaconBlockMerge, - #[superstruct(only(Dank), partial_getter(rename = "message_dank"))] - pub message: BeaconBlockDank, + #[superstruct(only(Shanghai), partial_getter(rename = "message_shanghai"))] + pub message: BeaconBlockShanghai, pub signature: Signature, } @@ -131,8 +131,8 @@ impl> SignedBeaconBlock { BeaconBlock::Merge(message) => { SignedBeaconBlock::Merge(SignedBeaconBlockMerge { message, signature }) } - BeaconBlock::Dank(message) => { - SignedBeaconBlock::Dank(SignedBeaconBlockDank { message, signature }) + BeaconBlock::Shanghai(message) => { + SignedBeaconBlock::Shanghai(SignedBeaconBlockShanghai { message, signature }) } } } diff --git a/testing/ef_tests/src/cases/common.rs b/testing/ef_tests/src/cases/common.rs index 5cb460b4f..b695015d7 100644 --- a/testing/ef_tests/src/cases/common.rs +++ b/testing/ef_tests/src/cases/common.rs @@ -78,6 +78,6 @@ pub fn previous_fork(fork_name: ForkName) -> ForkName { ForkName::Base => ForkName::Base, ForkName::Altair => ForkName::Base, ForkName::Merge => ForkName::Altair, // TODO: Check this when tests are released.. - ForkName::Dank => ForkName::Merge, // TODO: Check this when tests are released.. + ForkName::Shanghai => ForkName::Merge, // TODO: Check this when tests are released.. } } diff --git a/testing/ef_tests/src/cases/epoch_processing.rs b/testing/ef_tests/src/cases/epoch_processing.rs index 1c3f42e18..9163b551a 100644 --- a/testing/ef_tests/src/cases/epoch_processing.rs +++ b/testing/ef_tests/src/cases/epoch_processing.rs @@ -278,7 +278,7 @@ impl> Case for EpochProcessing { } // No phase0 tests for Altair and later. ForkName::Altair | ForkName::Merge => T::name() != "participation_record_updates", - ForkName::Dank => false, // TODO: revisit when tests are out + ForkName::Shanghai => false, // TODO: revisit when tests are out } } diff --git a/testing/ef_tests/src/cases/fork.rs b/testing/ef_tests/src/cases/fork.rs index bbe84409e..57c4f1254 100644 --- a/testing/ef_tests/src/cases/fork.rs +++ b/testing/ef_tests/src/cases/fork.rs @@ -61,7 +61,7 @@ impl Case for ForkTest { ForkName::Base => panic!("phase0 not supported"), ForkName::Altair => upgrade_to_altair(&mut result_state, spec).map(|_| result_state), ForkName::Merge => upgrade_to_bellatrix(&mut result_state, spec).map(|_| result_state), - ForkName::Dank => panic!("danksharding not supported"), + ForkName::Shanghai => panic!("shanghai not supported"), }; compare_beacon_state_results_without_caches(&mut result, &mut expected) diff --git a/testing/ef_tests/src/cases/transition.rs b/testing/ef_tests/src/cases/transition.rs index f97949c39..bbc98994a 100644 --- a/testing/ef_tests/src/cases/transition.rs +++ b/testing/ef_tests/src/cases/transition.rs @@ -42,10 +42,9 @@ impl LoadCase for TransitionTest { spec.altair_fork_epoch = Some(Epoch::new(0)); spec.bellatrix_fork_epoch = Some(metadata.fork_epoch); } - //TODO(sean): fix - ForkName::Dank => { - spec.altair_fork_epoch = Some(Epoch::new(0)); - spec.bellatrix_fork_epoch = Some(metadata.fork_epoch); + ForkName::Shanghai => { + spec.bellatrix_fork_epoch = Some(Epoch::new(0)); + spec.shanghai_fork_epoch = Some(metadata.fork_epoch); } } diff --git a/validator_client/src/signing_method/web3signer.rs b/validator_client/src/signing_method/web3signer.rs index d16d7693c..967d6b139 100644 --- a/validator_client/src/signing_method/web3signer.rs +++ b/validator_client/src/signing_method/web3signer.rs @@ -90,8 +90,8 @@ impl<'a, T: EthSpec, Payload: ExecPayload> Web3SignerObject<'a, T, Payload> { block: None, block_header: Some(block.block_header()), }), - BeaconBlock::Dank(_) => Ok(Web3SignerObject::BeaconBlock { - version: ForkName::Dank, + BeaconBlock::Shanghai(_) => Ok(Web3SignerObject::BeaconBlock { + version: ForkName::Shanghai, block: None, block_header: Some(block.block_header()), }),