mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 14:24:44 +00:00
cleanup
This commit is contained in:
@@ -9,8 +9,9 @@ use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use types::{
|
||||
test_utils::generate_deterministic_keypairs, Address, Config, EthSpec, ExecutionPayloadHeader,
|
||||
ExecutionPayloadHeaderMerge,
|
||||
test_utils::generate_deterministic_keypairs, Address, Config, Epoch, EthSpec,
|
||||
ExecutionPayloadHeader, ExecutionPayloadHeaderCapella, ExecutionPayloadHeaderEip4844,
|
||||
ExecutionPayloadHeaderMerge, ForkName,
|
||||
};
|
||||
|
||||
pub fn run<T: EthSpec>(testnet_dir_path: PathBuf, matches: &ArgMatches) -> Result<(), String> {
|
||||
@@ -80,10 +81,25 @@ pub fn run<T: EthSpec>(testnet_dir_path: PathBuf, matches: &ArgMatches) -> Resul
|
||||
.map_err(|e| format!("Unable to open {}: {}", filename, e))?;
|
||||
file.read_to_end(&mut bytes)
|
||||
.map_err(|e| format!("Unable to read {}: {}", filename, e))?;
|
||||
//FIXME(sean)
|
||||
ExecutionPayloadHeaderMerge::<T>::from_ssz_bytes(bytes.as_slice())
|
||||
.map(ExecutionPayloadHeader::Merge)
|
||||
.map_err(|e| format!("SSZ decode failed: {:?}", e))
|
||||
let fork_name = spec.fork_name_at_epoch(Epoch::new(0));
|
||||
match fork_name {
|
||||
ForkName::Base | ForkName::Altair => Err(ssz::DecodeError::BytesInvalid(
|
||||
"genesis fork must be post-merge".to_string(),
|
||||
)),
|
||||
ForkName::Merge => {
|
||||
ExecutionPayloadHeaderMerge::<T>::from_ssz_bytes(bytes.as_slice())
|
||||
.map(ExecutionPayloadHeader::Merge)
|
||||
}
|
||||
ForkName::Capella => {
|
||||
ExecutionPayloadHeaderCapella::<T>::from_ssz_bytes(bytes.as_slice())
|
||||
.map(ExecutionPayloadHeader::Capella)
|
||||
}
|
||||
ForkName::Eip4844 => {
|
||||
ExecutionPayloadHeaderEip4844::<T>::from_ssz_bytes(bytes.as_slice())
|
||||
.map(ExecutionPayloadHeader::Eip4844)
|
||||
}
|
||||
}
|
||||
.map_err(|e| format!("SSZ decode failed: {:?}", e))
|
||||
})
|
||||
.transpose()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user