Skip to content

Commit

Permalink
Problem: trace response for failed tx is not aligned with go-ethereum (
Browse files Browse the repository at this point in the history
…#439)

this bug was introduced in ec8d73f
  • Loading branch information
mmsqe authored Mar 27, 2024
1 parent accc2df commit a53a373
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (ante) [#422](https://github.com/crypto-org-chain/ethermint/pull/422) vendor `NewDeductFeeDecorator` to re-use the custom `checkTxFeeWithValidatorMinGasPrices` method, so it'll repsect the `DefaultPriorityReduction` config.
- (feemarket) [#433](https://github.com/crypto-org-chain/ethermint/pull/433) Fix sdk int conversion panic with baseFee.
* (rpc) [#434](https://github.com/crypto-org-chain/ethermint/pull/434) No need gasPrice when patch gasUsed for `eth_getTransactionReceipt`.
* (rpc) [#439](https://github.com/crypto-org-chain/ethermint/pull/439) Align trace response for failed tx with go-ethereum.

### Features

Expand Down
31 changes: 31 additions & 0 deletions tests/integration_tests/test_tracers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,37 @@
)


def test_trace_error(ethermint, geth):
method = "debug_traceTransaction"
tracer = {"tracer": "callTracer"}
tracers = [[tracer]]
iterations = 1
acc = derive_random_account()

def process(w3):
# fund new sender to deploy contract with same address
fund_acc(w3, acc)
contract, _ = deploy_contract(w3, CONTRACTS["TestMessageCall"], key=acc.key)
tx = contract.functions.test(iterations).build_transaction({"gas": 21204})
tx_hash = send_transaction(w3, tx)["transactionHash"].hex()
res = []
call = w3.provider.make_request
with ThreadPoolExecutor(len(tracers)) as exec:
params = [([tx_hash] + cfg) for cfg in tracers]
exec_map = exec.map(call, itertools.repeat(method), params)
for resp in exec_map:
assert "out of gas" in resp["result"]["error"], resp
res = [json.dumps(resp["result"], sort_keys=True)]
return res

providers = [ethermint.w3, geth.w3]
with ThreadPoolExecutor(len(providers)) as exec:
tasks = [exec.submit(process, w3) for w3 in providers]
res = [future.result() for future in as_completed(tasks)]
assert len(res) == len(providers)
assert res[0] == res[-1], res


def test_trace_transactions_tracers(ethermint, geth):
method = "debug_traceTransaction"
tracer = {"tracer": "callTracer"}
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ func (k *Keeper) prepareTrace(
}

if res.VmError != "" {
if res.VmError != vm.ErrExecutionReverted.Error() {
if res.VmError != vm.ErrExecutionReverted.Error() && res.VmError != vm.ErrOutOfGas.Error() {
return nil, 0, status.Error(codes.Internal, res.VmError)
}
}
Expand Down

0 comments on commit a53a373

Please sign in to comment.