Skip to content

Commit

Permalink
Organize examples directory for handling blocks associated with diffe…
Browse files Browse the repository at this point in the history
…rent forks
  • Loading branch information
EchoAlice committed Nov 23, 2024
1 parent 9f95fa3 commit cf76d8e
Show file tree
Hide file tree
Showing 43 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ethereum-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "b89af430
[[bin]]
name = "ec"
required-features = ["ec"]

[[example]]
name = "state_transitions_phase0"
path = "examples/state_transitions/phase0_blocks.rs"
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use std::{error::Error, fs, time::Instant};
fn main() -> std::result::Result<(), Box<dyn Error>> {
println!("this example illustrates how the spec applies state transitions to mainnet data.");

let state_path = "./ethereum-consensus/examples/data/beacon_states/state_1999.ssz";
let state_path =
"./ethereum-consensus/examples/mainnet_blocks/phase0/beacon_states/state_1999.ssz";
let f = fs::read(state_path).unwrap();
let prestate = spec::BeaconState::deserialize(&f)?;
let prestate = BeaconState::Phase0(prestate);
Expand All @@ -19,8 +20,10 @@ fn main() -> std::result::Result<(), Box<dyn Error>> {

// Read and process blocks at slots 2000-2034
for slot in 2000..=2034 {
let block_path =
format!("./ethereum-consensus/examples/data/beacon_blocks/block_{}.ssz", slot);
let block_path = format!(
"./ethereum-consensus/examples/mainnet_blocks/phase0/beacon_blocks/block_{}.ssz",
slot
);
let block_bytes = fs::read(&block_path)?;
if is_skipped_slot(&block_bytes, slot) {
continue;
Expand Down

0 comments on commit cf76d8e

Please sign in to comment.