celo-org / celo-blockchain

Official repository for the golang Celo Blockchain
https://celo.org
GNU Lesser General Public License v3.0
552 stars 196 forks source link

nil pointer and crash in `createConversionFunctions` #1870

Open lahabana opened 2 years ago

lahabana commented 2 years ago

Description

This happened while rewinding a proxy on mainnet. It caused the node to crash and restart, it has since passed this block without issue so I guess it's probably a race.

74109936776644,"msg":"Imported new chain segment","number":"11801944","severity":"info","timestamp":"2022-03-14T18:57:25.490722806Z","txs":1371}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd30899]

goroutine 2514050 [running]:
github.com/celo-org/celo-blockchain/contracts/currency.(*Currency).ToCELO(...)
    github.com/celo-org/celo-blockchain/contracts/currency/currency.go:54
github.com/celo-org/celo-blockchain/miner.createConversionFunctions.func2(0xc086de22c0, 0xc069037b90, 0xc086de22c0)
    github.com/celo-org/celo-blockchain/miner/block.go:368 +0x39
github.com/celo-org/celo-blockchain/core/types.NewTxWithMinerFee(0xc03da49c20, 0xc0a2e57b10, 0xc0a2e57b20, 0x9367b4899f7ab52c, 0xca634464902cefc5, 0x1c1305f3)
    github.com/celo-org/celo-blockchain/core/types/transaction.go:555 +0xa2
github.com/celo-org/celo-blockchain/core/types.NewTransactionsByPriceAndNonce(0x19b8a18, 0xc01c345ac0, 0xc053467080, 0xc0a2e57b10, 0xc0a2e57b20, 0xc0a2e57b20)
    github.com/celo-org/celo-blockchain/core/types/transaction.go:609 +0x207
github.com/celo-org/celo-blockchain/miner.(*worker).constructPendingStateBlock(0xc01455bdc0, 0x19b5378, 0xc05baf1d00, 0xc0142e0b40)
    github.com/celo-org/celo-blockchain/miner/worker.go:344 +0x610
github.com/celo-org/celo-blockchain/miner.(*worker).mainLoop.func1.2(0xc01455bdc0, 0xc000063fa0, 0xc0142e0b40, 0xc01414bd60)
    github.com/celo-org/celo-blockchain/miner/worker.go:391 +0x4b
created by github.com/celo-org/celo-blockchain/miner.(*worker).mainLoop.func1
    github.com/celo-org/celo-blockchain/miner/worker.go:390 +0x196
Connection to compute.8893688920152357861 closed.

Context

carterqw2 commented 1 year ago

Check if related to https://github.com/celo-org/celo-blockchain/issues/1982