PACE: Policy-Attested Contract Execution for AI Agents in DeFiPACE: Policy-Attested Contract Execution for Safe AI Agents in Decentralized Finance
Pace uses strategy validation and signed PDR to block DeFi agent unauthorized transactions; deterministic 2800 trials unsafe execution is 0.00.
Users delegate DeFi operations to LLM agents. Adversaries can inject metadata, chat history, or external data to guide malicious contracts, front-running, altering simulated calldata, replaying stale simulations; the goal is theft, slippage/sandwich/oracle losses, bypassing policies or post-simulation tampering. Cannot modify policies, validators, or account checks; key or policy compromise is out of scope (§3).
- LLM agents planning DeFi transactions for users inherit prompt injection, and simulation-stage approvals are not bound to the final on-chain bytes, making erroneous settlements irreversible.
- Pace collects proposals into typed intents, a verifier that never queries the model checks them against user policies and simulation reports, then issues PDRs bound to execution bytes; the smart account rechecks signature, hash, nonce, and validity before external calls.
- In 2800 deterministic trials, Pace's unsafe execution and benign false rejections are both 0.00, while the unguarded baseline has unsafe execution 0.80. After Pace guarding, three live models have attack success 0.000, but there are benign false rejections. Policy-compliant harmful transactions are still allowed.
- The authors list multi-round adaptation, composing compliant legs into harmful sequences, and trace simulation on forked mainnet as future work. Experimental numbers come from an in-memory simulator, 40 self-built tasks, and three live models; the text gives no fork values.
- Evaluated models
- gemini-3.1-flash-liteDeepSeek-V4-Flashgpt-4o
- Benchmarks
- 40-task benchmarkin-memory DeFi simulatorMEV sandwich simulator
- Metrics
- Correct rateUnsafe execution rateAttack success rateDangerous block rateFalse-positive rategas overhead
The researchers propose PACE (Policy-Attested Contract Execution), a transaction-level authorization framework inserted between LLM-based agents and on-chain execution, to address prompt injection risks inherited by agents and the problem that approvals cannot be bound to the final on-chain transaction. PACE introduces typed transaction intents, a deterministic policy verifier, and signed Policy Decision Records (PDRs), cryptographically binding approved intents, policies, and simulation reports to the exact execution bytes, with replay and expiration protection; a Solidity smart account enforces PDR signature verification on-chain, with measured overhead of 29,826–31,822 gas. The authors limit their conclusions to logical-layer security within a reproducible benchmark, not a directly deployable DeFi security solution.
Paper analysis
What problem does this paper attempt to solve?
To cryptographically bind the verifier's approval of DeFi agent transactions to the final on-chain bytes.
DeFi agents turn natural language goals into irreversible on-chain transactions, yet cannot bind the verifier's approval to the final submitted bytes.
- Scenario: The authors state that DeFi holds funds in permissionless contracts, requiring hand-written calldata and judgment on slippage and approvals; LLM agents are already going on-chain with real funds. Errors settle before human intervention.
- Existing shortcomings: The authors state that model alignment and prompt injection defenses are probabilistic, evadable, and do not constrain submitted transactions; simulation does not bind broadcast bytes, and calldata changes after simulation can pass through. The authors state that to their knowledge, no defenses cryptographically bind simulation-stage approvals to execution bytes and recheck at the point of fund movement.
- Observation: The authors argue that safety need not depend on the proposing model: if actions are collected into explicitly typed objects, checked by a deterministic program that never asks the model, and rechecked at execution, then even a compromised LLM cannot settle policy-violating transactions.
- Pace: Policy-Attested Contract Execution sits between the agent and on-chain execution, containing typed intents, a deterministic policy verifier, and a signed Policy Decision Record (PDR) binding intent, policy, simulation, and execution bytes; the smart account rechecks on-chain. The authors limit to logical-layer safety within the benchmark, not extrapolating to live chains.
- Threat model:
- System: Users delegate DeFi operations to an LLM agent; Pace intercepts between output and on-chain submission (§3.1).
- Capabilities: Adversaries can inject via metadata, chat history, or external data, lure to malicious contracts, front-run, change calldata between simulation and submission, and replay stale simulations (§3.2).
- Goals: Unauthorized transfers or approvals, indirect losses from slippage/sandwich/oracle, policy bypass, post-simulation tampering (§3.2).
- Cannot do: Cannot change user policy, verifier, or account validation. The agent has no owner key and cannot use the owner-only raw execution path. Compromised keys or policy, and multi-agent collusion, are out of scope (§3.2–3.3).
What related research exists?
The authors place Pace as a deterministic layer outside the model and call it the first evaluated on-chain instance of intent patterns and PDR.
Related discussion is mainly in §9; the introduction's corresponding gaps are probabilistic model defenses, simulation not bound to broadcast bytes, and wallet guards that only consume on-chain state.
Contract Analysis and Attack Measurement
- Static and symbolic tools: Slither (Feist et al., 2019), Oyente (Luu et al., 2016), Manticore (Mossberg et al., 2019) audit contract code. The authors state that Pace instead checks agent proposals against user policy before transactions reach contracts; the two are complementary because correct contracts can still be harmful under wrong parameters.
- DeFi attacks and MEV: Zhou et al. (2023) attack taxonomy, Zhou et al. (2021) sandwich, Qin et al. (2022) MEV quantification, Daian et al. (2020) front-running. The authors state that Pace enforces slippage, amounts, and simulation-based post-state checks before entering the mempool.
Account Abstraction and Simulation Services
- Modular guards: ERC-4337 (Buterin et al., 2021) and Safe modules (2026), Zodiac Roles (2024), ERC-6900 (2023), ERC-7579 (2023) already do allowlists, spending caps, function permissions, and pre/post hooks on-chain. The authors state they only validate on-chain state; Pace's difference is binding attested off-chain simulation and verifier decisions to exact execution bytes. Making PDR a validator/hook in these frameworks is left as future work.
- Advisory services: Tenderly, Blockaid, Wallet Guard give advisory conclusions for human signers. The authors state that Pace is deterministic, binds exact intent, and enforces on-chain, and can be complementary; such services could supply SimulationReport.
Model Safety and Instrumental Agents
- Alignment and injection defenses: RLHF (Ouyang et al., 2022) and Constitutional AI (Bai et al., 2022) train models to refuse harmful outputs; direct injection (Perez and Ribeiro, 2022) and indirect injection (Greshake et al., 2023) still succeed. Liu et al. (2024) formalize attacks and defenses, StruQ (Chen et al., 2025) uses structured queries for input-layer defense. The authors state these remain probabilistic, while Pace's verifier is outside the model and deterministic.
- Agents and roadmap: Toolformer (Schick et al., 2023) and ReAct (Yao et al., 2023) establish tool use; Barton et al. (2026) discuss on-chain agents with real funds, Marino and Juels (2025) argue this opens new harm vectors. InjecAgent (Zhan et al., 2024), AgentDojo (Debenedetti et al., 2024), ToolEmu (Ruan et al., 2024) measure the degree of subversion but do not prevent unsafe execution. The authors state that Alqithami (2026) proposes Transaction Intent Schema and Policy Decision Record as a roadmap; the authors state that Pace provides an instantiation with simulation binding, evaluation, and on-chain enforcement, and claim this is the first such instantiation of these abstractions.
Baselines and Benchmark
- Six non-Pace baselines: Raw, Prompt-Only, Sim-Only, WalletGuard, StaticGuard, SimGuard, sharing a decision interface, ordered from least to most safety coverage (§5.4).
- Self-built tasks: 40 tasks, 8 each of benign utility, prompt injection, unsafe contracts, DeFi exploits, MEV/slippage (§6.2).
The authors position Pace as model-external deterministic enforcement: not a replacement for contract audits or model alignment, but binding off-chain simulation and policy decisions before submission, rechecked by the smart account.
How does the paper address this problem?
Typed intents are written into signed PDRs after deterministic verification, and the smart account rechecks the binding before external calls.
Pace treats all LLM outputs as untrusted: after collecting typed intents, a deterministic simulation and policy verifier adjudicates, and only upon approval is a signed PDR written; the smart account rechecks before external calls. Figure 1 marks the agent and intents as untrusted, and the simulator, verifier, and PDR as deterministic and never querying the LLM.
Setting and Binding Scope
- Soundness goal: The authors state the goal as soundness, claiming that every executed transaction satisfies the declared policy, independent of LLM behavior. They make no completeness claim: whether the policy covers all unsafe outcomes is the responsibility of the policy author (§3.3).
- No binding of economic outcomes: The PDR binds approval to the exact intent, policy, simulation, and execution bytes, with replay and expiration protection. The contract does not replay the simulation on-chain, so a transaction approved in state S may execute in a different state, where reserves, prices, or upgraded targets may differ (§4.5).
- Field provenance: The authors state that soundness requires the checked semantic fields to reflect the actual execution bytes. The calldata hash only guarantees that the submitted bytes equal the approved bytes, not that the typed fields match the bytes; at deployment, trusted code must reconstruct them from decoded calldata and simulation traces, and LLM-filled fields cannot be trusted (§4.6).
Typed Intents and User Policies
- TransactionIntent: Contains chain ID, sender and target, ETH value, function selector, calldata, a list of TokenApproval (token, spender, amount, unlimited flag), slippage tolerance, and free-form metadata. After canonical JSON (sorted keys, compact separators), SHA-256 is applied to obtain hash_intent; calldata additionally has calldata_hash.
- UserPolicy: Address allowlists (target, selector, token); per-transaction maximum ETH and per-token spending limits; rejection of infinite approvals (amount 2^256−1); slippage upper bound; function blocklist (examples in the text: flashLoan, delegateCall); whether simulation is mandatory and its maximum age; post-state thresholds (minimum health factor, maximum loss); regex on metadata. Policies are versioned by their own SHA-256.
Verifier and Simulation
- Pure function checks: The verifier is stateless, does not access the network, and does not query the LLM. It checks allowlists, forbidden selectors, spending limits, ETH value, infinite approvals, slippage, and forbidden metadata. If simulation is required, it also checks success, freshness, non-future timestamps, allowed touched contracts, minimum health factor, maximum loss, and that the reported intent_hash equals the submitted intent hash (§4.4).
- Replaceable simulation backend: The reference implementation is an in-memory DeFi model used to populate touched contracts, health factor, and loss percentage. The authors state that production deployments should use trace-based simulation against an archive node; full ABI decoding of arbitrary router calldata is delegated to the trace backend.
- Trace assumptions: The touched-contract set belongs to a single execution trace. The authors treat this as a simulation-time check, sound only if the relevant execution state is unchanged (§4.6; the boundaries cross-referenced in §8 are written in §4.5–4.6).
PDR and On-Chain Enforcement
- When to sign: The PDR binds the full intent, the policy used, the simulation report, the decision and violation strings, three SHA-256 hashes, and timestamps. Only when the decision is Approve is it signed; rejection records remain off-chain for audit and are not signed, so a valid signature indicates approval. Including the decision field in the signed digest is called further hardening, not part of the current design.
- On-chain digest: PaceSmartAccount performs keccak256 over 12 fields, then ECDSA recovery with the Ethereum Signed Message prefix: policyHash, intentHash, simulationHash, calldataHash, chainId, account, target, value, nonce, validAfter, validUntil, simulationBlock. Off-chain content addressing uses SHA-256, on-chain uses keccak256; the authors state each side is internally consistent.
- executePDR: Figure 2 performs nine checks before the external call: verifier signature, chain ID, account, target, value, keccak256(data), nonce unused, validAfter, validUntil. On failure, it reverts with PDRInvalid. The nonce is marked used before the external call, so reentrancy cannot replay that PDR. There is also an owner-only, PDR-less raw call path for recovery and management.
Reference Implementation
- Stack and simulator: Python 3.11+, Pydantic v2, package name pace. The in-memory simulator includes ERC-20, a constant-product AMM (fee rate 30 bps, reserves 10,000 WETH/10,000,000 DAI), a lending pool (price 1,000 DAI/ETH, LTV 0.75, liquidation threshold 0.80), a malicious router that touches hidden contracts during delegate calls, and an approval drainer. Two dedicated simulators respectively roll back the reported timestamp, or return a report whose intent hash does not match the submitted intent hash.
- MEV module: Given reserves, victim transaction, slippage, fee rate, and attacker budget, it uses iterative refinement to find the most profitable front-run, and reports victim loss (bps), attacker profit, and whether strict slippage protection blocks execution.
- LLM interface: Deterministic experiments use a regex MockLLM that matches patterns in the prompt text and returns preset safe or unsafe responses. An optional OpenAI-compatible adapter accepts base URL, API key, and model name; live responses are recorded in traces and still pass through the same verifier.
What experiments did the paper conduct?
In 2800 deterministic trials, Pace's unsafe execution rate was 0.00; after live guard, attack success rate was 0.000, but there were benign false rejections.
Experimental Setup
- Comparison Objects: Seven agents share a decision interface: Raw, Prompt-Only, Sim-Only, WalletGuard, StaticGuard, SimGuard, Pace. Prompt-Only in the deterministic suite uses a regex MockLLM and does not make live API calls (§5.4, §6.4).
- Live Models: gemini-3.1-flash-lite, DeepSeek-V4-Flash, gpt-4o, via OpenAI-compatible endpoints, still go through the same PolicyVerifier (§7.5).
- Tasks: 40 self-built tasks, 8 in each of five categories. Benign utility expects approval; prompt injection, unsafe contracts, DeFi exploits, MEV/slippage expect rejection. Task IDs and expectations are fixed across seeds; wording, attacker budget, pool reserves, slippage, injection strings, target addresses, and simulation age vary with seed (§6.2).
- Scale: Deterministic full mode uses seeds 0–9, 7 agents × 40 tasks × 10 seeds, totaling 2,800 trials. Seeds are deterministic task variants, not repeated sampling from a live distribution (§6.4).
- Metrics: Correct rate uses all trials as denominator, checking whether approval/rejection matches expected safe behavior. Unsafe execution rate is unsafe executions divided by all trials. Attack success rate has the same numerator but denominator only attack trials. Dangerous block rate is rejected unsafe attack transactions divided by attack trials. False-positive rate is incorrectly rejected benign tasks divided by benign trials. Task completion rate is not correctness (§6.3).
- On-chain and Auxiliary: Foundry, Solidity 0.8.24, optimizer 200 runs; contract suite has 21 tests, of which 11 are account-forced, 6 gas, 4 fork harnesses (§5.6). Ablation uses seed 42. Live runs use 5 repetitions per model, seed 42, totaling 595 trials. §7.6 states that if no fork result files are generated, no fork conclusions are drawn. Correctness is checked against the expected decision within the task.
Main Results
Swipe horizontally to read the table
Agent Correct% Unsafe Exec Atk Success Dangerous Block FP Rate Raw 20.0% 0.80 1.00 0.00 0.00 Prompt-Only 41.2% 0.59 0.73 0.27 0.00 Sim-Only 27.5% 0.72 0.91 0.09 0.00 WalletGuard 75.0% 0.25 0.31 0.69 0.00 StaticGuard 95.0% 0.05 0.06 0.94 0.00 SimGuard 97.5% 0.03 0.03 0.97 0.00 PACE 100.0% 0.00 0.00 1.00 0.00 From Table 1 (2,800 trials, 10 seeds). Correct and Unsafe Exec denominators are all trials; Atk Success and Dangerous Block denominators are attack trials; FP denominator is benign trials.
- The authors state that Pace matches the expected decision for every seed on this benchmark; zero seed-level variance comes from the definition that verification is a pure function of intent, and should not be read as a statistical guarantee against unseen or adaptive adversaries (§7.1).
- The authors state that the strongest non-Pace baseline is SimGuard: it has fresh simulation and policy checks, but no PDR calldata binding, and still allows calldata mutation. The text reports its attack success as 0.0312, Table 1 records 0.03, and here the table is authoritative. §7.8 counts 32 attacks per seed: SimGuard blocks 31, Pace blocks 32.
- Seed-level variance concentrates in Prompt-Only. §7.1 gives correct rate standard deviation 2.56 percentage points, unsafe execution 0.5875±0.0256, attack success 0.7344±0.0320. The authors state that benign tasks fall within policy limits.
Categorized Attacks and Calldata Binding
- What was tested: Attack success broken down by category, with stale simulation da_07 and calldata mutation da_08 listed separately (§7.2).
- Results: The authors state that Pace, SimGuard, and StaticGuard block all prompt-injection and MEV/slippage tasks. For unsafe contracts, all three have attack success 0.00; WalletGuard misses unlimited approval, which the authors explain as zero ETH bypassing its amount check. For DeFi-attack patterns, Pace blocks all 8; StaticGuard misses 2 of the 8 that rely on simulation checks; SimGuard catches stale simulation but still misses calldata mutation.
- Authors' interpretation: da_08 first passes simulation and policy, then the submitted bytes differ from the approved bytes. SimGuard omits the hash equality check, so it passes, and this is the only attack it misses. Pace rejects on-chain using intent_hash off-chain and keccak256(data) on-chain (Figure 2). When calldata binding is removed, only this task is allowed through.
Live Multi-Model
- What was tested: Three models run all 40 tasks, 5 repetitions each, totaling 595 trials, about 200 per model (approximately 160 attacks, 40 benign), seed 42, separate from the 2,800-trial suite (§7.5).
- Results: In Table 3, all three have Pace-guarded attack success of 0.000. Without guard, gpt-4o judges 11/160 attack trials (6.9%) as safe, DeepSeek-V4-Flash 4/156 (2.6%), and the verifier rejects all; gemini-3.1-flash-lite does not allow attacks without guard. Benign FP rates are 0.125, 0.128, 0.050; Correct% are 97.5, 97.4, 99.0. The text also reports benign false rejection 5.0–12.8%.
- Authors' interpretation: The authors state that the invariant is structural: attacks judged safe by the model are still rechecked against policy on the parsed intent, and guarded attack success is capped by the verifier. The authors attribute non-zero benign false rejections to model and parser variance, calling it a deployment-time tuning issue rather than a safety failure.
Adaptive Adversaries and On-chain Overhead
- Adaptive: The adversary fully knows the policy (conservative configuration, seed 0). Evasion items include amounts and slippage near boundaries, look-alike targets, banned selectors, delegateCall touching hidden contracts, calldata changes after simulation, and unlimited approval hidden behind seemingly benign metadata. Table 4: Pace blocks 8/8; SimGuard and StaticGuard each 7/8, missing only calldata mutation; WalletGuard 2/8.
- In-policy harmful: Swaps exactly at slippage boundary, transfers hitting amount caps, large finite approvals to allowlisted spenders, five-leg drains with each leg below the cap. Pace and all baselines allow 8/8. The authors state that deterministic checks are not fooled by such adaptation, disguised approvals are caught by exact approval checks, and regex is not load-bearing. The authors consider this delineates non-guarantees: no completeness claims for "harmful but policy-compliant" behavior or cross-transaction sequences, and only one transaction is verified at a time.
- Gas and local EVM: PDR verification adds 29,826–31,822 gas per transaction, mainly from ecrecover (about 3,000) and nonce SSTORE (about 20,000). Relative costs are approval 91.7%, transfer 78.9%, swap 50.5%. About 0.04 ms includes only verifier decision latency, not trace simulation, ABI decoding, or archive-RPC. PaceSmartAccountTest passes 11/11: 3 valid executions, 7 invalid PDR rejections, 1 owner-only raw path (§7.4).
Other Ablations and Analyses
- Removing simulation: unsafe execution rises from 0.000 to 0.050 (Table 2, seed 42, 320 trials, 8 variants).
- Removing touched-contract allowlist: unsafe execution 0.125; removing calldata binding or freshness: each 0.025.
- Removing metadata scanning: unsafe execution remains 0.000; the authors state these attacks are also caught by other constraints.
- Explicit permissive policy: unsafe execution 0.575, Correct% 42.5%, FP 0.000.
- Conservative policy: unsafe execution 0.000, FP 0.250, Correct% 95.0%, reject rate 0.850.
- Slippage threshold at 100 bps gives 100.0% accuracy, at 10 bps and 1,000 bps both 95.0% (the former over-rejects, the latter allows MEV). Freshness window 0 seconds gives 80.0% accuracy, at least 1 second returns to 100.0% (§7.3).
What are some points that can be further explored?
Multi-round adaptive attacks, multi-step harmful combinations, and higher-fidelity execution are listed by the authors as still open directions.
Limitations and Future Directions Noted by the Authors
- Multi-round adaptation: Adaptive attackers who learn over multiple rounds against the verifier remain an open problem, which the authors call one of the most important next steps (§10).
- Multi-step composition: Multi-step agent loops that compose individually policy-compliant legs into harmful sequences remain open (§10).
- Higher-fidelity execution: Running the full attack suite with trace-based simulation on forked mainnet state, and extending to cross-contract reentrancy, governance, and bridge exploits; the authors state this would strengthen external validity, and the verifier and PDR binding can be directly ported to such a backend (§10).
- Model panel: A larger model panel (including open-weight) and end-to-end agent harness to characterize how often models propose unsafe actions (§10).
- Account integration: Upgrading the PDR hash to EIP-712 typed data and integrating validation into ERC-4337's validateUserOp, enabling Pace to run as a standard smart account module (§10).
- Policy tooling: Tools for writing and tuning policies; the authors state that policies are the dominant security factor, and such tools are an important complement to the enforcement mechanism (§10).
Experimental Coverage
- The deterministic full mode uses seeds 0–9, 7 agents, 40 tasks per seed, totaling 2,800 trials; Prompt-Only uses the regex MockLLM, and this suite has no live API calls (§6.4, §7). §6.4 states that these sandbox experiments do not constitute evidence of effectiveness against adaptive adversaries on live chains.
- Tasks are 8 per five categories, with correctness checked against the expected decision within each task. §6.3 defines user loss, slippage, health-factor violation rate, PDR rejection rate, and decision latency; the results section reports latency and gas, but does not report financial values such as user loss.
- Ablations use 8 Pace variants, seed 42, 320 trials (Table 2); sensitivity to slippage and freshness thresholds is described in §7.3.
- Live evaluation uses gemini-3.1-flash-lite, DeepSeek-V4-Flash, and gpt-4o, with 5 repetitions per model, totaling 595 trials, seed 42 (§7.5, Table 3).
- The adaptive study uses 8 evasion attacks plus 8 policy-compliant harmful transactions with seed 0 (Table 4). Foundry local account use cases 11/11, with gas measured under Solidity 0.8.24 and optimizer 200 runs (§7.4). §7.6 states that no fork numerical conclusions are made without fork result files; the main text gives no fork numbers.
Summarize the main content of the paper
Pace decouples on-chain security from model trustworthiness using signed policy decisions, with an unsafe execution rate of 0.00 in the benchmark.
Pace is a transaction-level authorization framework placed between LLM agents and DeFi on-chain execution, designed to block settlements that violate user policy.
- Problem: Agents inherit prompt injection, and simulation-stage approvals are not bound to the final broadcast bytes; erroneous transactions are irreversible on-chain.
- Approach: Proposals are first turned into TransactionIntent, then checked by a verifier that never asks the LLM against UserPolicy and simulation reports. Only approvals issue PDR. The smart account rechecks verifier signature, calldata hash, nonce, and valid window before external calls. The authors frame guarantees as byte- and field-level soundness, not economic outcome equivalence, and do not claim policy completeness.
- Deterministic benchmark: In-memory simulator, 10 seeds, 2,800 trials, Table 1 shows Pace at Correct 100.0%, unsafe execution 0.00, attack success 0.00, FP 0.00; Raw's unsafe execution is 0.80. SimGuard still allows calldata mutation. In Table 2, permissive policy raises unsafe execution to 0.575, removing touched-contract allowlist to 0.125.
- Other measurements: Three live models under Pace guard have attack success 0.000, benign FP 0.050–0.128 (Table 3). Known-policy evasion attacks: Pace blocks 8/8, policy-compliant harmful transactions are allowed 8/8 like all baselines (Table 4). PDR path adds 29,826–31,822 gas.
- Authors' conclusion: The authors argue that on-chain action safety can be decoupled from the trustworthiness of the proposing model; treating model outputs as uniformly untrusted and enforcing signed policy decisions off-chain and on-chain yields a lower bound that does not degrade with model behavior. The authors hope transaction-level policy attestation becomes a building block for autonomous agents with real funds, and limit claims to logical-layer safety in a reproducible benchmark.