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

Feat/2d nonce helpers #173

Merged
merged 5 commits into from
Sep 26, 2024
Merged

Feat/2d nonce helpers #173

merged 5 commits into from
Sep 26, 2024

Conversation

livingrockrises
Copy link
Contributor

adds 2D nonce support by packing 3 bytes batchId into most significant 3 bytes of 24 byte (uint192) nonceKey.
no changes required in NonceLib.sol

Copy link

openzeppelin-code bot commented Sep 19, 2024

Feat/2d nonce helpers

Generated at commit: ce3b995581c868a3a0905866023ee005512d23fd

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
1
0
7
25
33

For more details view the full report in OpenZeppelin Code Inspector

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.40%. Comparing base (a98c93f) to head (d8f5420).
Report is 6 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #173   +/-   ##
=======================================
  Coverage   86.40%   86.40%           
=======================================
  Files          14       14           
  Lines         905      905           
  Branches      266      244   -22     
=======================================
  Hits          782      782           
  Misses        109      109           
  Partials       14       14           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a98c93f...d8f5420. Read the comment docs.

Comment on lines 94 to 102
// Todo: fix this test. instead of pranking we should send actual userOp.

// bytes memory expectedRevertReason = abi.encodeWithSelector(
// FailedOp.selector,
// 0,
// "AA25 invalid account nonce"
// );

// vm.expectRevert(expectedRevertReason);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be done before merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed foundry test case.

.connect(impersonatedEntryPoint)
.validateUserOp(userOp, userOpHash, ethers.parseEther("0.1"));
});
// Todo: fix below test
Copy link
Collaborator

Choose a reason for hiding this comment

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

And this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hardhat one seems unrelated to testing anything nonce related but has abruptly started failing. need to check more

@@ -46,13 +46,13 @@ contract TestFuzz_ERC4337Account is NexusTest_Base {
vm.assume(numOps < 20); // Keep the number of operations manageable

for (uint256 i = 0; i < numOps; i++) {
uint256 nonceBefore = getNonce(address(BOB_ACCOUNT), MODE_VALIDATION, address(VALIDATOR_MODULE));
uint256 nonceBefore = getNonce(address(BOB_ACCOUNT), MODE_VALIDATION, address(VALIDATOR_MODULE), bytes3(0));
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe use some random batchId since it's fuzz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link

🤖 Slither Analysis Report 🔎

Slither report

# Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary
🟡 - locked-ether (1 results) (Medium)
🟡 - unused-return (1 results) (Medium)

locked-ether

🟡 Impact: Medium
🔴 Confidence: High

utils/RegistryBootstrap.sol#L33-L165

unused-return

🟡 Impact: Medium
🟡 Confidence: Medium

base/ERC7739Validator.sol#L279-L309

constable-states

Impact: Optimization
🔴 Confidence: High

base/RegistryAdapter.sol#L10

factory/RegistryFactory.sol#L39

_This comment was automatically generated by the GitHub Actions workflow._

@livingrockrises livingrockrises merged commit be4ae46 into dev Sep 26, 2024
8 checks passed
@livingrockrises livingrockrises deleted the feat/2d-nonce-helpers branch September 26, 2024 15:06
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