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

Optimize solverOps array in Verification #74

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

BenSparksCode
Copy link
Contributor

@BenSparksCode BenSparksCode commented Dec 11, 2023

When AtlasVerification.validCalls() is called, it returns a filtered solverOps array.

Instead of leaving blank solverOps objects (checked using solverOp.from == address(0)) in their prev spots in the array, we can pack the array with only the valid ones from the start.

This should see a gas improvement in some cases - in the _execute part of a metacall tx, we can simplify the checks while looping, as well as breaking early after checking only the valid solverOps.

One concern is that rearranging the order of the solverOps array could mess with the simulator. In validCalls, if the call is in simulator mode, the original solverOps array is returned before being filtered. These differences in orders could be problematic.

First pass at mitigating these concerns:

  • The isSimulation == true check is now below the solverOps pruning loop, so solverOps returned are in the same pruned form that _execute will receive.
  • In the simulator, simUserOperation simulates the metacall with an empty solverOps array (length 0) instead of one of length 1, where it's a single empty solverOp. This change stops the sim call from reverting when it tries to verify the blank solverOp in that pruning loop.

Copy link
Contributor

@thogard785 thogard785 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@jj1980a jj1980a left a comment

Choose a reason for hiding this comment

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

lgtm!

@thogard785 thogard785 merged commit 63e7619 into verification-features Dec 12, 2023
3 checks passed
@thogard785 thogard785 deleted the verification-optimize branch December 12, 2023 06:53
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.

3 participants