mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
Rename Merge to Bellatrix (#5601)
* Rename Merge to Bellatrix * Remove tree-hash-cache which got readded from the rebase
This commit is contained in:
@@ -5,8 +5,9 @@ use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use types::{
|
||||
EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb,
|
||||
ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderMerge, ForkName,
|
||||
EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix,
|
||||
ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra,
|
||||
ForkName,
|
||||
};
|
||||
|
||||
pub fn run<E: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
||||
@@ -20,17 +21,17 @@ pub fn run<E: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
||||
let base_fee_per_gas = parse_required(matches, "base-fee-per-gas")?;
|
||||
let gas_limit = parse_required(matches, "gas-limit")?;
|
||||
let file_name = matches.value_of("file").ok_or("No file supplied")?;
|
||||
let fork_name: ForkName = parse_optional(matches, "fork")?.unwrap_or(ForkName::Merge);
|
||||
let fork_name: ForkName = parse_optional(matches, "fork")?.unwrap_or(ForkName::Bellatrix);
|
||||
|
||||
let execution_payload_header: ExecutionPayloadHeader<E> = match fork_name {
|
||||
ForkName::Base | ForkName::Altair => return Err("invalid fork name".to_string()),
|
||||
ForkName::Merge => ExecutionPayloadHeader::Merge(ExecutionPayloadHeaderMerge {
|
||||
ForkName::Bellatrix => ExecutionPayloadHeader::Bellatrix(ExecutionPayloadHeaderBellatrix {
|
||||
gas_limit,
|
||||
base_fee_per_gas,
|
||||
timestamp: genesis_time,
|
||||
block_hash: eth1_block_hash,
|
||||
prev_randao: eth1_block_hash.into_root(),
|
||||
..ExecutionPayloadHeaderMerge::default()
|
||||
..ExecutionPayloadHeaderBellatrix::default()
|
||||
}),
|
||||
ForkName::Capella => ExecutionPayloadHeader::Capella(ExecutionPayloadHeaderCapella {
|
||||
gas_limit,
|
||||
|
||||
@@ -433,7 +433,7 @@ fn main() {
|
||||
.takes_value(true)
|
||||
.default_value("bellatrix")
|
||||
.help("The fork for which the execution payload header should be created.")
|
||||
.possible_values(&["merge", "bellatrix", "capella", "deneb", "electra"])
|
||||
.possible_values(&["bellatrix", "capella", "deneb", "electra"])
|
||||
)
|
||||
)
|
||||
.subcommand(
|
||||
|
||||
@@ -21,8 +21,8 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use types::ExecutionBlockHash;
|
||||
use types::{
|
||||
test_utils::generate_deterministic_keypairs, Address, BeaconState, ChainSpec, Config, Epoch,
|
||||
Eth1Data, EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderCapella,
|
||||
ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra, ExecutionPayloadHeaderMerge,
|
||||
Eth1Data, EthSpec, ExecutionPayloadHeader, ExecutionPayloadHeaderBellatrix,
|
||||
ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderDeneb, ExecutionPayloadHeaderElectra,
|
||||
ForkName, Hash256, Keypair, PublicKey, Validator,
|
||||
};
|
||||
|
||||
@@ -114,9 +114,9 @@ pub fn run<E: EthSpec>(testnet_dir_path: PathBuf, matches: &ArgMatches) -> Resul
|
||||
ForkName::Base | ForkName::Altair => Err(ssz::DecodeError::BytesInvalid(
|
||||
"genesis fork must be post-merge".to_string(),
|
||||
)),
|
||||
ForkName::Merge => {
|
||||
ExecutionPayloadHeaderMerge::<E>::from_ssz_bytes(bytes.as_slice())
|
||||
.map(ExecutionPayloadHeader::Merge)
|
||||
ForkName::Bellatrix => {
|
||||
ExecutionPayloadHeaderBellatrix::<E>::from_ssz_bytes(bytes.as_slice())
|
||||
.map(ExecutionPayloadHeader::Bellatrix)
|
||||
}
|
||||
ForkName::Capella => {
|
||||
ExecutionPayloadHeaderCapella::<E>::from_ssz_bytes(bytes.as_slice())
|
||||
@@ -246,10 +246,10 @@ fn initialize_state_with_validators<E: EthSpec>(
|
||||
) -> Result<BeaconState<E>, String> {
|
||||
// If no header is provided, then start from a Bellatrix state by default
|
||||
let default_header: ExecutionPayloadHeader<E> =
|
||||
ExecutionPayloadHeader::Merge(ExecutionPayloadHeaderMerge {
|
||||
ExecutionPayloadHeader::Bellatrix(ExecutionPayloadHeaderBellatrix {
|
||||
block_hash: ExecutionBlockHash::from_root(eth1_block_hash),
|
||||
parent_hash: ExecutionBlockHash::zero(),
|
||||
..ExecutionPayloadHeaderMerge::default()
|
||||
..ExecutionPayloadHeaderBellatrix::default()
|
||||
});
|
||||
let execution_payload_header = execution_payload_header.unwrap_or(default_header);
|
||||
// Empty eth1 data
|
||||
@@ -314,9 +314,9 @@ fn initialize_state_with_validators<E: EthSpec>(
|
||||
|
||||
// Override latest execution payload header.
|
||||
// See https://github.com/ethereum/consensus-specs/blob/v1.1.0/specs/bellatrix/beacon-chain.md#testing
|
||||
if let ExecutionPayloadHeader::Merge(ref header) = execution_payload_header {
|
||||
if let ExecutionPayloadHeader::Bellatrix(ref header) = execution_payload_header {
|
||||
*state
|
||||
.latest_execution_payload_header_merge_mut()
|
||||
.latest_execution_payload_header_bellatrix_mut()
|
||||
.or(Err("mismatched fork".to_string()))? = header.clone();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +70,11 @@ pub fn run_parse_ssz<E: EthSpec>(
|
||||
"SignedBeaconBlockAltair" => {
|
||||
decode_and_print(&bytes, SignedBeaconBlockAltair::<E>::from_ssz_bytes, format)?
|
||||
}
|
||||
"SignedBeaconBlockMerge" | "SignedBeaconBlockBellatrix" => {
|
||||
decode_and_print(&bytes, SignedBeaconBlockMerge::<E>::from_ssz_bytes, format)?
|
||||
}
|
||||
"SignedBeaconBlockBellatrix" => decode_and_print(
|
||||
&bytes,
|
||||
SignedBeaconBlockBellatrix::<E>::from_ssz_bytes,
|
||||
format,
|
||||
)?,
|
||||
"SignedBeaconBlockCapella" => decode_and_print(
|
||||
&bytes,
|
||||
SignedBeaconBlockCapella::<E>::from_ssz_bytes,
|
||||
@@ -97,8 +99,8 @@ pub fn run_parse_ssz<E: EthSpec>(
|
||||
"BeaconStateAltair" => {
|
||||
decode_and_print(&bytes, BeaconStateAltair::<E>::from_ssz_bytes, format)?
|
||||
}
|
||||
"BeaconStateMerge" | "BeaconStateBellatrix" => {
|
||||
decode_and_print(&bytes, BeaconStateMerge::<E>::from_ssz_bytes, format)?
|
||||
"BeaconStateBellatrix" => {
|
||||
decode_and_print(&bytes, BeaconStateBellatrix::<E>::from_ssz_bytes, format)?
|
||||
}
|
||||
"BeaconStateCapella" => {
|
||||
decode_and_print(&bytes, BeaconStateCapella::<E>::from_ssz_bytes, format)?
|
||||
|
||||
Reference in New Issue
Block a user