-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Use native signers in EIP-7702 tests #6283
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
base: master
Are you sure you want to change the base?
Conversation
|
WalkthroughThe pull request refactors EIP7702-related tests by introducing a generalized Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
test/account/utils/EIP7702Utils.test.js (1)
5-19: Verify the nonce adjustment logic for self-relayed transactions.The nonce is incremented by 1 when
relayer?.address == account.addressto account for the transaction incrementing the signer's nonce before the EIP-7702 authorization is applied. This logic appears correct for the self-relay case.However, consider using strict equality (
===) and normalizing addresses withethers.getAddress()for safer comparison, as mixed-case addresses could cause unexpected behavior:- nonce: nonce + (relayer?.address == account.address ? 1 : 0), + nonce: nonce + (relayer?.address?.toLowerCase() === account.address.toLowerCase() ? 1 : 0),
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
test/account/utils/EIP7702Utils.test.jstest/helpers/erc4337.js
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: ernestognw
Repo: OpenZeppelin/openzeppelin-contracts PR: 5891
File: test/account/modules/ERC7579Module.behavior.js:56-61
Timestamp: 2025-10-15T02:52:05.027Z
Learning: In ERC7579 validator tests for `isValidSignatureWithSender`, using `this.mock` (not bound to a specific account) is valid when testing signature validation with any arbitrary sender, while `this.mockFromAccount` is used when testing account-specific validation scenarios.
📚 Learning: 2025-09-04T09:13:21.278Z
Learnt from: Amxx
Repo: OpenZeppelin/openzeppelin-contracts PR: 5904
File: contracts/crosschain/ERC7786Recipient.sol:3-3
Timestamp: 2025-09-04T09:13:21.278Z
Learning: In OpenZeppelin contracts, hardhat.config.js uses a sophisticated yargs-based configuration where the Solidity compiler version is set via argv.compiler (line 77) with a default of '0.8.27' defined in the yargs options (line 21), allowing flexible command-line overrides while maintaining a consistent default.
Applied to files:
test/helpers/erc4337.js
📚 Learning: 2025-09-04T09:13:21.278Z
Learnt from: Amxx
Repo: OpenZeppelin/openzeppelin-contracts PR: 5904
File: contracts/crosschain/ERC7786Recipient.sol:3-3
Timestamp: 2025-09-04T09:13:21.278Z
Learning: In OpenZeppelin contracts, hardhat.config.js uses yargs to configure the Solidity compiler version dynamically via command line arguments, with a default of '0.8.27' set on line 21 and the solidity configuration using argv.compile around lines 76-87, rather than hardcoded version strings.
Applied to files:
test/helpers/erc4337.js
📚 Learning: 2025-10-15T02:52:05.027Z
Learnt from: ernestognw
Repo: OpenZeppelin/openzeppelin-contracts PR: 5891
File: test/account/modules/ERC7579Module.behavior.js:56-61
Timestamp: 2025-10-15T02:52:05.027Z
Learning: In ERC7579 validator tests for `isValidSignatureWithSender`, using `this.mock` (not bound to a specific account) is valid when testing signature validation with any arbitrary sender, while `this.mockFromAccount` is used when testing account-specific validation scenarios.
Applied to files:
test/account/utils/EIP7702Utils.test.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: boostsecurity - boostsecurityio/scanner
- GitHub Check: boostsecurity - boostsecurityio/boost-sca
- GitHub Check: tests-foundry
- GitHub Check: tests-upgradeable
- GitHub Check: tests
- GitHub Check: coverage
- GitHub Check: slither
- GitHub Check: halmos
🔇 Additional comments (4)
test/helpers/erc4337.js (2)
1-1: LGTM!The import now includes
predeployfrom hardhat, which is used elsewhere in the file for entrypoint and senderCreator defaults.
199-206: Clean refactor to use relayer-based deployment.The updated signature
deploy(relayer = this.runner)maintains backward compatibility while enabling explicit relayer control. The pattern aligns with theSmartAccount.deploy(account = this.runner)method at line 175, providing a consistent API across both account types.test/account/utils/EIP7702Utils.test.js (2)
21-25: Good refactor to use native signers.Using
getSigners()instead of constructing random wallets simplifies the test setup and aligns with standard Hardhat testing patterns. This eliminates the need for manual wallet funding and key management.
37-51: LGTM!The test cases correctly exercise the
setDelegationhelper for setting, verifying, and revoking EIP-7702 delegations. Usingethers.ZeroAddressas the target for revocation is the correct pattern.
No description provided.