diff --git a/CHANGELOG.md b/CHANGELOG.md index c9cf53a8f1..28b6971aa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (cli) [#537](https://github.com/crypto-org-chain/ethermint/pull/537) Fix unsuppored sign mode SIGN_MODE_TEXTUAL for bank transfer. * (cli) [#543](https://github.com/crypto-org-chain/ethermint/pull/543) Fix graceful shutdown. * (rpc) [#545](https://github.com/crypto-org-chain/ethermint/pull/545) Fix state overwrite in debug trace APIs. +* (rpc) [#554](https://github.com/crypto-org-chain/ethermint/pull/554) No trace detail on insufficient balance. ### Improvements diff --git a/tests/integration_tests/hardhat/contracts/FeeCollector.sol b/tests/integration_tests/hardhat/contracts/FeeCollector.sol new file mode 100644 index 0000000000..71027eed74 --- /dev/null +++ b/tests/integration_tests/hardhat/contracts/FeeCollector.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract FeeCollector { + event TokensMinted(address indexed to, uint256 amount); + + function mint(uint256 amount) public payable { + emit TokensMinted(msg.sender, amount); + } +} diff --git a/tests/integration_tests/test_tracers.py b/tests/integration_tests/test_tracers.py index ea1c051641..968bb7c196 100644 --- a/tests/integration_tests/test_tracers.py +++ b/tests/integration_tests/test_tracers.py @@ -19,8 +19,10 @@ deploy_contract, derive_new_account, derive_random_account, + send_raw_transactions, send_transaction, send_txs, + sign_transaction, w3_wait_for_new_blocks, ) @@ -156,6 +158,39 @@ def process(w3): assert res[0] == res[-1], res +def test_trace_tx_reverse_transfer(ethermint): + print("reproduce only") + return + method = "debug_traceTransaction" + tracer = {"tracer": "callTracer"} + acc = derive_new_account(11) + w3 = ethermint.w3 + fund_acc(w3, acc, fund=40000000000000000) + contract, _ = deploy_contract(w3, CONTRACTS["FeeCollector"]) + amt = 18633908679862681 + raw_transactions = [] + nonce = w3.eth.get_transaction_count(acc.address) + tx = contract.functions.mint(amt).build_transaction( + { + "from": acc.address, + "value": hex(amt), + "nonce": nonce, + } + ) + raw_transactions.append(sign_transaction(w3, tx, acc.key).rawTransaction) + tx = tx | {"nonce": nonce + 1} + raw_transactions.append(sign_transaction(w3, tx, acc.key).rawTransaction) + w3_wait_for_new_blocks(w3, 1) + sended_hash_set = send_raw_transactions(w3, raw_transactions) + for h in sended_hash_set: + tx_hash = h.hex() + tx_res = w3.provider.make_request( + method, + [tx_hash, tracer], + ) + print(tx_res) + + def test_tracecall_insufficient_funds(ethermint, geth): method = "debug_traceCall" acc = derive_random_account() @@ -540,7 +575,7 @@ def test_refund_unused_gas_when_contract_tx_reverted_state_overrides(ethermint): "balance": hex(balance), "nonce": hex(nonce), } - } + }, }, ], ) diff --git a/tests/integration_tests/utils.py b/tests/integration_tests/utils.py index 9d5e9a15b2..1893cdc374 100644 --- a/tests/integration_tests/utils.py +++ b/tests/integration_tests/utils.py @@ -44,6 +44,7 @@ "Caller": "Caller.sol", "Random": "Random.sol", "TestBlockTxProperties": "TestBlockTxProperties.sol", + "FeeCollector": "FeeCollector.sol", } diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 12179d35f4..13626e35a9 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -728,12 +728,6 @@ func (k *Keeper) prepareTrace( return nil, 0, status.Error(codes.Internal, err.Error()) } - if res.VmError != "" { - if res.VmError == vm.ErrInsufficientBalance.Error() { - return nil, 0, status.Error(codes.Internal, res.VmError) - } - } - var result interface{} result, err = tracer.GetResult() if err != nil {