ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
429 stars 110 forks source link

paseo: Gossamer panics at runtime call `ext_offchain_submit_transaction_version_1` #3706

Closed EclesioMeloJunior closed 4 months ago

EclesioMeloJunior commented 8 months ago

Describe the bug

2024-01-17T18:04:30-04:00 ERROR    block data processing for block with hash 0xa8d6f1328d20d0589892fac0c164b743e00011a0d5f056323816d86dceb8d253 failed: processing block data with header and body: babe verifying block: could not verify block equivocation: submiting equivocation: submitting equivocation report to runtime: running runtime function: runtime error: invalid memory address or nil pointer dereference (recovered by wazero)
wasm stack trace:
    env.ext_offchain_submit_transaction_version_1(i64) i64
    ._ZN5sp_io8offchain26extern_host_function_impls18submit_transaction17h4811ae26449dbe4bE(i32) i32
    ._ZN503_$LT$pallet_babe..equivocation..EquivocationReportSystem$LT$T$C$R$C$P$C$L$GT$$u20$as$u20$sp_staking..offence..OffenceReportSystem$LT$core..option..Option$LT$$LT$T$u20$as$u20$frame_system..pallet..Config$GT$..AccountId$GT$$C$$LP$sp_consensus_slots..EquivocationProof$LT$$LT$$LT$T$u20$as$u20$frame_system..pallet..Config$GT$..Block$u20$as$u20$sp_runtime..traits..HeaderProvider$GT$..HeaderT$C$sp_consensus_babe..app..Public$GT$$C$$LT$T$u20$as$u20$pallet_babe..pallet..Config$GT$..KeyOwnerProof$RP$$GT$$GT$16publish_evidence17h95bce56dda2570b7E(i32) i32
    ._ZN1364_$LT$paseo_runtime..Runtime$u20$as$u20$sp_consensus_babe..runtime_decl_for_babe_api..BabeApiV2$LT$sp_runtime..generic..block..Block$LT$sp_runtime..generic..header..Header$LT$u32$C$sp_runtime..traits..BlakeTwo256$GT$$C$sp_runtime..generic..unchecked_extrinsic..UncheckedExtrinsic$LT$sp_runtime..multiaddress..MultiAddress$LT$$LT$$LT$sp_runtime..MultiSignature$u20$as$u20$sp_runtime..traits..Verify$GT$..Signer$u20$as$u20$sp_runtime..traits..IdentifyAccount$GT$..AccountId$C$$LP$$RP$$GT$$C$paseo_runtime..RuntimeCall$C$sp_runtime..MultiSignature$C$$LP$frame_system..extensions..check_non_zero_sender..CheckNonZeroSender$LT$paseo_runtime..Runtime$GT$$C$frame_system..extensions..check_spec_version..CheckSpecVersion$LT$paseo_runtime..Runtime$GT$$C$frame_system..extensions..check_tx_version..CheckTxVersion$LT$paseo_runtime..Runtime$GT$$C$frame_system..extensions..check_genesis..CheckGenesis$LT$paseo_runtime..Runtime$GT$$C$frame_system..extensions..check_mortality..CheckMortality$LT$paseo_runtime..Runtime$GT$$C$frame_system..extensions..check_nonce..CheckNonce$LT$paseo_runtime..Runtime$GT$$C$frame_system..extensions..check_weight..CheckWeight$LT$paseo_runtime..Runtime$GT$$C$pallet_transaction_payment..ChargeTransactionPayment$LT$paseo_runtime..Runtime$GT$$C$polkadot_runtime_common..claims..PrevalidateAttests$LT$paseo_runtime..Runtime$GT$$RP$$GT$$GT$$GT$$GT$45submit_report_equivocation_unsigned_extrinsic17hf05098534b994e78E(i32,i32) i32
    .BabeApi_submit_report_equivocation_unsigned_extrinsic(i32,i32) i64

Go runtime stack trace:
goroutine 328720 [running]:
runtime/debug.Stack()
    runtime/debug/stack.go:24 +0x64
github.com/tetratelabs/wazero/internal/wasmdebug.(*stackTrace).FromRecovered(0x14000629590?, {0x1044dc9e0?, 0x1052156b0?})
    github.com/tetratelabs/wazero@v1.1.0/internal/wasmdebug/debug.go:139 +0xc4
github.com/tetratelabs/wazero/internal/engine/compiler.(*callEngine).deferredOnCall(0x1400044a240, {0x1047344b8, 0x140071c6c00}, 0x1400713e3a8?, {0x1044dc9e0, 0x1052156b0})
    github.com/tetratelabs/wazero@v1.1.0/internal/engine/compiler/engine.go:884 +0x37c
github.com/tetratelabs/wazero/internal/engine/compiler.(*callEngine).call.func1()
    github.com/tetratelabs/wazero@v1.1.0/internal/engine/compiler/engine.go:759 +0x68
panic({0x1044dc9e0?, 0x1052156b0?})
    runtime/panic.go:914 +0x218
github.com/ChainSafe/gossamer/lib/runtime/wazero.ext_offchain_submit_transaction_version_1({0x1047344b8?, 0x140071c6c00?}, {0x104744518, 0x1400022ad00}, 0x1400735bab8?)
    github.com/ChainSafe/gossamer/lib/runtime/wazero/imports.go:1828 +0x260
reflect.Value.call({0x1044c4b60?, 0x10471b8a0?, 0x1400735c1b8?}, {0x103e79d5a, 0x4}, {0x14007139400, 0x3, 0x1037040ec?})
    reflect/value.go:596 +0x994
reflect.Value.Call({0x1044c4b60?, 0x10471b8a0?, 0x1400735c228?}, {0x14007139400?, 0x1400735c288?, 0x100018db8?})
    reflect/value.go:380 +0x94
github.com/tetratelabs/wazero/internal/wasm.callGoFunc({0x1047344b8, 0x140071c6c00}, {0x104744518, 0x1400022ad00}, 0x1400131f338, {0x14006fe5128, 0x1, 0x140013aa1c0?})
    github.com/tetratelabs/wazero@v1.1.0/internal/wasm/gofunc.go:126 +0x33c
github.com/tetratelabs/wazero/internal/wasm.(*reflectGoModuleFunction).Call(0x10db598b8?, {0x1047344b8?, 0x140071c6c00?}, {0x104744518?, 0x1400022ad00?}, {0x14006fe5128?, 0x1400735c368?, 0x102f5af54?})
    github.com/tetratelabs/wazero@v1.1.0/internal/wasm/gofunc.go:41 +0x48
github.com/tetratelabs/wazero/internal/engine/compiler.(*callEngine).execWasmFunction(0x1400044a240, {0x1047344b8, 0x140071c6c00}, 0x105d713c8?)
    github.com/tetratelabs/wazero@v1.1.0/internal/engine/compiler/engine.go:1053 +0x118
github.com/tetratelabs/wazero/internal/engine/compiler.(*callEngine).call(0x1400044a240, {0x1047344b8, 0x140071c6c00}, {0x140006b6b30?, 0x10?, 0x14000680480?}, {0x0, 0x0, 0x0})
    github.com/tetratelabs/wazero@v1.1.0/internal/engine/compiler/engine.go:776 +0x22c
github.com/tetratelabs/wazero/internal/engine/compiler.(*callEngine).Call(0x104734218?, {0x1047344b8?, 0x140071c6c00?}, {0x140006b6b30?, 0x1043f26a0?, 0x14000494aa0?})
    github.com/tetratelabs/wazero@v1.1.0/internal/engine/compiler/engine.go:728 +0xc0
github.com/ChainSafe/gossamer/lib/runtime/wazero.(*Instance).Exec(0x140014cb2c0, {0x1040462a4, 0x35}, {0x14006f94800, 0x668, 0x800})
    github.com/ChainSafe/gossamer/lib/runtime/wazero/instance.go:468 +0x360
github.com/ChainSafe/gossamer/lib/runtime/wazero.(*Instance).BabeSubmitReportEquivocationUnsignedExtrinsic(_, {{0xae, 0x24, 0x8, 0x42, 0xb7, 0x4e, 0x5d, 0xd7, 0x78, ...}, ...}, ...)
    github.com/ChainSafe/gossamer/lib/runtime/wazero/instance.go:618 +0x1b0
github.com/ChainSafe/gossamer/lib/babe.(*verifier).submitAndReportEquivocation(0x1400735cf60, 0x14004f64680)
    github.com/ChainSafe/gossamer/lib/babe/verify.go:374 +0x1a4
github.com/ChainSafe/gossamer/lib/babe.(*verifier).verifyBlockEquivocation(0x1400735cf60, 0x14007318520?)
    github.com/ChainSafe/gossamer/lib/babe/verify.go:414 +0x1b0
github.com/ChainSafe/gossamer/lib/babe.(*verifier).verifyAuthorshipRight(0x1400735cf60, 0x14006f980c0)
    github.com/ChainSafe/gossamer/lib/babe/verify.go:347 +0x8e4
github.com/ChainSafe/gossamer/lib/babe.(*VerificationManager).VerifyBlock(0x140016693e0, 0x14006f980c0)
    github.com/ChainSafe/gossamer/lib/babe/verify.go:194 +0x450
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).processBlockDataWithHeaderAndBody(0x14000501320, {{0xa8, 0xd6, 0xf1, 0x32, 0x8d, 0x20, 0xd0, 0x58, 0x98, ...}, ...}, ...)
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:816 +0x40
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).processBlockData(0x14000501320, {{0xa8, 0xd6, 0xf1, 0x32, 0x8d, 0x20, 0xd0, 0x58, 0x98, ...}, ...}, ...)
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:790 +0x128
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).handleReadyBlock(0x14000501320, 0x140046b28c0, 0xc?)
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:769 +0x104
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).handleWorkersResults(0x14000501320, 0x14004d93f80, 0xb0?, 0x5bb82, 0x1)
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:729 +0x4f0
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).requestChainBlocks(0x14000501320, 0x140013b7e00, 0x3256f0d5a01100e0?, {0x140052f4e40, 0x26})
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:423 +0x528
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).requestAnnouncedBlock(0x14000501320, 0x140005484e0, {{0x140052f4e40?, 0x53d2b8ce6dd81638?}, 0x140013b7e00?})
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:384 +0x150
github.com/ChainSafe/gossamer/dot/sync.(*chainSync).onBlockAnnounce(0x14000501320, {{0x140052f4e40?, 0x3256f0d5a01100e0?}, 0x140013b7e00?})
    github.com/ChainSafe/gossamer/dot/sync/chain_sync.go:346 +0x250
github.com/ChainSafe/gossamer/dot/sync.(*Service).HandleBlockAnnounce(0x140005cd890, {0x140052f4e40, 0x26}, 0x14004f87360)
    github.com/ChainSafe/gossamer/dot/sync/syncer.go:161 +0x514
github.com/ChainSafe/gossamer/dot/network.(*Service).handleBlockAnnounceMessage(0x1040589e5?, {0x140052f4e40?, 0x1400735dc38?}, {0x10472fd80?, 0x14004f87360?})
    github.com/ChainSafe/gossamer/dot/network/block_announce.go:212 +0x48
github.com/ChainSafe/gossamer/dot/network.(*Service).RegisterNotificationsProtocol.(*Service).createNotificationsMessageHandler.func3({0x104746c60, 0x14007076800}, {0x10ccfba10, 0x14004f87360})
    github.com/ChainSafe/gossamer/dot/network/notifications.go:175 +0x39c
github.com/ChainSafe/gossamer/dot/network.(*Service).readStream(0x1400022a100, {0x104746c60, 0x14007076800}, 0x140052da0c0, 0x140005cda70, 0x14005680a60?)
    github.com/ChainSafe/gossamer/dot/network/inbound.go:47 +0x384
github.com/ChainSafe/gossamer/dot/network.(*Service).RegisterNotificationsProtocol.func1({0x104746c60, 0x14007076800})
    github.com/ChainSafe/gossamer/dot/network/service.go:524 +0xb4
github.com/libp2p/go-libp2p/p2p/host/basic.(*BasicHost).SetStreamHandler.func1({0xf0d7f14c75536fa1?, 0x3dd011b88b3639b1?}, {0x10dba01d0?, 0x14007076800})
    github.com/libp2p/go-libp2p@v0.31.0/p2p/host/basic/basic_host.go:598 +0x48
created by github.com/libp2p/go-libp2p/p2p/host/basic.(*BasicHost).newStreamHandler in goroutine 328719
    github.com/libp2p/go-libp2p@v0.31.0/p2p/host/basic/basic_host.go:440 +0x5b0
    pkg=sync
jimjbrettj commented 8 months ago

After investigating this issue I have not been able to reproduce it, so will mark as closed

jimjbrettj commented 7 months ago

I have been able to reproduce this so am reopening