diff --git a/c/polyjuice.h b/c/polyjuice.h index 17124708..359a28a8 100644 --- a/c/polyjuice.h +++ b/c/polyjuice.h @@ -1571,7 +1571,7 @@ int run_polyjuice() { return ret; } /* emit POLYJUICE_SYSTEM log to Godwoken */ - ret = emit_evm_result_log(&context, min_gas, transfer_ret); + ret = emit_evm_result_log(&context, gas_used, transfer_ret); if (ret != 0) { ckb_debug("emit_evm_result_log failed"); return ret; diff --git a/polyjuice-tests/src/test_cases/native_token_transfer.rs b/polyjuice-tests/src/test_cases/native_token_transfer.rs index b74a6036..acbf229b 100644 --- a/polyjuice-tests/src/test_cases/native_token_transfer.rs +++ b/polyjuice-tests/src/test_cases/native_token_transfer.rs @@ -7,7 +7,7 @@ use gw_types::{ use crate::{ ctx::MockChain, - helper::{MockContractInfo, PolyjuiceArgsBuilder, CREATOR_ACCOUNT_ID}, + helper::{parse_log, Log, MockContractInfo, PolyjuiceArgsBuilder, CREATOR_ACCOUNT_ID}, }; #[test] @@ -66,6 +66,11 @@ fn native_token_transfer_unregistered_address_test() -> anyhow::Result<()> { let run_result = chain.execute_raw(raw_tx)?; assert_eq!(run_result.exit_code, 0); + let system_log = run_result.write.logs.last().map(parse_log); + if let Some(Log::PolyjuiceSystem { gas_used, .. }) = system_log { + assert_eq!(gas_used, 21000 + 25000); + } + let account_id = chain.get_account_id_by_eth_address(&to_addr)?; assert_eq!(Some(6), account_id); let from_balance = chain.get_balance(&from_addr)?;