Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a separate interface for module guard #758

Merged
merged 35 commits into from May 24, 2024
Merged

Conversation

akshay-ap
Copy link
Member

@akshay-ap akshay-ap commented May 2, 2024

Fixes #755

Summary of changes:

  • The PR creates a separate interface for Module guards instead of having a single Guard interface for both module transactions and Safe transactions.

  • The new Module guard interface i.e, IModuleGuard has two functions:

  1. checkModuleTransaction
  2. checkAfterExecution
  • The updated addresses in migration contracts are taken from logs from the tests.

  • Rename interface Guard to ITransactionGuard.

  • Fix typo: Rename ModuleTransasctionDetails to ModuleTransactionDetails

Codesize:
Main branch:

Safe 21210 bytes (limit is 24576)
SafeL2 22052 bytes (limit is 24576)

This PR (+571 bytes):

Safe 21781 bytes (limit is 24576)
SafeL2 22623 bytes (limit is 24576)

Changes in PR:

  • Documentation
  • Fix test cases
  • Rebase branch
  • Migration contracts

Open for discussion:

  1. Rename Guard to ITransactionGuard? -> Yes
  2. Rename setGuard function to setTransactionGuard? : Impacts Safe interface
  3. Rename ChangedGuard event to ChangedTransactionGuard? Impacts services monitoring this event

@akshay-ap akshay-ap self-assigned this May 2, 2024
@akshay-ap akshay-ap marked this pull request as draft May 2, 2024 09:46
@coveralls
Copy link

coveralls commented May 2, 2024

Pull Request Test Coverage Report for Build 9223136085

Details

  • 13 of 18 (72.22%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.5%) to 92.899%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contracts/base/GuardManager.sol 1 2 50.0%
contracts/examples/guards/DebugTransactionGuard.sol 0 1 0.0%
contracts/examples/guards/ReentrancyTransactionGuard.sol 0 1 0.0%
contracts/base/ModuleManager.sol 9 11 81.82%
Totals Coverage Status
Change from base Build 8900628538: -1.5%
Covered Lines: 388
Relevant Lines: 400

💛 - Coveralls

@akshay-ap akshay-ap marked this pull request as ready for review May 6, 2024 11:28
Copy link
Member

@remedcu remedcu left a comment

Choose a reason for hiding this comment

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

Some nits.

Subjective: I like TxGuard or TransactionGuard better than just Guard.

contracts/interfaces/IModuleManager.sol Show resolved Hide resolved
contracts/interfaces/IModuleManager.sol Outdated Show resolved Hide resolved
contracts/libraries/Safe150Migration.sol Outdated Show resolved Hide resolved
test/core/Safe.GuardManager.spec.ts Outdated Show resolved Hide resolved
test/core/Safe.ModuleManager.spec.ts Outdated Show resolved Hide resolved
test/core/Safe.ModuleManager.spec.ts Outdated Show resolved Hide resolved
test/core/Safe.ModuleManager.spec.ts Outdated Show resolved Hide resolved
akshay-ap and others added 6 commits May 6, 2024 17:21
@akshay-ap akshay-ap requested review from nlordell and mmv08 May 13, 2024 13:22
Copy link
Member

@mmv08 mmv08 left a comment

Choose a reason for hiding this comment

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

LGTM. I'd still wait for Nick's or Shebin's approval since this is a highly complex and impactful addition.

contracts/Safe.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@nlordell nlordell left a comment

Choose a reason for hiding this comment

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

Looks great! One minor nit for comment, and more suggestions for the migration.

akshay-ap and others added 2 commits May 16, 2024 16:20
Co-authored-by: Nicholas Rodrigues Lordello <n@lordello.net>
@akshay-ap
Copy link
Member Author

Thanks for approval! I will merge it this week after a final self-review as this is an important change in the account contract.

@akshay-ap akshay-ap merged commit f830466 into main May 24, 2024
18 of 20 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2024
@akshay-ap akshay-ap deleted the feature/module-tx-guard branch May 24, 2024 13:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split Guard into Module and Transaction Guard
5 participants