From 5b371c706d6a44f1f6afb2112b526c1b0cf7b05a Mon Sep 17 00:00:00 2001 From: vitaliy Date: Tue, 17 Sep 2024 17:19:14 +0300 Subject: [PATCH] Add test for tracing EVM deposit --- .../evm/jsonrpc/jsonrpctest/jsonrpc_test.go | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go b/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go index 8d2b2892b5..e66a0e8978 100644 --- a/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go +++ b/packages/evm/jsonrpc/jsonrpctest/jsonrpc_test.go @@ -607,6 +607,43 @@ func TestRPCTraceTx(t *testing.T) { require.Contains(t, trace2.GasUsed, "0x") } +func TestRPCTraceEvmDeposit(t *testing.T) { + env := newSoloTestEnv(t) + wallet, _ := env.solo.NewKeyPairWithFunds() + _, evmAddr := env.soloChain.NewEthereumAccountWithL2Funds() + + err := env.soloChain.TransferAllowanceTo( + isc.NewAssetsBaseTokens(1000), + isc.NewEthereumAddressAgentID(env.soloChain.ChainID, evmAddr), + wallet) + + block := env.BlockByNumber(nil) + require.NoError(t, err) + txs := block.Transactions() + tx := txs[0] + + require.Equal(t, evmAddr, *tx.To()) + + rc, err := env.TxReceipt(txs[0].Hash()) + require.NoError(t, err) + require.EqualValues(t, types.ReceiptStatusSuccessful, rc.Status) + + var res1 json.RawMessage + err = env.RawClient.CallContext( + context.Background(), + &res1, + "debug_traceTransaction", + tx.Hash().Hex(), + tracers.TraceConfig{TracerConfig: []byte(`{"tracer": "callTracer"}`)}, + ) + require.NoError(t, err) + + var trace1 []jsonrpc.CallFrame + err = json.Unmarshal(res1, &trace1) + require.NoError(t, err) + require.Len(t, trace1, 0) +} + func TestRPCTraceBlock(t *testing.T) { env := newSoloTestEnv(t) creator, creatorAddress := env.soloChain.NewEthereumAccountWithL2Funds()