Overview
TheCompactIntentExecutor enables secure cross-chain intent execution through a two-phase process using The Compact protocol for cross-chain verification.
Source: /src/executor/CompactIntent/CompactIntentExecutor.sol:41
Two-Phase Execution Flow
Phase 1 (Origin Chain):executePreClaimOpsWithCompactStub
- User signs an EIP-712 structured intent specifying cross-chain operations
- Arbiter calls this function to execute pre-claim operations (e.g., token approvals)
- Contract validates signature and computes claim hash for cross-chain verification
executeTargetOpsWithCompactStub
- Arbiter provides proof of origin chain execution via claim hash
- Contract validates the claim hash through The Compact protocol’s verification system
- If valid, executes the target operations on behalf of the user
Security Model
The security relies on:- EIP-712 signatures for user authorization
- The Compact protocol’s cross-chain verification system
- Router-only access control for cross-chain operations
- Expiration timestamps to prevent stale execution
Structs
EIP712CompactStub
Core Compact order data that remains consistent across all elements.uint256
Unique nonce for this Compact order to prevent replay attacks
uint256
Timestamp after which the entire Compact order expires
uint256
Chain ID where the order was originally notarized/signed
EIP712ElementStubOrigin
Stub data for EIP-712 element construction on origin chain.bytes32[]
Array of other element hashes in the Compact Merkle tree
uint128
Minimum gas required for executing operations
uint256
Index position where this element should be inserted in the otherElements array
bytes32
Hash of target operations that will be executed on destination chain
bytes32
Hash of input token details for this element
bytes32
Pre-computed hash of target attributes (account, tokenOut, chain, expires)
bytes32
Hash of the qualifier data specific to this element
EIP712ElementStubDestination
Stub data for EIP-712 element construction on destination chain.address
Address that sponsored the original Compact order
bytes32[]
Array of other element hashes in the Compact Merkle tree
uint256
Index position where this element should be inserted in the otherElements array
bytes32
Hash of pre-claim operations that were executed on origin chain
bytes32
Hash of input token details for this element
bytes32
Hash of output token details for this element
uint256
Timestamp after which the fill operation expires
bytes32
Hash of the qualifier data specific to this element
Functions
executePreClaimOpsWithCompactStub
address
required
The smart account address that owns the assets and signed the order
EIP712CompactStub
required
Core Compact order data (nonce, expires, notarized chain)
EIP712ElementStubOrigin
required
Element-specific data needed for origin chain execution
Types.Operation
required
Operations to execute before cross-chain transfer (e.g., token approvals)
bytes
required
EIP-712 signature from the account authorizing these operations
sigOk(bool): True if signature validation passedexecOk(bool): True if pre-claim operations executed successfully
The caller (arbiter) is responsible for facilitating the cross-chain transfer. The arbiter address is included in the element hash computation.
executeTargetOpsWithCompactStub
address
required
The recipient account address for the target operations
address
required
The arbiter address that notarized the cross-chain transfer
EIP712CompactStub
required
Core Compact order data (nonce, expires, notarized chain)
EIP712ElementStubDestination
required
Element-specific data needed for destination chain execution
Types.Operation
required
Operations to execute on the destination chain
bytes
required
EIP-712 signature authorizing the target operations
bytes32 - The computed claim hash used for verification
isCompactIntentNonceConsumed
uint256
required
The nonce value to check
address
required
The account address that owns the nonce
bool - True if the nonce has been consumed, false otherwise
Execution Process
Origin Chain (Phase 1)
- Hash Computation: Reconstruct element hash using caller as arbiter
- Merkle Tree: Build complete Compact Merkle tree with all elements
- Claim Hash: Compute final EIP-712 claim hash
- Signature Validation: Verify user’s signature authorizing the operations
- Nonce Consumption: Mark nonce as used to prevent replay
- Execution: Execute pre-claim operations (typically token approvals)
Destination Chain (Phase 2)
- Hash Reconstruction: Recreate element hash from stub data
- Validation: Check correct chain and expiration
- Merkle Tree: Build complete Compact Merkle tree
- Claim Hash: Compute EIP-712 claim hash (must match origin)
- Signature Validation: Verify signature against claim hash
- Nonce Consumption: Mark nonce as used to prevent replay
- Execution: Execute target operations on destination chain
Example Usage
Error Handling
error
Thrown when signature validation fails
error
Thrown when fill expiration has passed or parameters are invalid
error
Thrown when
executeTargetOpsWithCompactStub is called by non-router addressSecurity Considerations
Related
- IntentExecutor - Main executor contract
- Permit2IntentExecutor - Permit2-based execution
- StandaloneIntentExecutor - Self-contained execution