From a0c179e6535424f46caf56b0cec9a41e82d9f942 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Tue, 26 May 2026 07:49:51 -0700 Subject: [PATCH] fix(core): coerce nil ProverAddresses to empty slice in finalizeStorageProof MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A StorageProof tx with empty/nil ProverAddresses caused pgx to serialize the value as SQL NULL, violating the NOT NULL constraint on storage_proofs.prover_addresses. That aborted the FinalizeBlock transaction (SQLSTATE 25P02), Commit resolved to ROLLBACK, and CometBFT panicked with CONSENSUS FAILURE — halting the chain deterministically on every validator at block 25229900. Coerce nil to []string{} before insert so the column receives '{}' instead of NULL, allowing the block to commit on the next restart. Co-Authored-By: Claude Opus 4.7 --- pkg/core/server/pos.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/core/server/pos.go b/pkg/core/server/pos.go index 4d9ab8c9..0a52cb0c 100644 --- a/pkg/core/server/pos.go +++ b/pkg/core/server/pos.go @@ -298,6 +298,14 @@ func (s *Server) finalizeStorageProof(ctx context.Context, tx *v1.SignedTransact proofSigStr := base64.StdEncoding.EncodeToString(sp.ProofSignature) + // pgx serializes a nil slice as SQL NULL, which violates the NOT NULL + // constraint on storage_proofs.prover_addresses and aborts the + // FinalizeBlock transaction — halting the chain. + proverAddresses := sp.ProverAddresses + if proverAddresses == nil { + proverAddresses = []string{} + } + if err := qtx.InsertStorageProof( ctx, db.InsertStorageProofParams{ @@ -305,7 +313,7 @@ func (s *Server) finalizeStorageProof(ctx context.Context, tx *v1.SignedTransact Address: sp.Address, Cid: pgtype.Text{String: sp.Cid, Valid: true}, ProofSignature: pgtype.Text{String: proofSigStr, Valid: true}, - ProverAddresses: sp.ProverAddresses, + ProverAddresses: proverAddresses, }, ); err != nil { return nil, fmt.Errorf("could not persist storage proof in db: %v", err)