Skip to content

fix(solidity): revalidate DKG results at approval and harden the DKG validator - #4384

Open
piotr-roslaniec wants to merge 1 commit into
mainfrom
fix/revalidate-dkg-result-at-approval
Open

piotr-roslaniec wants to merge 1 commit into
mainfrom
fix/revalidate-dkg-result-at-approval

Conversation

@piotr-roslaniec

@piotr-roslaniec piotr-roslaniec commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

WalletRegistry approval now revalidates the DKG result, and EcdsaDkgValidator input checks are tightened. The commit message lists the changes.

This code is already live on Ethereum mainnet. The WalletRegistry upgrade executed on 12 November 2026, and the validator switch on 13 November:

Contract Address
WalletRegistry implementation 0x14fad0c11c83ac736e5929d5661bba7e6bb9c0d6
EcdsaDkgValidator 0x1a5f4f753bd071c907714aefb6e0bcee32401406

A build of this branch's commit reproduces the deployed runtime bytecode of both contracts (see below).

Please merge with a merge commit (the repository does not allow squash) so this commit stays in main history as the source of the deployed code.

Bytecode check (16 November 2026). Built commit 8f4f8262edf02eec1e4fd9ddad55d72b10a3fff4 with the solidity/ecdsa CI steps (yarn install --immutable, yarn build; solc 0.8.17, optimizer 200 runs) and compared with eth_getCode on mainnet, immutables masked:

Contract Bytes Match
WalletRegistry implementation 24,548 exact, including the metadata hash; links EcdsaInactivity 0x8263efcb8f28246697585c89fed0501cd946f764
EcdsaDkgValidator 6,204 exact, including the metadata hash

The four modified test files pass locally (290 passing, 21 pending).

Summary by CodeRabbit

  • Bug Fixes

    • Invalid DKG results are rejected during approval, preventing wallet creation and applying the existing submitter penalty.
    • Malformed signatures and invalid signing indices are handled as validation failures rather than causing unexpected reverts.
    • Invalid group public keys and out-of-range member indices are rejected more consistently.
  • New Features

    • Proxy administrators can update the DKG validator through a versioned registry upgrade, provided DKG is idle and the new validator address is nonzero.

…validator

WalletRegistry approval now re-runs the DKG validator on the committed
result and rejects a result that fails validation instead of registering
a wallet. The read-only isDkgResultValid view answers (false,
"validation reverted") instead of reverting.

EcdsaDkgValidator tightens its input checks: bounds on the misbehaved and
signing member indices and the members count, an on-curve check for the
group public key, and signature recovery that returns false on malformed
signatures.

initializeV2_1 binds the validator for proxies upgraded from an earlier
implementation. It is restricted to the proxy admin and requires an idle
DKG. Storage layout is unchanged. Existing tests are updated for the
revalidation gas cost and the new error messages.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The DKG validator now checks group public keys, member indices, and signature recovery results. Approval revalidates submitted results and rejects invalid results before wallet creation. WalletRegistry adds a guarded validator reinitializer. Tests add validation coverage and deterministic wallet setup.

Changes: ECDSA DKG validation and wallet registration

Layer / File(s) Summary
Validate DKG fields and signatures
solidity/ecdsa/contracts/EcdsaDkgValidator.sol, solidity/ecdsa/test/DKGValidator.test.ts
validateFields checks public-key coordinates and misbehaved-member indices. validateSignatures bounds signing indices and returns false for signature recovery errors or signer mismatches. Tests cover malformed keys, index bounds, and recovery outcomes.
Revalidate and reject results during approval
solidity/ecdsa/contracts/libraries/EcdsaDkg.sol, solidity/ecdsa/contracts/WalletRegistry.sol, solidity/ecdsa/test/WalletRegistry.WalletCreation.test.ts
Approval revalidates submitted results and clears submission state when validation fails or reverts. WalletRegistry punishes the submitter and exits before wallet creation. Challenge and approval paths use a shared punishment helper.
Add proxy-admin validator reinitializer
solidity/ecdsa/contracts/WalletRegistry.sol
The version-3 reinitializer checks the proxy admin, a nonzero validator address, and idle DKG state before updating the validator.
Make wallet test setup deterministic
solidity/ecdsa/test/utils/wallets.ts, solidity/ecdsa/test/WalletRegistry.Inactivity.test.ts, solidity/ecdsa/test/WalletRegistry.WalletCreation.test.ts, solidity/ecdsa/test/WalletRegistry.Wallets.test.ts
The wallet test helper accepts a fixed relay entry or submits one through the beacon. Wallet tests use fixed entries and select DKG or direct registration for setup.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant WalletRegistry
  participant EcdsaDkg
  participant EcdsaDkgValidator
  WalletRegistry->>EcdsaDkg: approveResult
  EcdsaDkg->>EcdsaDkgValidator: validate submitted result
  EcdsaDkgValidator-->>EcdsaDkg: invalid result or revert
  EcdsaDkg->>EcdsaDkg: emit challenge event and clear submitted result
  EcdsaDkg-->>WalletRegistry: return with DKG awaiting result
  WalletRegistry->>WalletRegistry: punish submitter and skip wallet creation
Loading

Suggested reviewers: nkuba, pdyraga

Merge Risk: Minimal · up to 8f4f8

The change makes DKG approval revalidate results and adds stricter validator checks. No concrete defect was found in the reviewed code, and the main gas-related concern was ruled out. The change appears ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main parts of the change: revalidating DKG results at approval in WalletRegistry and EcdsaDkg, and hardening EcdsaDkgValidator. The changeset matches both parts (approveResult …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main parts of the change: revalidating DKG results at approval in WalletRegistry and EcdsaDkg, and hardening EcdsaDkgValidator. The changeset matches both parts (approveResult revalidation, isResultValid catching reverts, validator bounds checks and curve checks, initializeV2_1). The title is specific and follows the conventional-commit style. It omits the initializeV2_1 upgrade hook, which is a secondary detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3cd9d987-8692-4321-8500-2d415687ddfb
Commits

Reviewing files that changed from the base of the PR and between b6964c8 and 8f4f826.

Files selected for processing: 8

  • solidity/ecdsa/contracts/EcdsaDkgValidator.sol
  • solidity/ecdsa/contracts/WalletRegistry.sol
  • solidity/ecdsa/contracts/libraries/EcdsaDkg.sol
  • solidity/ecdsa/test/DKGValidator.test.ts
  • solidity/ecdsa/test/WalletRegistry.Inactivity.test.ts
  • solidity/ecdsa/test/WalletRegistry.WalletCreation.test.ts
  • solidity/ecdsa/test/WalletRegistry.Wallets.test.ts
  • solidity/ecdsa/test/utils/wallets.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant