@@ -10,13 +10,13 @@ mod signed_call;
1010pub mod state;
1111pub mod types;
1212
13- use std:: sync:: Arc ;
14-
1513use base64:: prelude:: * ;
1614use revm:: {
15+ context:: TxEnv ,
16+ context_interface:: result:: { ExecutionResult , Output } ,
1717 precompile:: PrecompileWithAddress ,
18- primitives:: { Bytes , ExecutionResult , Output , SpecId , TxEnv , TxKind } ,
19- Evm ,
18+ primitives:: { hardfork :: SpecId , Bytes , TxKind } ,
19+ Context as EvmContext , ExecuteCommitEvm , ExecuteEvm , MainBuilder , MainContext ,
2020} ;
2121
2222use oasis_runtime_sdk:: {
@@ -394,46 +394,43 @@ impl<Cfg: Config> Module<Cfg> {
394394
395395 // Prepare the environment.
396396 let db = db:: OasisDB :: < ' _ , C , Cfg > :: new ( ctx) ;
397- let mut evm = Evm :: builder ( )
397+ let mut evm = EvmContext :: mainnet ( )
398398 . with_db ( db)
399- . with_spec_id ( SpecId :: SHANGHAI )
400- . modify_cfg_env ( | cfg| {
399+ . modify_cfg_chained ( |cfg| {
400+ cfg. spec = SpecId :: SHANGHAI ;
401401 cfg. disable_eip3607 = true ;
402402 } )
403- . append_handler_register ( |handler| {
403+ // TODO: Port precompiles to the new API.
404+ /*.append_handler_register(|handler| {
404405 // Load standard precompiles.
405406 //
406407 // For Shanghai spec these include the following: ecrecover,
407408 // sha256, ripemd160, identity, bn128::{add,mul,pair}, blake2,
408409 // modexp.
409410 let precompiles = handler.pre_execution.load_precompiles();
410-
411411 handler.pre_execution.load_precompiles = Arc::new(move || {
412412 // Start with standard precompiles.
413413 let mut precompiles = precompiles.clone();
414-
415414 // Extend with Oasis-specific precompiles.
416415 precompiles.extend(precompile::new());
417-
418416 // Extend with module-specific precompiles (if any).
419417 if let Some(additional_precompiles) = Cfg::additional_precompiles() {
420418 precompiles.extend(additional_precompiles);
421419 }
422-
423420 precompiles
424421 });
425- } )
426- . modify_tx_env ( f)
427- . build ( ) ;
422+ })*/
423+ . modify_tx_chained ( f)
424+ . build_mainnet ( ) ;
428425
429426 // Run the transaction.
430427 let tx_result = if estimate_gas {
431- match evm. transact ( ) {
428+ match evm. transact ( evm . tx . clone ( ) ) {
432429 Ok ( result) => result. result ,
433430 Err ( err) => return Err ( crate :: Error :: ExecutionFailed ( format ! ( "{:?}" , err) ) ) ,
434431 }
435432 } else {
436- match evm. transact_commit ( ) {
433+ match evm. transact_commit ( evm . tx . clone ( ) ) {
437434 Ok ( result) => result,
438435 Err ( err) => return Err ( crate :: Error :: ExecutionFailed ( format ! ( "{:?}" , err) ) ) ,
439436 }
@@ -523,7 +520,7 @@ impl<Cfg: Config> Module<Cfg> {
523520 . unwrap ( ) ; // XXX: err checking
524521
525522 tx. caller = caller. 0 . into ( ) ;
526- tx. transact_to = TxKind :: Create ;
523+ tx. kind = TxKind :: Create ;
527524 tx. value = revm:: primitives:: U256 :: from_be_bytes ( value. into ( ) ) ;
528525 tx. data = init_code. into ( ) ;
529526 } )
@@ -544,7 +541,7 @@ impl<Cfg: Config> Module<Cfg> {
544541 . unwrap ( ) ; // XXX: err checking
545542
546543 tx. caller = caller. 0 . into ( ) ;
547- tx. transact_to = TxKind :: Call ( address. 0 . into ( ) ) ;
544+ tx. kind = TxKind :: Call ( address. 0 . into ( ) ) ;
548545 tx. value = revm:: primitives:: U256 :: from_be_bytes ( value. into ( ) ) ;
549546 tx. data = data. into ( ) ;
550547 } )
0 commit comments