forked from ithacaxyz/account
-
Notifications
You must be signed in to change notification settings - Fork 1
# Sequence diagram for simulateMulticall3CombinedGas flow #25
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentationduplicateThis issue or pull request already existsThis issue or pull request already existsenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededinvalidThis doesn't seem rightThis doesn't seem rightquestionFurther information is requestedFurther information is requestedwontfixThis will not be worked onThis will not be worked on
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentationduplicateThis issue or pull request already existsThis issue or pull request already existsenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededinvalidThis doesn't seem rightThis doesn't seem rightquestionFurther information is requestedFurther information is requestedwontfixThis will not be worked onThis will not be worked on
Projects
StatusShow more project fields
In Review
StatusShow more project fields
Todo
Reviewer's Guide
Adds multicall3-based simulation support to the Simulator, introduces an IMulticall3 interface and mock implementation, and extends tests to cover multicall-based gas estimation, payment handling, and key-hash context propagation, along with some minor formatting / style tweaks.
Sequence diagram for simulateMulticall3CombinedGas flow
sequenceDiagram actor ExternalCaller participant Simulator participant Multicall3 participant Orchestrator ExternalCaller->>Simulator: simulateMulticall3CombinedGas(multicall3, calls, oc, paymentPerGasPrecision, paymentPerGas, combinedGasIncrement, encodedIntent) Simulator->>Simulator: decode encodedIntent into Intent u loop Primary simulation run Simulator->>Simulator: _callMulticall3(multicall3, calls, oc, isStateOverride=false, combinedGasOverride=type(uint256).max, u) Simulator->>Multicall3: aggregate3(allCalls) Multicall3->>Orchestrator: simulateExecute(isStateOverride, combinedGasOverride, abi.encode(u)) Orchestrator-->>Multicall3: revert SimulationPassed or return state override data Multicall3-->>Simulator: Result[] results Simulator->>Simulator: parse last Result, extract gasUsed or errorData end alt primary run failed (gasUsed == 0) Simulator->>Simulator: _bubbleUpMulticall3Error(errorData) Simulator-->>ExternalCaller: revert with orchestrator error else primary run succeeded Simulator->>Simulator: u.combinedGas += gasUsed Simulator->>Simulator: _updatePaymentAmounts(u, u.combinedGas, paymentPerGasPrecision, paymentPerGas) end loop Search for passing combinedGas Simulator->>Simulator: _callMulticall3(multicall3, calls, oc, isStateOverride=false, combinedGasOverride=0, u) Simulator->>Multicall3: aggregate3(allCalls) Multicall3->>Orchestrator: simulateExecute(false, 0, abi.encode(u)) Orchestrator-->>Multicall3: revert SimulationPassed or error Multicall3-->>Simulator: Result[] results Simulator->>Simulator: parse gasUsed or errorData alt gasUsed == 0 and errorSelector == PaymentError Simulator-->>ExternalCaller: revert PaymentError else gasUsed == 0 (other error) Simulator->>Simulator: gasIncrement = mulDiv(u.combinedGas, combinedGasIncrement, 10000) Simulator->>Simulator: _updatePaymentAmounts(u, gasIncrement, paymentPerGasPrecision, paymentPerGas) Simulator->>Simulator: u.combinedGas += gasIncrement else gasUsed != 0 Simulator-->>ExternalCaller: return gasUsed, multicall3Gas, u.combinedGas end endFile-Level Changes
src/Simulator.solsrc/interfaces/IMulticall3.soltest/SimulateExecute.t.soltest/SimulateExecute.t.soltest/Base.t.soltest/Account.t.soltest/Benchmark.t.soltest/GuardedExecutor.t.solsrc/LayerZeroSettler.solTips and commands
Interacting with Sourcery
@sourcery-ai reviewon the pull request.issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it.@sourcery-aianywhere in the pullrequest title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time.@sourcery-ai summaryanywhere inthe pull request body to generate a PR summary at any time exactly where you
want it. You can also comment
@sourcery-ai summaryon the pull request to(re-)generate the summary at any time.
@sourcery-ai guideon the pullrequest to (re-)generate the reviewer's guide at any time.
@sourcery-ai resolveon thepull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
@sourcery-ai dismisson the pullrequest to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!Customizing Your Experience
Access your dashboard to:
summary, the reviewer's guide, and others.
Getting Help
Originally posted by @sourcery-ai[bot] in #24 (comment)