sei-protocol / sei-chain

Apache License 2.0
2.7k stars 806 forks source link

[BUG] eth_getBlockByNumber method handler crashed #1893

Open vyuldashev opened 6 days ago

vyuldashev commented 6 days ago

Seid version

name: sei
server_name: <appd>
version: v5.9.0-hotfix
commit: 895159d3d1a4e3cda1914313baa01e9aa02a7bf0
build_tags: netgo muslc,
go: go version go1.21.4 linux/amd64
build_deps:
- cosmossdk.io/errors@v1.0.0
- filippo.io/edwards25519@v1.0.0-rc.1
- github.com/99designs/keyring@v1.2.1

Chain ID Mainnet / Pacific

Describe the bug

eth_getBlockByNumber returns:

{
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
        "code": -32603,
        "message": "method handler crashed"
    }
}

To Reproduce Example request for block number 107120412:

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_getBlockByNumber",
    "params": [
     "0x662871c", false   
    ]
}

Additional Context

Node logs shows:

sei  | ERROR[10-08|10:25:23.271] RPC method eth_getBlockByNumber crashed: kv store with key KVStoreKey{0xc0005e8640, evm} has not been registered in stores
sei  | goroutine 11983382 [running]:
sei  | github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/service.go:199 +0x85
sei  | panic({0x2eb43a0?, 0xc012212870?})
sei  |  /usr/local/go/src/runtime/panic.go:914 +0x21f
sei  | github.com/cosmos/cosmos-sdk/store/cachemulti.Store.GetKVStore({{0x42f9500, 0xc0107662a0}, 0xc047041ef0, 0xc000bbd4a0, {0x0, 0x0}, 0x0, 0xc047041e90, {0x5bde940, 0x0, ...}}, ...)
sei  |  /go/pkg/mod/github.com/sei-protocol/sei-cosmos@v0.3.37-0.20240923023912-aa7a702d42cc/store/cachemulti/store.go:205 +0xcd
sei  | github.com/cosmos/cosmos-sdk/types.Context.KVStore({{0x42ddde0, 0x5bde940}, {0x42fc5f8, 0xc03e2a75c0}, {{0x0, 0x0}, {0xc000aac090, 0x9}, 0x660b35f, {0x39d88a98, ...}, ...}, ...}, ...)
sei  |  /go/pkg/mod/github.com/sei-protocol/sei-cosmos@v0.3.37-0.20240923023912-aa7a702d42cc/types/context.go:522 +0x92
sei  | github.com/sei-protocol/sei-chain/x/evm/keeper.(*Keeper).GetBlockBloom(_, {{0x42ddde0, 0x5bde940}, {0x42fc5f8, 0xc03e2a75c0}, {{0x0, 0x0}, {0xc000aac090, 0x9}, 0x660b35f, ...}, ...})
sei  |  /code/x/evm/keeper/log.go:15 +0x9b
sei  | github.com/sei-protocol/sei-chain/evmrpc.(*BlockAPI).getBlockByNumber(0xc0143e1f20, {0x42de288, 0xc043c79c20}, 0x1?, 0x1?)
sei  |  /code/evmrpc/block.go:133 +0x178
sei  | github.com/sei-protocol/sei-chain/evmrpc.(*BlockAPI).GetBlockByNumber(0xc0143e1f20, {0x42de288, 0xc043c79c20}, 0x660b35f, 0x4?)
sei  |  /code/evmrpc/block.go:117 +0xb74
sei  | reflect.Value.call({0xc0004d4770?, 0xc000828c00?, 0x7f681e02ca28?}, {0x334b2e9, 0x4}, {0xc028815ce0, 0x4, 0x466af2?})
sei  |  /usr/local/go/src/reflect/value.go:596 +0xce7
sei  | reflect.Value.Call({0xc0004d4770?, 0xc000828c00?, 0x590c65?}, {0xc028815ce0?, 0x2?, 0x16?})
sei  |  /usr/local/go/src/reflect/value.go:380 +0xb9
sei  | github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc0150f61e0, {0x42de288?, 0xc043c79c20}, {0xc0096628d0, 0x14}, {0xc042954d50, 0x2, 0x4e5eaf?})
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/service.go:205 +0x37c
sei  | github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0xc0096628e8?, {0x42de288?, 0xc043c79c20?}, 0xc01074f030, 0x2?, {0xc042954d50?, 0x4681c8?, 0x750000c009880000?})
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:565 +0x3c
sei  | github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc00ee5f0e0, 0xc042954c90, 0xc01074f030)
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:512 +0x22f
sei  | github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc00ee5f0e0, 0xc042954cf0?, 0xc01074f030)
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:470 +0x22d
sei  | github.com/ethereum/go-ethereum/rpc.(*handler).handleNonBatchCall(0xc00ee5f0e0, 0xc042954c90, 0xc01074f030)
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:296 +0x187
sei  | github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1.1(0x42de288?)
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:269 +0x25
sei  | github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1()
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:387 +0xbe
sei  | created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc in goroutine 4280
sei  |  /go/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:383 +0x79
sei  |
vyuldashev commented 6 days ago

I think I found a solution. If you have sc-enable = true in your config.toml, then you need to also enable ss-enable

xinzhongyoumeng commented 6 days ago

sc-enable

yeah, the interface is ok, but the log is also tell it error as is crashed.

ERROR[10-08|22:24:33.679] RPC method eth_getBlockByNumber crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 139287 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/service.go:199 +0x85
panic({0x24d9860?, 0x4ccb5d0?})
    /opt/seimain/goenv/go/src/runtime/panic.go:914 +0x21f
math/big.(*Int).Quo(0xc00ff89520, 0x0, 0xc00050f0a0)
    /opt/seimain/goenv/go/src/math/big/int.go:268 +0x28
github.com/cosmos/cosmos-sdk/types.chopPrecisionAndTruncate(...)
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/sei-cosmos@v0.3.37-0.20240923023912-aa7a702d42cc/types/decimal.go:589
github.com/cosmos/cosmos-sdk/types.Dec.TruncateInt({0x3816c70?})
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/sei-cosmos@v0.3.37-0.20240923023912-aa7a702d42cc/types/decimal.go:603 +0x30
github.com/sei-protocol/sei-chain/evmrpc.EncodeTmBlock({{0x38026a0, 0x4dd4820}, {0x3820ef8, 0xc00ff74de0}, {{0x0, 0x0}, {0xc000736390, 0x9}, 0x660b35f, {0x1be5b48a, ...}, ...}, ...}, ...)
    /opt/seimain/core/sei-chain/evmrpc/block.go:223 +0x4a9
github.com/sei-protocol/sei-chain/evmrpc.(*BlockAPI).getBlockByNumber(0xc006528060, {0x3802b48, 0xc014cd3c70}, 0x1?, 0x1?)
    /opt/seimain/core/sei-chain/evmrpc/block.go:134 +0x296
github.com/sei-protocol/sei-chain/evmrpc.(*BlockAPI).GetBlockByNumber(0xc006528060, {0x3802b48, 0xc014cd3c70}, 0x660b35f, 0x4?)
    /opt/seimain/core/sei-chain/evmrpc/block.go:117 +0xb74
reflect.Value.call({0xc000548620?, 0xc005d3a320?, 0x7f00f4639b90?}, {0x286ed6d, 0x4}, {0xc00fdf49c0, 0x4, 0x41ac12?})
    /opt/seimain/goenv/go/src/reflect/value.go:596 +0xce7
reflect.Value.Call({0xc000548620?, 0xc005d3a320?, 0x544e65?}, {0xc00fdf49c0?, 0x2?, 0x16?})
    /opt/seimain/goenv/go/src/reflect/value.go:380 +0xb9
github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc006528300, {0x3802b48?, 0xc014cd3c70}, {0xc008ce1bd8, 0x14}, {0xc017f247b0, 0x2, 0x49a04f?})
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/service.go:205 +0x379
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0xc008ce1bc0?, {0x3802b48?, 0xc014cd3c70?}, 0xc022609f80, 0x2?, {0xc017f247b0?, 0x41c2e8?, 0x4c0000c0000a5c00?})
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:565 +0x3c
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc00e227900, 0xc017f246f0, 0xc022609f80)
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:512 +0x22f
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc00e227900, 0xc017f24750?, 0xc022609f80)
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:470 +0x22d
github.com/ethereum/go-ethereum/rpc.(*handler).handleNonBatchCall(0xc00e227900, 0xc017f246f0, 0xc022609f80)
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:296 +0x187
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1.1(0x3802b48?)
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:269 +0x25
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1()
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:387 +0xbe
created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc in goroutine 139285
    /opt/seimain/goenv/gopath/pkg/mod/github.com/sei-protocol/go-ethereum@v1.13.5-sei-9.0.20240923025222-815b87dde97b/rpc/handler.go:383 +0x79
WARN [10-08|22:24:33.679] Served eth_getBlockByNumber              conn=172.31.239.240:59898 reqid=1 duration="995.353µs" err="method handler crashed"