Overview
The Executor contract provides secure batch execution of intent calls with comprehensive safety checks and authorization controls. It is deployed by the Inbox contract and executes the calldata specified in fulfilled intents. Contract Location:contracts/Executor.sol
Implements: IExecutor
Security Features
- Authorization: Only the portal contract can execute calls (onlyPortal modifier)
- EOA Protection: Prevents malicious calls through EOA validation
- Batch Execution: Supports multiple calls in a single transaction
- Phishing Protection: Blocks calls to EOAs with calldata to prevent signature phishing
State Variables
portal
Constructor
Executor()
State-Changing Functions
execute
Array of call data containing target addresses, values, and calldata
Array of return data from the successfully executed calls
This function performs validation and execution for each call in the batch:
- Prevents calls to EOAs that include calldata (potential phishing protection)
- Executes each call and returns results or reverts on any failure
Call Structure
Each call in the array must follow this structure:Receive Function
receive()
Errors
NonPortalCaller
The address that attempted to call the function
CallToEOA
The EOA address that was targeted
This error prevents potential phishing attacks where calldata might be misinterpreted. Calls to EOAs are only allowed if the calldata is empty.
CallFailed
The call that failed
The error data returned from the failed call
Access Control
TheonlyPortal modifier restricts all execute functions to only be callable by the portal contract. This ensures:
- Only validated and fulfilled intents can trigger executions
- The executor cannot be used by arbitrary callers
- All executions are properly authorized through the intent fulfillment process
Safety Validations
EOA Check
The executor validates each call to ensure it’s not targeting an EOA with calldata:- Users might accidentally sign transactions that execute unintended calls
- Calldata could be misinterpreted by wallets or interfaces
- Phishing attacks that rely on EOA address confusion
Usage Example
Integration with Inbox
The Executor is tightly integrated with the Inbox contract:- Deployment: Created during Inbox constructor
- Token Transfers: ERC20 tokens are transferred to the executor before call execution
- Execution: Inbox calls executor with native tokens and validated calls
- Results: Execution results are returned to the fulfiller
- Clean separation between validation (Inbox) and execution (Executor)
- Isolated execution environment for intent calls
- Clear audit trail for executed operations