maticnetwork / bor

Official repository for the Polygon Blockchain
https://polygon.technology/
GNU Lesser General Public License v3.0
1.01k stars 490 forks source link

Crash in eth_getTransactionReceipt after block prune #1275

Closed alecalve closed 4 months ago

alecalve commented 5 months ago

System information

Bor client version: 1.3.3

OS & Version: Linux

Environment: Polygon Mainnet

Type of node: Archive

Additional Information:

            - server
            - --chain=mainnet
            - --datadir=/opt/data
            - --syncmode=full
            - --gcmode=full
            - --bor.heimdall=https://heimdall-api.polygon.technology
            - --bor.logs
            - --http
            - --http.addr=0.0.0.0
            - --http.api=eth,web3,net,debug,bor
            - --http.vhosts=*
            - --ipcdisable
            - --snapshot=false
            - --txlookuplimit=0
            - --nat
            - extip:$(EXTERNAL_IP)

Overview of the problem

This occurs after having run:

bor snapshot prune-block --datadir=/opt/data --block-amount-reserved=16000000

HTTP Request:

curl --silent 'http://localhost:8545' -X POST -H "Content-Type: application/json" -d '{"jsonrpc": "2.0","id":1,"method":"eth_getTransactionReceipt","params":["0x2004a2a2abcaeacafb7ee6148fedcc14c6f48a531375e0f208eb59c4650339ab"]}' | jq
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32603,
    "message": "method handler crashed"
  }
}

Node logs:

ERROR[06-24|13:51:38.871] Invalid bor receipt RLP                  hash=8beab0..e7e923 err="rlp: expected input string or byte for []uint8, decoding into (types.ReceiptForStorage)(types.storedReceiptRLP).PostStateOrStatus"
ERROR[06-24|13:51:38.871] RPC method eth_getTransactionReceipt crashed: runtime error: invalid memory address or nil pointer dereference
goroutine 803016 [running]:
github.com/ethereum/go-ethereum/rpc.(*callback).call.func1()
    /go/src/github.com/maticnetwork/bor/rpc/service.go:217 +0x85
panic({0x2672ac0?, 0x4e90c80?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
github.com/ethereum/go-ethereum/internal/ethapi.marshalReceipt(0x0, {0x8b, 0xea, 0xb0, 0xfc, 0xb7, 0x82, 0x59, 0xc1, 0xb, ...}, ...)
    /go/src/github.com/maticnetwork/bor/internal/ethapi/api.go:2256 +0x567
github.com/ethereum/go-ethereum/internal/ethapi.(*TransactionAPI).GetTransactionReceipt(0xc04b8e06c0, {0x39ced28, 0xc112c500f0}, {0x20, 0x4, 0xa2, 0xa2, 0xab, 0xca, 0xea, ...})
    /go/src/github.com/maticnetwork/bor/internal/ethapi/api.go:2234 +0x335
reflect.Value.call({0xc04cc88ba0?, 0xc04ccaa318?, 0x50?}, {0x2a811c0, 0x4}, {0xc112c50190, 0x3, 0xc112c50190?})
    /usr/local/go/src/reflect/value.go:596 +0xce5
reflect.Value.Call({0xc04cc88ba0?, 0xc04ccaa318?, 0x1?}, {0xc112c50190?, 0x16?, 0x16?})
    /usr/local/go/src/reflect/value.go:380 +0xb9
github.com/ethereum/go-ethereum/rpc.(*callback).call(0xc04ccba660, {0x39ced28, 0xc112c500f0}, {0xc1038f5560, 0x19}, {0xc0aa1b2e88, 0x1, 0x49fccf?})
    /go/src/github.com/maticnetwork/bor/rpc/service.go:224 +0x36d
github.com/ethereum/go-ethereum/rpc.(*handler).runMethod(0xc0bc8afcc0?, {0x39ced28?, 0xc112c500f0?}, 0xc100084930, 0x1?, {0xc0aa1b2e88?, 0xc13e09fda0?, 0x41c278?})
    /go/src/github.com/maticnetwork/bor/rpc/handler.go:607 +0x3c
github.com/ethereum/go-ethereum/rpc.(*handler).handleCall(0xc0bfea6a00, 0xc0b641a210, 0xc100084930)
    /go/src/github.com/maticnetwork/bor/rpc/handler.go:548 +0x22f
github.com/ethereum/go-ethereum/rpc.(*handler).handleCallMsg(0xc0bfea6a00, 0xc0b641a210, 0xc100084930)
    /go/src/github.com/maticnetwork/bor/rpc/handler.go:499 +0x22d
github.com/ethereum/go-ethereum/rpc.(*handler).handleNonBatchCall(0xc0bfea6a00, 0xc0b641a210, 0xc100084930)
    /go/src/github.com/maticnetwork/bor/rpc/handler.go:312 +0x18a
github.com/ethereum/go-ethereum/rpc.(*handler).handleMsg.func1.1(0xc07b6da000?)
    /go/src/github.com/maticnetwork/bor/rpc/handler.go:285 +0x25
github.com/ethereum/go-ethereum/rpc.(*handler).startCallProc.func1()
    /go/src/github.com/maticnetwork/bor/rpc/handler.go:409 +0xc2
github.com/ethereum/go-ethereum/rpc.(*SafePool).Submit.func1()
    /go/src/github.com/maticnetwork/bor/rpc/execution_pool.go:57 +0x13
created by github.com/ethereum/go-ethereum/rpc.(*SafePool).Submit in goroutine 802605
    /go/src/github.com/maticnetwork/bor/rpc/execution_pool.go:56 +0xb8
alecalve commented 5 months ago

The block at height 23634624 containing the transaction is in the db as eth_getBlockByNumber returns data for that block.

See additionally:

INFO [06-24|13:17:54.805] Opened ancient database                  database=/opt/data/bor/chaindata/ancient readonly=false frozen=38,853,632 offset=22,853,632
manav2401 commented 5 months ago

I will try to reproduce this and get back at you. Thanks for reporting.

github-actions[bot] commented 4 months ago

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled for 28 days with no activity.