-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlib.rs
More file actions
34 lines (29 loc) · 1.05 KB
/
lib.rs
File metadata and controls
34 lines (29 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
/// Client program input data types.
pub mod io;
#[macro_use]
mod utils;
pub mod custom;
pub mod error;
pub mod executor;
pub mod tracking;
mod into_primitives;
pub use into_primitives::{BlockValidator, FromInput, IntoInput, IntoPrimitives};
use alloy_primitives::B256;
use executor::{EthClientExecutor, DESERIALZE_INPUTS};
use io::EthClientExecutorInput;
use std::sync::Arc;
pub fn verify_block(input: &[u8]) -> (B256, B256, B256) {
println!("cycle-tracker-report-start: {DESERIALZE_INPUTS}");
let input = bincode::deserialize::<EthClientExecutorInput>(input).unwrap();
println!("cycle-tracker-report-end: {DESERIALZE_INPUTS}");
// Execute the block.
let executor = EthClientExecutor::eth(
Arc::new((&input.genesis).try_into().unwrap()),
input.custom_beneficiary,
);
let (header, prev_state_root) =
executor.execute(input, vec![]).expect("failed to execute client");
let block_hash = header.hash_slow();
(block_hash, header.state_root, prev_state_root)
}