diff --git a/evm_loader/cli/src/main.rs b/evm_loader/cli/src/main.rs index 333ab0e73..9938928e8 100644 --- a/evm_loader/cli/src/main.rs +++ b/evm_loader/cli/src/main.rs @@ -277,6 +277,7 @@ fn parse_tx(params: &ArgMatches) -> (TxParams, TraceCallConfig) { data, value, gas_limit, + gas_used: None, access_list, }; diff --git a/evm_loader/lib/src/commands/emulate.rs b/evm_loader/lib/src/commands/emulate.rs index 6f2dcecaf..01cfe4dba 100644 --- a/evm_loader/lib/src/commands/emulate.rs +++ b/evm_loader/lib/src/commands/emulate.rs @@ -367,7 +367,10 @@ pub(crate) async fn emulate_trx<'a>( Ok(evm_loader::evm::tracing::EmulationResult { exit_status, steps_executed, - used_gas: steps_gas + begin_end_gas + actions_gas + accounts_gas, + used_gas: tx_params + .gas_used + .map(U256::as_u64) + .unwrap_or(steps_gas + begin_end_gas + actions_gas + accounts_gas), actions, state_diff: StateDiff(map), }) diff --git a/evm_loader/lib/src/types/mod.rs b/evm_loader/lib/src/types/mod.rs index 6cc2322b3..3812ec060 100644 --- a/evm_loader/lib/src/types/mod.rs +++ b/evm_loader/lib/src/types/mod.rs @@ -35,6 +35,7 @@ pub struct TxParams { pub data: Option>, pub value: Option, pub gas_limit: Option, + pub gas_used: Option, pub access_list: Option>, } diff --git a/evm_loader/lib/src/types/request_models.rs b/evm_loader/lib/src/types/request_models.rs index 54cdb2db9..9aa32fefb 100644 --- a/evm_loader/lib/src/types/request_models.rs +++ b/evm_loader/lib/src/types/request_models.rs @@ -29,6 +29,7 @@ pub struct TxParamsRequestModel { pub data: Option>, pub value: Option, pub gas_limit: Option, + pub gas_used: Option, pub access_list: Option>, } @@ -59,6 +60,7 @@ impl From for TxParams { data: model.data, value: model.value, gas_limit: model.gas_limit, + gas_used: model.gas_used, access_list: model.access_list, } }