sei-chain icon indicating copy to clipboard operation
sei-chain copied to clipboard

[BUG] panic when making `eth_chainId` (and maybe others) just after `seid` started

Open maoueh opened this issue 1 year ago • 2 comments

Seid version On seiv2 branch commit 01f00b30ad15cafdd2bb3bce5a16f64e85dc6728.

Chain ID Local chain via ./scripts/initialize_local_chain.sh

Describe the bug Panic when making an ETH JSON-RPC call not long after the chain booted.

To Reproduce Apply following diff to ./scripts/initialize_local_chain.sh:

diff --git a/scripts/initialize_local_chain.sh b/scripts/initialize_local_chain.sh
index bc29bd02..b0571c6e 100755
--- a/scripts/initialize_local_chain.sh
+++ b/scripts/initialize_local_chain.sh
@@ -111,5 +111,13 @@ fi
 
 ~/go/bin/seid config keyring-backend test
 
+fund() {
+  echo "Initializing chain..."
+  sleep 1 # Wait for chain to be ready instread...
+  ~/go/bin/seid tx evm send 0xF87A299e6bC7bEba58dbBe5a5Aa21d49bCD16D52 100000000000000000 --from admin
+}
+
+fund &
+
 # start the chain with log tracing
 GORACE="log_path=/tmp/race/seid_race" ~/go/bin/seid start --trace --chain-id sei-chain

And run it, you should get following panic:

10:22AM ERR failed to send request for peers err="no available peers to send a PEX request to (retrying)"
ERROR[03-28|10:22:14.552] RPC method eth_chainId crashed: UnmarshalJSON cannot decode empty bytes
goroutine 470 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/service.go:199 +0x74
panic({0x1056a4520?, 0x14000a06670?})
	/opt/homebrew/Cellar/go/1.22.0/libexec/src/runtime/panic.go:770 +0x124
github.com/cosmos/cosmos-sdk/x/params/types.Subspace.Get({{_, _}, _, {_, _}, {_, _}, {_, _, _}, ...}, ...)
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/x/params/types/subspace.go:109 +0x1e0
github.com/cosmos/cosmos-sdk/x/params/types.Subspace.GetParamSet({{_, _}, _, {_, _}, {_, _}, {_, _, _}, ...}, ...)
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/x/params/types/subspace.go:222 +0x124
github.com/sei-protocol/sei-chain/x/evm/keeper.(*Keeper).GetParams(...)
	/Users/maoueh/work/sf/sei/chain/x/evm/keeper/params.go:19
github.com/sei-protocol/sei-chain/x/evm/keeper.(*Keeper).ChainID(_, {{0x105ac1f40, 0x1070ccae0}, {0x105ae04a0, 0x14000736c00}, {{0x0, 0x0}, {0x140009ac470, 0x9}, 0x0, ...}, ...})
	/Users/maoueh/work/sf/sei/chain/x/evm/keeper/params.go:44 +0x130
github.com/sei-protocol/sei-chain/evmrpc.(*InfoAPI).ChainId(0x14002e928c0)
	/Users/maoueh/work/sf/sei/chain/evmrpc/info.go:49 +0xc4
reflect.Value.call({0x14002e84b90?, 0x14002e864d8?, 0x30?}, {0x1048aca95, 0x4}, {0x14003bffdd0, 0x1, 0x1040aa984?})
	/opt/homebrew/Cellar/go/1.22.0/libexec/src/reflect/value.go:596 +0x980
reflect.Value.Call({0x14002e84b90?, 0x14002e864d8?, 0x0?}, {0x14003bffdd0?, 0x140?, 0x140005e1b08?})
	/opt/homebrew/Cellar/go/1.22.0/libexec/src/reflect/value.go:380 +0x94
github.com/ethereum/go-ethereum/rpc.(*callback).call(0x14003c97320, {0x105ac2348, 0x14003afe460}, {0x14002d98093, 0xb}, {0x1070ccae0, 0x0, 0x1040a36ec?})
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/service.go:205 +0x2d0
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0x14002d980a0?, {0x105ac2348?, 0x14003afe460?}, 0x14000d55ea0, 0x0?, {0x1070ccae0?, 0x14002f3cd78?, 0x102c94bc4?})
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:565 +0x40
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0x14003e24320, 0x14003bffd10, 0x14000d55ea0)
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:512 +0x1d8
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0x14003e24320, 0x14003bffd10, 0x14000d55ea0)
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:470 +0x1d0
github.com/ethereum/go-ethereum/rpc.(*handler).handleNonBatchCall(0x14003e24320, 0x14003bffd10, 0x14000d55ea0)
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:296 +0x148
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1.1(0x105ac2348?)
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:269 +0x2c
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1()
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:387 +0xbc
created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc in goroutine 482
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/rpc/handler.go:383 +0x84

WARN [03-28|10:22:14.553] Served eth_chainId                       conn=127.0.0.1:54504 reqid=send-cli duration=1.059375ms err="method handler crashed"
panic: interface conversion: interface {} is nil, not string

goroutine 1 [running]:
github.com/sei-protocol/sei-chain/x/evm/client/cli.getChainId({0x140002a4f48, 0x13})
	/Users/maoueh/work/sf/sei/chain/x/evm/client/cli/tx.go:753 +0x3b0
github.com/sei-protocol/sei-chain/x/evm/client/cli.getTxData(0x140006f1b08)
	/Users/maoueh/work/sf/sei/chain/x/evm/client/cli/tx.go:772 +0x148
github.com/sei-protocol/sei-chain/x/evm/client/cli.CmdSend.func1(0x140006f1b08, {0x1400058b240, 0x2, 0x4?})
	/Users/maoueh/work/sf/sei/chain/x/evm/client/cli/tx.go:185 +0x1ac
github.com/spf13/cobra.(*Command).execute(0x140006f1b08, {0x1400058b200, 0x4, 0x4})
	/Users/maoueh/go/pkg/mod/github.com/spf13/[email protected]/command.go:916 +0x654
github.com/spf13/cobra.(*Command).ExecuteC(0x140002ff508)
	/Users/maoueh/go/pkg/mod/github.com/spf13/[email protected]/command.go:1044 +0x320
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/maoueh/go/pkg/mod/github.com/spf13/[email protected]/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/Users/maoueh/go/pkg/mod/github.com/spf13/[email protected]/command.go:961
github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x140002ff508, {0x14000056c60, 0x12})
	/Users/maoueh/go/pkg/mod/github.com/sei-protocol/[email protected]/server/cmd/execute.go:35 +0x13c
main.main()
	/Users/maoueh/work/sf/sei/chain/cmd/seid/main.go:16 +0x34

Expected behavior No pannic Additional context Add any other context about the problem here.

maoueh avatar Mar 28 '24 14:03 maoueh

This is most probably solved by #1548, I'll test later when I have a chance.

maoueh avatar Apr 16 '24 13:04 maoueh

The panic went away with the way ChainID is defined. Still getting an error:

WARN [04-16|12:39:16.428] Served eth_sendRawTransaction            conn=127.0.0.1:51645 reqid=1 duration=1.173334ms err=": unknown"
Error: : unknown
Usage:
  seid tx evm send [to EVM address] [amount in wei] --from=<sender> --gas-fee-cap=<cap> --gas-limit=<limit> --evm-rpc=<url> [flags]
  ...

Feel free to close if you think it's not relevant.

maoueh avatar Apr 16 '24 16:04 maoueh

fixed in https://github.com/sei-protocol/sei-chain/pull/1548

philipsu522 avatar Jun 25 '24 18:06 philipsu522