Skip to content

Commit

Permalink
Merge pull request #2458 from Taraxa-project/fix_reverts_gas_used
Browse files Browse the repository at this point in the history
fix: use of all passed gas on reverts. add check to revert_reason test
  • Loading branch information
kstdl authored Apr 21, 2023
2 parents 34f8408 + 9bfa7f2 commit f08494b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion submodules/taraxa-evm
Submodule taraxa-evm updated 1 files
+2 −9 core/vm/evm.go
7 changes: 7 additions & 0 deletions tests/final_chain_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,13 @@ TEST_F(FinalChainTest, revert_reason) {
EXPECT_THROW_WITH(dev::jsToInt(eth_json_rpc->eth_estimateGas(est)), std::exception,
"evm: execution reverted: arg required");
EXPECT_THROW_WITH(eth_json_rpc->eth_call(est, "latest"), std::exception, "evm: execution reverted: arg required");

auto gas = 100000;
auto trx = std::make_shared<Transaction>(2, 0, 1, gas, dev::fromHex(call_data), sk, test_contract_addr);
auto result = advance({trx}, {0, 0, 1});
auto receipt = result->trx_receipts.front();
ASSERT_EQ(receipt.status_code, 0); // failed
ASSERT_GT(gas, receipt.gas_used); // we aren't spending all gas in such cases
}
}

Expand Down

0 comments on commit f08494b

Please sign in to comment.