fix(core): guard against empty ProverAddresses in PoS submission and validation#315
Merged
Merged
Conversation
…validation Prevent future chain halts from empty ProverAddresses by adding guards at two layers: 1. sendPoSChallengeToStorage: early-return if GetNodesByEndpoints errors or resolves zero prover addresses, instead of submitting a StorageProof tx with an empty (wire-roundtrips to nil) field. 2. isValidStorageProofTx (CheckTx/ProcessProposal): reject StorageProof txs with empty ProverAddresses so they never enter the mempool or a proposed block. Follow-up to #313 which fixed the FinalizeBlock crash (layer 3). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #313 — hardens the PoS subsystem so a StorageProof with empty
ProverAddressescan never reachFinalizeBlockagain, regardless of why the field was empty.Layer 1 — submission guard (
sendPoSChallengeToStorage):GetNodesByEndpointserrors, instead of silently continuing withnodes == nilproverAddressesresolves to zero entries, with a log line capturing the replicas for debuggingLayer 2 — validation guard (
isValidStorageProofTx, used byCheckTx/ProcessProposal):StorageProoftx whereProverAddressesis empty — prevents it from entering the mempool or being included in a proposed blockImportant: This PR should only be deployed AFTER the chain has advanced past block 25229900 (the halt block). The
isValidStorageProofTxcheck would reject the poison tx duringProcessProposal, which is the correct long-term behavior but would interfere with the halt-recovery if validators haven't yet committed that block.Root cause analysis
The exact trigger for the original empty
ProverAddressesremains uncertain. What we know:Replicaslist (top-4 rendezvous-ranked hosts from 70+ entries)core_validators.endpointvalues are lowercase, no trailing slash — matching the normalization inpos.go:60StorageProofproto message has only one construction site (pos.go:111)The most plausible trigger:
GetNodesByEndpointserrored (e.g. pgxpool contention — the goroutine shares the pool withFinalizeBlock's transaction), and the code swallowed the error without early-returning (line 78). The empty[]string{}then survived throughsubmitStorageProofTx, whereproto.Marshalomits the field on the wire (proto3 empty repeated), and receivers unmarshal it asnil.Regardless of the exact trigger, these guards make the failure impossible at two independent layers upstream of
FinalizeBlock.Test plan
replicasfield needed to pinpoint the root cause🤖 Generated with Claude Code