-
Notifications
You must be signed in to change notification settings - Fork 71
Simplification & Fixes in Orchestrator and Account #258
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
base: main
Are you sure you want to change the base?
Changes from all commits
b78b0c4
dc628ec
6151a44
478cde0
ed98d3a
88eeb7d
b9adc71
2cdc071
5e2a016
0c22774
0a5058b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| pragma solidity ^0.8.23; | ||
|
|
||
| import {IOrchestrator} from "./interfaces/IOrchestrator.sol"; | ||
|
|
||
| /// @title Batcher | ||
| /// @notice Contract for executing multiple intents through the orchestrator in a single transaction | ||
| /// @dev Individual intent failures do not revert the entire batch | ||
| contract Batcher { | ||
| /// @notice Emitted when an intent execution fails | ||
| event IntentFailed(uint256 indexed index, bytes reason); | ||
|
|
||
| error InvalidArrayLength(); | ||
| error ArrayLengthMismatch(); | ||
|
|
||
| /// @notice Execute multiple intents through the orchestrator | ||
| /// @param orchestrator The orchestrator contract address | ||
| /// @param encodedIntents Array of encoded intents | ||
| /// @param intentGas Array of gas amounts for each intent | ||
| function batchExecute( | ||
| address orchestrator, | ||
| bytes[] calldata encodedIntents, | ||
| uint256[] calldata intentGas | ||
| ) external { | ||
| uint256 length = encodedIntents.length; | ||
|
|
||
| if (length == 0) revert InvalidArrayLength(); | ||
| if (length != intentGas.length) revert ArrayLengthMismatch(); | ||
|
|
||
| // Execute each intent | ||
| for (uint256 i = 0; i < length; ++i) { | ||
| // Encode the function call | ||
| bytes memory data = | ||
| abi.encodeWithSelector(IOrchestrator.execute.selector, encodedIntents[i]); | ||
|
|
||
| // Make the call with specified gas | ||
| (bool success, bytes memory returnData) = orchestrator.call{gas: intentGas[i]}(data); | ||
howydev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (!success) { | ||
| emit IntentFailed(i, returnData); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -627,13 +627,6 @@ contract IthacaAccount is IIthacaAccount, EIP712, GuardedExecutor { | |
| // Set the target key hash to the payer's. | ||
| keyHash = k; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simulation Logic Removal - Security Improvement ✅ Excellent removal of simulation-specific logic from production contract! Security benefits:
The removal of the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i like this removal. now the simulation functionality is more isolated. |
||
| // If this is a simulation, signature validation errors are skipped. | ||
| /// @dev to simulate a paymaster, state override the balance of the msg.sender | ||
| /// to type(uint256).max. In this case, the msg.sender is the ORCHESTRATOR. | ||
| if (address(ORCHESTRATOR).balance == type(uint256).max) { | ||
| isValid = true; | ||
| } | ||
|
|
||
| if (!isValid) { | ||
| revert Unauthorized(); | ||
| } | ||
|
|
||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.