Overview
LocalProver handles proving of intents that are fulfilled on the same chain where they were created. It provides a unique flash-fulfill capability that atomically withdraws rewards, executes fulfillment, and pays the solver.
Contract: contracts/prover/LocalProver.sol
Inheritance: ILocalProver, Semver, ReentrancyGuard
Proof Type: "Same chain"
LocalProver is designed for same-chain intents and does not require cross-chain messaging. Proofs are created immediately upon fulfillment.
Constructor
Address of the Portal contract (provides IntentSource + Inbox functionality)
ChainIdTooLarge(uint256): Current chain ID exceeds uint64.max
contracts/prover/LocalProver.sol:43
State Variables
_PORTAL
_CHAIN_ID
_flashFulfillInProgress
Core Functions
prove
- Intentionally empty (no-op)
- Does not revert to allow usage with fulfillAndProve
contracts/prover/LocalProver.sol:115
provenIntents
Hash of the intent to query
ProofData struct with:
claimant(address): Address eligible for rewardsdestination(uint64): Chain ID (_CHAIN_ID)
-
Griefing Protection: If Portal.claimants contains LocalProver address (without using flashFulfill)
- Returns
ProofData(address(0), 0)to treat intent as unfulfilled - Allows refunds after deadline
- Returns
-
Intent Fulfilled: If Portal.claimants contains valid solver address
- Validates address is valid EVM address
- Returns
ProofData(solver, _CHAIN_ID) - If invalid EVM address, returns
ProofData(address(0), 0)for griefing protection
-
Flash Fulfill In Progress: If
_flashFulfillInProgress == intentHash- Returns
ProofData(address(this), _CHAIN_ID) - Enables withdrawal to LocalProver during atomic execution
- Returns
-
Intent Not Fulfilled:
- Returns
ProofData(address(0), 0)
- Returns
contracts/prover/LocalProver.sol:65
flashFulfill
Route information for the intent execution
Reward details for the intent
Address of the claimant eligible for rewards (receives immediate payout)
bytes[] - Results from the fulfill execution
Execution Flow:
-
CHECKS:
- Validates claimant is not zero
- Validates claimant is not LocalProver address
- Computes intentHash from route and reward
-
EFFECTS:
- Sets
_flashFulfillInProgress = intentHash
- Sets
-
INTERACTIONS:
- Withdraws reward from vault to LocalProver
- Approves Portal to spend route tokens
- Calls
Portal.fulfillwith entire contract balance - Portal records actual claimant (not LocalProver)
-
EFFECTS (Cleanup):
- Transfers all remaining reward tokens to claimant
- Transfers all remaining native ETH to claimant
- Emits
FlashFulfilledevent
- All ERC20 tokens in reward.tokens (minus any consumed by route.tokens)
- All native ETH from reward.nativeAmount (minus consumed by route.nativeAmount)
- Plus any msg.value sent by caller
InvalidClaimant(): Claimant is zero or LocalProver addressNativeTransferFailed(): Native token transfer to claimant failed
- Uses
nonReentrantmodifier to prevent reentrancy attacks - Follows checks-effects-interactions pattern
contracts/prover/LocalProver.sol:170
challengeIntentProof
- Intentionally empty (no-op)
contracts/prover/LocalProver.sol:131
getProofType
"Same chain"
Location: contracts/prover/LocalProver.sol:104
receive
contracts/prover/LocalProver.sol:242
Events
FlashFulfilled
Hash of the fulfilled intent
Address that received the rewards
Amount of native tokens transferred to claimant
Errors
InvalidClaimant
NativeTransferFailed
ChainIdTooLarge
Usage Example
Flash Fulfill an Intent
Check Proof Status
Griefing Protection
LocalProver includes protection against griefing attacks:-
LocalProver as Claimant: If someone calls
Portal.fulfillwith LocalProver as claimant (without using flashFulfill),provenIntentsreturnsaddress(0)to treat the intent as unfulfilled. -
Invalid EVM Address: If Portal.claimants contains a non-EVM bytes32 value,
provenIntentsreturnsaddress(0)to allow refunds.
Flash Fulfill Atomicity
The flash fulfill mechanism provides atomic execution:- Withdraw rewards from vault → LocalProver
- Approve Portal to spend route tokens
- Call Portal.fulfill (which executes route steps)
- Transfer remaining rewards → claimant
Reentrancy Protection
ThenonReentrant modifier prevents:
- Multiple simultaneous flash fulfills
- Cross-intent reentrancy attacks
- State manipulation during execution
flashFulfill can execute at a time.