Skip to content

cluster: verify lock deposit data and registrations - #4819

Open
OisinKyne wants to merge 1 commit into
oisin/strict-lock-verificationfrom
oisin/lock-content-checks
Open

OisinKyne wants to merge 1 commit into
oisin/strict-lock-verificationfrom
oisin/lock-content-checks

Conversation

@OisinKyne

@OisinKyne OisinKyne commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds Lock.VerifyContents. It checks that deposit data matches the DV pubkey, the definition withdrawal credentials and the deposit amounts, and has a valid BLS signature. It checks that builder registrations match the DV pubkey and the definition fee recipient, and that addresses are valid (Definition.VerifyAddresses).

  • Enforced where charon creates a lock from scratch (create cluster, fresh DKG) and on DKG definitions (bypassable with --no-verify).
  • Warn only when loading an existing lock (run, exits, deposit and feerecipient commands), so a running node never fails to restart. Also warn only in the edit protocols and DKG append mode, since their output inherits the old lock's contents.

Make it an error in a later release.

category: feature
ticket: none

@github-actions github-actions Bot added the branch-invalid PR raised against invalid branch. Not a main or release branch. label Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.24528% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.89%. Comparing base (35bce88) to head (09a67de).

Files with missing lines Patch % Lines
cluster/lock.go 80.00% 14 Missing ⚠️
cluster/definition.go 78.94% 4 Missing ⚠️
dkg/disk.go 50.00% 2 Missing ⚠️
cmd/createcluster.go 50.00% 1 Missing ⚠️
dkg/dkg.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##           oisin/strict-lock-verification    #4819      +/-   ##
==================================================================
+ Coverage                           67.81%   67.89%   +0.07%     
==================================================================
  Files                                 255      255              
  Lines                               33808    33914     +106     
==================================================================
+ Hits                                22928    23026      +98     
- Misses                              10879    10887       +8     
  Partials                                1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread cluster/lock.go
Comment on lines +459 to +473
func (l Lock) VerifyContents() error {
if err := l.VerifyAddresses(); err != nil {
return err
}

if err := l.verifyBuilderRegistrationContents(); err != nil {
return errors.Wrap(err, "verify builder registrations")
}

if err := l.verifyDepositData(); err != nil {
return errors.Wrap(err, "verify deposit data")
}

return nil
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some of those are really slow and at worst can slow our startup by a couple of seconds. I'm not convinced we have to check such kinds of stuff on charon run? What do we gain from e.g. verifying deposit data signatures on charon run?

  1. We have not created those signatures on charon run
  2. We are not using the deposit data on charon run
  3. We are not assuring anything with that

I'm fine if we want to verify those on deposit commands, but here it seems irrelevant. When a relevant code path, would that be from Charon or external, needs to use that data it can verify the signature itself, but we shouldn't do all such checks at every single charon run...

This statement kinda holds for the whole PR (and some of the other ones), however, the sig verification of deposit data has the highest hit on performance from what I've reviewed so far, with arguably no benefit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point, agreed. I've cut it back to creation only. Contents are now checked in create cluster and at the end of a fresh DKG, where charon has just made those deposit and registration signatures, so it's the one place a bad lock can be caught before it's distributed. The load path (charon run, exits, other commands), the edit protocols and append-validators no longer check contents at all, so startup cost is unchanged. The definition address check in DKG stays (cheap, no BLS). Happy to add it to the deposit commands later if that's useful.

Adds Lock.VerifyContents: deposit data must match the distributed validator pubkey,
the definition withdrawal credentials and deposit amounts, and carry a valid BLS
signature; builder registrations must match the distributed validator pubkey and the
definition fee recipient; addresses must be valid (Definition.VerifyAddresses).

Only enforced where charon creates a lock from scratch (create cluster and a fresh
DKG), plus address checks on DKG definitions. Loading an existing lock (run, exits,
other commands), the edit protocols and appending validators don't check contents,
so startup isn't slowed by BLS verifying every deposit signature.

category: feature
ticket: none
@OisinKyne
OisinKyne force-pushed the oisin/lock-content-checks branch from 3081c4d to 09a67de Compare November 4, 2026 17:13
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch-invalid PR raised against invalid branch. Not a main or release branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants