Skip to content

Remove isInit guards in Signer - #761

Merged
andrew-fleming merged 9 commits into
OpenZeppelin:mainfrom
andrew-fleming:remove-init-from-signer
Aug 1, 2026
Merged

Remove isInit guards in Signer#761
andrew-fleming merged 9 commits into
OpenZeppelin:mainfrom
andrew-fleming:remove-init-from-signer

Conversation

@andrew-fleming

@andrew-fleming andrew-fleming commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Relaxes the in-circuit isInitialized assertions to prevent lockouts with post-deployment setups

This PR also proposes to clarify _setThreshold's behavior

Summary by CodeRabbit

  • New Features

    • Multisignature signer checks and status views now work based on the current signer registry and threshold, even before standard initialization.
    • Custom setup flows can add signers and configure thresholds directly before using authorization checks.
  • Bug Fixes

    • Threshold validation now rejects zero thresholds consistently.
    • Signer authorization and lookup behavior is enforced correctly in manually configured states.
  • Documentation

    • Updated guidance explains behavior before initialization and supported custom setup flows.

@andrew-fleming
andrew-fleming requested review from a team as code owners July 31, 2026 03:18
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 732b5284-ee68-4b3b-9105-c3c123ad629a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Signer guards and views no longer require initialization. Unconfigured state uses an empty registry and zero threshold. Tests cover rejected authorization, zero-threshold behavior, zero-valued views, and manual setup.

Changes

Signer guard behavior

Layer / File(s) Summary
Guard and view behavior
contracts/src/multisig/Signer.compact, CHANGELOG.md
assertSigner, assertThresholdMet, getSignerCount, and getThreshold no longer require initialization. Zero thresholds remain invalid for approval checks, and unconfigured views return zero state. Documentation and the changelog describe the updated behavior.
Unconfigured and custom setup validation
contracts/src/multisig/test/Signer.test.ts
Tests verify rejected authorization, zero-threshold checks, false signer lookup, zero-valued views, and successful guard and view behavior after manual setup without initialize.

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

Possibly related PRs

Suggested reviewers: 0xisk

Poem

A rabbit checks the signer gate,
Finds empty paws and zero weight.
No init bell must ring today,
Manual signers clear the way.
Threshold tests keep wrong hops out.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: removing initialization guards from Signer.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CHANGELOG.md`:
- Line 17: Update the changelog entry for Signer’s initialization guard removal
to replace the empty `(#)` reference with `(`#761`)`, preserving the rest of the
entry unchanged.

In `@contracts/src/multisig/Signer.compact`:
- Around line 274-280: Update contracts/src/multisig/Signer.compact lines
274-280 in assertThresholdMet to reject approvalCount values greater than
_signerCount, preserving successful authorization only when the approval count
is within the registered signer count. Add a regression test in
contracts/src/multisig/test/Signer.test.ts lines 426-442 that sets a threshold
above the current signer count, verifies assertThresholdMet rejects, and
confirms it succeeds after enough signers are registered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 802bd286-6acf-4b74-84b7-ab8236796f4c

📥 Commits

Reviewing files that changed from the base of the PR and between 6e4f497 and b6dc319.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • contracts/src/multisig/Signer.compact
  • contracts/src/multisig/test/Signer.test.ts

Comment thread CHANGELOG.md Outdated
Comment thread contracts/src/multisig/Signer.compact

@pepebndc pepebndc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. The module-doc rationale for diverging from the library-wide init-guard pattern is exactly what I want to see when we knowingly break convention. Following up on a couple of small things over Slack.

@andrew-fleming
andrew-fleming requested a review from pepebndc August 1, 2026 03:13
@andrew-fleming
andrew-fleming merged commit 0801a84 into OpenZeppelin:main Aug 1, 2026
7 checks passed
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.

2 participants