Improve Proxy Behaviour With the IR Optimizer #451
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR marks regions of assembly that previously weren't as memory safe - this allows the IR optimizer to do a few extra optimizations and improve overall gas consumption for the contracts.
Before
After
Note that writing to
ptr
instead of0
and changing the position of therevert
andreturn
actually helps the compiler produce more optimal code 🤷. Solidity optimizer is really a black box to me sometimes 😅.Additionally, marking the proxy implementation as "memory safe" has a net negative effect on the optimizer, so we intentionally don't mark it as such (even if the changes make it memory safe)
This PR is a DRAFT - as it would change the code in a meaningful way that would require us to re-audit it. If we decide that the audit competition is not enough for theSince we are re-auditing theSafeWebAuthnSharedSigner
and we want an additional audit for that contract (likely), then we should merge this. Otherwise, the changes are not meaningful and can wait until a future version.SafeWebAuthnSharedSigner
, we can include this small change as part of an incremental audit.