1- use bytes :: Bytes ;
1+ use alloy_primitives :: { Address , Bytes } ;
22use colored:: Colorize ;
33use ethabi:: { Event , Hash , RawLog } ;
44use indexmap:: IndexMap ;
5- use revm:: primitives:: { AccountInfo , Bytecode , Env , ExecutionResult , TransactTo , B160 , U256 } ;
6- use std:: fmt:: Display ;
5+ use revm:: primitives:: { AccountInfo , Bytecode , Env , ExecutionResult , TransactTo , U256 } ;
6+
7+ use std:: { fmt:: Display , str:: FromStr } ;
78
89pub use ethabi;
910
@@ -112,11 +113,13 @@ pub fn execute(name: &str, events: &[Event], bytecode: &str, sink: &mut TestSink
112113 . iter ( )
113114 . map ( |event| ( event. signature ( ) , event) )
114115 . collect ( ) ;
115- let bytecode = Bytecode :: new_raw ( Bytes :: copy_from_slice ( & hex:: decode ( bytecode) . unwrap ( ) ) ) ;
116+ let bytecode = Bytecode :: new_raw ( alloy_primitives:: Bytes (
117+ Bytes :: copy_from_slice ( & hex:: decode ( bytecode) . unwrap ( ) ) . into ( ) ,
118+ ) ) ;
116119
117120 let mut database = revm:: InMemoryDB :: default ( ) ;
118- let test_address = B160 :: from ( 42 ) ;
119- let test_info = AccountInfo :: new ( U256 :: ZERO , 0 , bytecode) ;
121+ let test_address = Address :: from_str ( "42" ) . unwrap ( ) ;
122+ let test_info = AccountInfo :: new ( U256 :: ZERO , 0 , bytecode. hash_slow ( ) , bytecode ) ;
120123 database. insert_account_info ( test_address, test_info) ;
121124
122125 let mut env = Env :: default ( ) ;
@@ -134,12 +137,12 @@ pub fn execute(name: &str, events: &[Event], bytecode: &str, sink: &mut TestSink
134137 if let Some ( Some ( event) ) = log
135138 . topics
136139 . get ( 0 )
137- . map ( |sig| events. get ( & Hash :: from_slice ( sig. as_bytes ( ) ) ) )
140+ . map ( |sig| events. get ( & Hash :: from_slice ( sig. as_ref ( ) ) ) )
138141 {
139142 let topics = log
140143 . topics
141144 . iter ( )
142- . map ( |topic| Hash :: from_slice ( topic. as_bytes ( ) ) )
145+ . map ( |topic| Hash :: from_slice ( topic. as_ref ( ) ) )
143146 . collect ( ) ;
144147 let data = log. data . clone ( ) . to_vec ( ) ;
145148 let raw_log = RawLog { topics, data } ;
0 commit comments