fix(validator): clean up signing context types and track checkpoint number in HA DB#22475
Merged
spalladino merged 1 commit intomerge-train/spartanfrom Apr 13, 2026
Conversation
…umber in HA DB Fixes A-773 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
spalladino
pushed a commit
that referenced
this pull request
Apr 13, 2026
…22501) ## Summary - PR #22475 added `checkpointNumber` as a required field on `CheckpointProposalValidationResult` when `isValid: true`, but missed updating one test mock in `proposal_handler.test.ts`. - This caused a `tsgo` type-check failure in CI on `merge-train/spartan`. ## Fix Added the missing `checkpointNumber: CheckpointNumber(3)` to the mock return value, matching the `blockData.checkpointNumber` used in the same test. ## Verification - `yarn tsgo -b --emitDeclarationOnly` passes - Full `./bootstrap.sh` passes ClaudeBox log: https://claudebox.work/s/8af0ae005551a7b7?run=2
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.
Motivation
The
SigningContexttypes conflatedblockNumberandcheckpointNumberinto a singleblockNumber: BlockNumber | CheckpointNumberfield. Attestation signing hardcodedBlockNumber(0)because the data wasn't available. Furthemore, checkpoint proposals were stored with the last block number as opposed to the proper checkpoint number.The HA DB stored this value in a
block_numbercolumn with nocheckpoint_numbercolumn, making it impossible to track which checkpoint a duty belongs to.Approach
Replaced the shared
BaseSigningContextwith distinct context types per duty:BlockProposalSigningContext(blockNumber + checkpointNumber),CheckpointProposalSigningContext(checkpointNumber only),AttestationSigningContext(checkpointNumber, sourced from proposal validation), andVoteSigningContext(slot only). NeitherblockNumbernorcheckpointNumberare part of the HA DB primary key — they are informational columns for diagnostics and monitoring.Added a
checkpoint_numbercolumn to the HA DB via a new migration, and froze the initial migration to a static schema snapshot since migrations must be immutable (the original was importing from an evolvingschema.ts).Changes
BaseSigningContext/OtherSigningContextwithBlockProposalSigningContext,CheckpointProposalSigningContext,AttestationSigningContext. AddedgetCheckpointNumberFromSigningContexthelper. AddedcheckpointNumberparameter toBlockProposal.createProposalFromSignerandCheckpointProposal.createProposalFromSigner.Validatorinterface signatures to acceptcheckpointNumber.checkpointNumberthroughValidationServiceandValidatormethods.ProposalHandler.handleCheckpointProposalnow returnscheckpointNumberin the success result, which gets passed to attestation signing. WhenskipCheckpointProposalValidationis set, defaults toCheckpointNumber(0).checkpoint_number BIGINT NOT NULL DEFAULT 0column to DB schema (not in primary key). BumpedSCHEMA_VERSIONto 2. UpdatedDutyRow,StoredDutyRecord,ValidatorDutyRecord, and both postgres/lmdb implementations.2_add-checkpoint-number.ts. Froze migration 1 to a static schema snapshot instead of importing fromschema.ts(which evolves over time and would cause migration 2 to fail on fresh DBs). Added a migration roundtrip test.checkpoint_proposal_job.tsto passcheckpointNumberto block/checkpoint proposal creation and attestation signing.