Skip to content

fix(validator): clean up signing context types and track checkpoint number in HA DB#22475

Merged
spalladino merged 1 commit intomerge-train/spartanfrom
palla/a-773-signing-context-checkpoint-number
Apr 13, 2026
Merged

fix(validator): clean up signing context types and track checkpoint number in HA DB#22475
spalladino merged 1 commit intomerge-train/spartanfrom
palla/a-773-signing-context-checkpoint-number

Conversation

@spalladino
Copy link
Copy Markdown
Contributor

@spalladino spalladino commented Apr 10, 2026

Motivation

The SigningContext types conflated blockNumber and checkpointNumber into a single blockNumber: BlockNumber | CheckpointNumber field. Attestation signing hardcoded BlockNumber(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_number column with no checkpoint_number column, making it impossible to track which checkpoint a duty belongs to.

Approach

Replaced the shared BaseSigningContext with distinct context types per duty: BlockProposalSigningContext (blockNumber + checkpointNumber), CheckpointProposalSigningContext (checkpointNumber only), AttestationSigningContext (checkpointNumber, sourced from proposal validation), and VoteSigningContext (slot only). Neither blockNumber nor checkpointNumber are part of the HA DB primary key — they are informational columns for diagnostics and monitoring.

Added a checkpoint_number column 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 evolving schema.ts).

Changes

  • stdlib (ha-signing): Replaced BaseSigningContext/OtherSigningContext with BlockProposalSigningContext, CheckpointProposalSigningContext, AttestationSigningContext. Added getCheckpointNumberFromSigningContext helper. Added checkpointNumber parameter to BlockProposal.createProposalFromSigner and CheckpointProposal.createProposalFromSigner.
  • stdlib (interfaces): Updated Validator interface signatures to accept checkpointNumber.
  • validator-client: Threaded checkpointNumber through ValidationService and Validator methods. ProposalHandler.handleCheckpointProposal now returns checkpointNumber in the success result, which gets passed to attestation signing. When skipCheckpointProposalValidation is set, defaults to CheckpointNumber(0).
  • validator-ha-signer: Added checkpoint_number BIGINT NOT NULL DEFAULT 0 column to DB schema (not in primary key). Bumped SCHEMA_VERSION to 2. Updated DutyRow, StoredDutyRecord, ValidatorDutyRecord, and both postgres/lmdb implementations.
  • validator-ha-signer (migrations): New migration 2_add-checkpoint-number.ts. Froze migration 1 to a static schema snapshot instead of importing from schema.ts (which evolves over time and would cause migration 2 to fail on fresh DBs). Added a migration roundtrip test.
  • sequencer-client: Updated checkpoint_proposal_job.ts to pass checkpointNumber to block/checkpoint proposal creation and attestation signing.
  • tests: Updated all test files across stdlib, validator-client, validator-ha-signer, sequencer-client, and end-to-end.

…umber in HA DB

Fixes A-773

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@spalladino spalladino added the ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure label Apr 10, 2026
@spalladino spalladino requested a review from spypsy April 10, 2026 19:21
Copy link
Copy Markdown
Member

@spypsy spypsy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks clean 👍

@spalladino spalladino merged commit 085889e into merge-train/spartan Apr 13, 2026
30 of 34 checks passed
@spalladino spalladino deleted the palla/a-773-signing-context-checkpoint-number branch April 13, 2026 12:13
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
github-merge-queue bot pushed a commit that referenced this pull request Apr 13, 2026
BEGIN_COMMIT_OVERRIDE
fix(validator): clean up signing context types and track checkpoint
number in HA DB (#22475)
fix: add missing checkpointNumber to test mock in proposal_handler
(#22501)
chore: bump reth to v2.0.0 (#22503)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants