Fantom-foundation / Sonic

go-opera fork for Carmen and Tosca integration
GNU Lesser General Public License v3.0
14 stars 16 forks source link

debug_traceBlockByNumber method handler crashed with callTracer and block 0x511b860 #169

Closed pc-quiknode closed 1 month ago

pc-quiknode commented 1 month ago

Describe the bug

Version

$ sonicd version
Sonic
Version: 1.2.1-d
Git Commit: 350f8b77bfa3060340ea650d25a16a8517f21007
Git Commit Date: 1718888037
Architecture: amd64
Protocol Versions: [63]
Go Version: go1.21.6
Operating System: linux
GOPATH=
GOROOT=/home/pchung/.gvm/gos/go1.21.6

Request Payload

{
   "method":"debug_traceBlockByNumber",
   "params":[
      "0x511b860",
      {
         "tracer":"callTracer"
      }
   ],
   "id":1,
   "jsonrpc":"2.0"
}

Stacktrace

ERROR[07-10|03:45:37.458] RPC method debug_traceBlockByNumber crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 31261877 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/service.go:201 +0x85
panic({0x14b3660?, 0x23a5400?})
        /home/pchung/.gvm/gos/go1.21.6/src/runtime/panic.go:914 +0x21f
github.com/Fantom-foundation/go-opera/ethapi.(*PublicDebugAPI).traceTx(0xc00095ace0, {0x193f138, 0xc394654380}, {0x1948ff0?, 0xc416fecc60?}, 0xc394679268, 0xc53d483400?, {0x195a2f0, 0xc6266334c0}, 0xc60150cbe0)
        /home/pchung/source/Sonic/ethapi/api.go:2200 +0xdf1
github.com/Fantom-foundation/go-opera/ethapi.(*PublicDebugAPI).traceBlock(0xc00095ace0, {0x193f138, 0xc394654380}, 0xc2723ef340, 0x1520700?)
        /home/pchung/source/Sonic/ethapi/api.go:2272 +0x5a5
github.com/Fantom-foundation/go-opera/ethapi.(*PublicDebugAPI).TraceBlockByNumber(0xc00095ace0, {0x193f138, 0xc394654380}, 0x5?, 0x8?)
        /home/pchung/source/Sonic/ethapi/api.go:2230 +0x66
reflect.Value.call({0xc00046a540?, 0xc07968f3b0?, 0x7fa24aa15948?}, {0x16d6e83, 0x4}, {0xc555363aa0, 0x4, 0x428fb2?})
        /home/pchung/.gvm/gos/go1.21.6/src/reflect/value.go:596 +0xce7
reflect.Value.Call({0xc00046a540?, 0xc07968f3b0?, 0x7fa243160aa8?}, {0xc555363aa0?, 0x10?, 0xc29d154400?})
        /home/pchung/.gvm/gos/go1.21.6/src/reflect/value.go:380 +0xb9
github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc23cf1ca20, {0x193f138?, 0xc394654380}, {0xc646a46a80, 0x18}, {0xc30184f290, 0x2, 0x45d964b800?})
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/service.go:207 +0x379
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0x193f0c8?, {0x193f138?, 0xc394654380?}, 0xc394654310, 0x2?, {0xc30184f290?, 0xc3df0d8120?, 0x90?})
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/handler.go:405 +0x3c
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc3df0d8000, 0xc30184f230, 0xc394654310)
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/handler.go:353 +0x270
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc3df0d8000, 0x30?, 0xc394654310)
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/handler.go:310 +0xbd
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1(0xc30184f230)
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/handler.go:148 +0x2f
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1()
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/handler.go:238 +0xeb
created by github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc in goroutine 31135388
        /home/pchung/.gvm/pkgsets/go1.21.6/global/pkg/mod/github.com/!fantom-foundation/go-ethereum-substate@v1.1.1-0.20240523185630-b058188a043a/rpc/handler.go:232 +0x95
jmpike commented 1 month ago

The Opera tx tracer code used to implement tracing expected the recipient address to always exist, but it actually can be nil value on some cases. Pull request #170 should address the issue.