Optimize getQuote to skip calldata encoding when wallet is not needed#344
Open
its-applekid wants to merge 3 commits intoethereum-optimism:mainfrom
Open
Optimize getQuote to skip calldata encoding when wallet is not needed#344its-applekid wants to merge 3 commits intoethereum-optimism:mainfrom
its-applekid wants to merge 3 commits intoethereum-optimism:mainfrom
Conversation
- GuardrailWallet contract with allowlists and spending limits - Mock contracts (USDC, Morpho vault, Chainlink oracle) - Comprehensive gas tests measuring overhead - Results: ~96k gas overhead (+104%) with allowlist + spending limits - Confirmed O(1) allowlist lookups (100 contracts = same cost as 2) - Oracle read: 10k gas (mock), expect 40-50k in production
Add includeCalldata parameter to _getQuote() in swap providers. ActionsSwapNamespace now calls getQuoteReadOnly() which skips expensive encodeUniversalRouterSwap/encodePoolSwap operations. WalletSwapNamespace unchanged — still gets full execution data. executeFromQuote validates execution field exists before use. Closes ethereum-optimism#331
👷 Deploy request for actions-ui pending review.Visit the deploys page to approve it
|
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds an
includeCalldataparameter to the swap provider quoting flow. WhenActionsSwapNamespace(read-only, no wallet) requests a quote, expensive calldata encoding is skipped entirely.Changes
SwapQuote.executionis now optional — omitted for read-only quotesSwapProvidergets a new publicgetQuoteReadOnly()method that skips encoding_getQuote()acceptsincludeCalldata?: booleanparameter in both providersUniswapSwapProviderconditionally skipsencodeUniversalRouterSwap()VelodromeSwapProviderconditionally skipsencodePoolSwap()ActionsSwapNamespaceoverridesgetQuote()andgetQuotes()to use read-only pathexecuteFromQuote()validatesexecutionexists before use (clear error message)Performance Impact
encodeFunctionData,encodeAbiParameters,encodePacked)Testing
Closes #331