Skip to content

fix(multisig)!: reject a zero Secp256k1EcdsaMultisig instance salt - #1255

Open
yash251 wants to merge 1 commit into
OpenZeppelin:mainfrom
yash251:yash/1066-multisig-zero-salt
Open

yash251 wants to merge 1 commit into
OpenZeppelin:mainfrom
yash251:yash/1066-multisig-zero-salt

Conversation

@yash251

@yash251 yash251 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Fixes #1066

Secp256k1EcdsaMultisig.initialize (the module the issue calls EcdsaSignerManager) now asserts that instanceSalt is not zero, failing with Secp256k1EcdsaMultisig: invalid salt. Signer commitments are derived from the public key and the salt, so with a zero salt two deployments that share a signer get the same commitment and the salt no longer separates them. This mirrors the same check added to ZOwnablePK in #1054.

The once-only guard still runs first, so a second initialize keeps failing with signers already registered.

Tests (in Secp256k1EcdsaMultisig.test.ts, constructor group):

  • a zero salt is rejected with Secp256k1EcdsaMultisig: invalid salt;
  • a salt with only the first or only the last byte set is accepted, registers all signers, and verifies a 2-of-3 approval.

PR Checklist

  • I have read the Contributing Guide
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added documentation for new methods or changes to existing method behavior. (initialize Requirements now list "instanceSalt is not zero.")
  • I have added a CHANGELOG entry under ## Unreleased
  • CI Workflows Are Passing

Verified locally

  • yarn compile:multisig with compiler 0.36.0: all 34 multisig contracts compile.
  • vitest run --project unit src/multisig: 19 files, 436 passed (39 skipped), including the new tests.
  • biome check on the changed test file: clean.

Summary by CodeRabbit

  • Breaking Changes
    • Multisig initialization now rejects an all-zero instance salt with an error. Deployments must provide a nonzero salt.
  • Bug Fixes
    • Signer registration and approvals continue to work with valid nonzero salts, including salts with only the first or last byte set.

@yash251
yash251 requested review from a team as code owners November 19, 2026 04:01
@yash251
yash251 force-pushed the yash/1066-multisig-zero-salt branch from 10e9ce2 to d54e6ec Compare November 19, 2026 04:01
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Secp256k1EcdsaMultisig.initialize now rejects an all-zero instanceSalt. Tests cover zero-salt rejection and successful initialization and approvals with salts whose first or last byte is set to 1.

Changes: Instance salt validation

Layer / File(s) Summary
Validate instance salt
contracts/src/multisig/Secp256k1EcdsaMultisig.compact, contracts/src/multisig/test/Secp256k1EcdsaMultisig.test.ts, CHANGELOG.md
The initialization requirements now state that instanceSalt must be nonzero, and initialize rejects a zero salt with Secp256k1EcdsaMultisig: invalid salt. Tests cover rejection and successful initialization and approvals with salts that have only the first or last byte set. The changelog records the change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 0xisk, andrew-fleming

Merge Risk: Minimal · up to d54e6

Initialization now rejects an all-zero instance salt, so signer commitments no longer collide across deployments that share a signer. No merge-blocking risk was identified. The CI run failed only because the compiler could not be downloaded, so a rerun is advisable.

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 states the main change: Secp256k1EcdsaMultisig now rejects a zero instance salt. The raw summary and objectives confirm this change in initialize, its tests, and its documentation. The title…
Linked Issues check Passed Issue #1066 asks that instanceSalt be asserted non-zero in initialize. The issue names EcdsaSignerManager, which does not exist under contracts/src/multisig at the reviewed head. The PR maps t…
Out of Scope Changes check Passed The changes are the initialize assert, its requirements documentation, a CHANGELOG entry under Unreleased, and tests in Secp256k1EcdsaMultisig.test.ts. The assert and documentation implement #1066…
Full details: Title check

Explanation

The title states the main change: Secp256k1EcdsaMultisig now rejects a zero instance salt. The raw summary and objectives confirm this change in initialize, its tests, and its documentation. The title follows the conventional commit form and marks the change as breaking with '!'. It is short, specific, and contains no vague terms.

Full details: Linked Issues check

Explanation

Issue #1066 asks that instanceSalt be asserted non-zero in initialize. The issue names EcdsaSignerManager, which does not exist under contracts/src/multisig at the reviewed head. The PR maps the request to Secp256k1EcdsaMultisig.initialize, which takes instanceSalt. The diff of Secp256k1EcdsaMultisig.compact adds assert(instanceSalt != default<Bytes<32>>, "Secp256k1EcdsaMultisig: invalid salt"); inside initialize. The assert runs after the once-only guard Signer_getSignerCount() == 0, as the PR describes. The requirements comment also lists the non-zero salt rule. The added tests in Secp256k1EcdsaMultisig.test.ts cover zero-salt rejection and acceptance of single-byte salts. The implementation meets the issue requirement under the PR's mapping. The name mismatch is a naming question only; no coding requirement is unmet.

Full details: Out of Scope Changes check

Explanation

The changes are the initialize assert, its requirements documentation, a CHANGELOG entry under Unreleased, and tests in Secp256k1EcdsaMultisig.test.ts. The assert and documentation implement #1066. The tests verify the new assert. The CHANGELOG entry documents the breaking behavior. No unrelated functional change was found in the reviewed diff of the .compact file. The test file and CHANGELOG were taken from the supplied summary and were not diffed in this review.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • 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

Commits

Reviewing files that changed from the base of the PR and between f85f1a2 and d54e6ec.

Files selected for processing: 3

  • CHANGELOG.md
  • contracts/src/multisig/Secp256k1EcdsaMultisig.compact
  • contracts/src/multisig/test/Secp256k1EcdsaMultisig.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 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.

Assert instanceSalt is not zero in EcdsaSignerManager

1 participant