File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 1
- use ethrex_blockchain:: validate_block;
1
+ use ethrex_blockchain:: { validate_block, validate_gas_used } ;
2
2
use ethrex_l2:: utils:: prover:: proving_systems:: { ProofCalldata , ProverType } ;
3
3
use ethrex_l2_sdk:: calldata:: Value ;
4
4
use ethrex_vm:: Evm ;
@@ -57,19 +57,19 @@ fn execution_program(input: ProgramInput) -> Result<ProgramOutput, Box<dyn std::
57
57
let fork = db. chain_config . fork ( block. header . timestamp ) ;
58
58
59
59
let mut vm = Evm :: from_execution_db ( db. clone ( ) ) ;
60
- let _result = vm. execute_block ( & block) ?;
61
- // let receipts = result.receipts;
60
+ let result = vm. execute_block ( & block) ?;
61
+ let receipts = result. receipts ;
62
62
let account_updates = vm. get_state_transitions ( fork) ?;
63
- // validate_gas_used(&receipts, &block.header)?;
63
+ validate_gas_used ( & receipts, & block. header ) ?;
64
64
65
65
// Update state trie
66
66
update_tries ( & mut state_trie, & mut storage_tries, & account_updates) ?;
67
67
68
68
// Calculate final state root hash and check
69
69
let final_state_hash = state_trie. hash_no_commit ( ) ;
70
- // if final_state_hash != block.header.state_root {
71
- // return Err("invalid final state trie".to_string().into());
72
- // }
70
+ if final_state_hash != block. header . state_root {
71
+ return Err ( "invalid final state trie" . to_string ( ) . into ( ) ) ;
72
+ }
73
73
74
74
Ok ( ProgramOutput {
75
75
initial_state_hash,
Original file line number Diff line number Diff line change @@ -36,8 +36,10 @@ pub fn main() {
36
36
let mut evm = Evm :: from_execution_db ( db. clone ( ) ) ;
37
37
let result = evm. execute_block ( & block) . expect ( "failed to execute block" ) ;
38
38
let receipts = result. receipts ;
39
- let account_updates = evm. get_state_transitions ( fork) . expect ( "failed to get state transitions" ) ;
40
- // validate_gas_used(&receipts, &block.header).expect("invalid gas used");
39
+ let account_updates = evm
40
+ . get_state_transitions ( fork)
41
+ . expect ( "failed to get state transitions" ) ;
42
+ validate_gas_used ( & receipts, & block. header ) . expect ( "invalid gas used" ) ;
41
43
42
44
// Output gas for measurement purposes
43
45
let cumulative_gas_used = receipts
@@ -52,9 +54,9 @@ pub fn main() {
52
54
53
55
// Calculate final state root hash and check
54
56
let final_state_hash = state_trie. hash_no_commit ( ) ;
55
- // if final_state_hash != block.header.state_root {
56
- // panic!("invalid final state trie");
57
- // }
57
+ if final_state_hash != block. header . state_root {
58
+ panic ! ( "invalid final state trie" ) ;
59
+ }
58
60
59
61
sp1_zkvm:: io:: commit ( & ProgramOutput {
60
62
initial_state_hash,
You can’t perform that action at this time.
0 commit comments