Skip to content

Inline withHook in AccountERC7579Hooked's uninstallModule to avoid reverting#6390

Merged
Amxx merged 11 commits intoOpenZeppelin:masterfrom
Amxx:fix/AccountERC7579Hooked/withHookNoRevert
Mar 6, 2026
Merged

Inline withHook in AccountERC7579Hooked's uninstallModule to avoid reverting#6390
Amxx merged 11 commits intoOpenZeppelin:masterfrom
Amxx:fix/AccountERC7579Hooked/withHookNoRevert

Conversation

@Amxx
Copy link
Collaborator

@Amxx Amxx commented Mar 4, 2026

Fixes H-02

PR Checklist

  • Tests
  • Documentation
  • Changeset entry (run npx changeset add)

@Amxx Amxx requested a review from a team as a code owner March 4, 2026 09:09
@changeset-bot
Copy link

changeset-bot bot commented Mar 4, 2026

🦋 Changeset detected

Latest commit: 4998f55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openzeppelin-solidity Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

Walkthrough

This change enhances hook module uninstallation in ERC7579 by introducing resilience against hook failures. A new withHookNoRevert modifier executes preCheck via the hook while catching failures, and only calls postCheck if preCheck succeeds. The uninstall logic is refactored to route hook uninstalling through private helpers instead of direct state mutation, allowing modules to be uninstalled even if hooks revert. Supporting changes add controllable revert behavior to the mock hook for testing, and extend test coverage to verify uninstallation succeeds when hooks fail during pre-check or post-check phases.

Suggested labels

bug, ignore-changeset, Account Abstraction, security

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a withHookNoRevert modifier to prevent reverts during hook module uninstallation.
Description check ✅ Passed The pull request description clearly references a specific security issue (H-02) that the PR fixes and indicates which items were completed (tests and code changes).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@Amxx Amxx added the security Pull requests that address a security vulnerability label Mar 4, 2026
@Amxx Amxx requested a review from ernestognw March 4, 2026 09:46
@Amxx Amxx requested a review from ernestognw March 5, 2026 19:35
@ernestognw ernestognw changed the title AccountERC7579Hooked: add a withHookNoRevert modifier and use it when uninstalling the hook module Inline withHook in AccountERC7579Hooked's uninstallModule to avoid reverting Mar 5, 2026
@Amxx Amxx merged commit 45f032d into OpenZeppelin:master Mar 6, 2026
21 checks passed
@Amxx Amxx deleted the fix/AccountERC7579Hooked/withHookNoRevert branch March 6, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Pull requests that address a security vulnerability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants