> For the complete documentation index, see [llms.txt](https://autopilot-5.gitbook.io/autopilot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://autopilot-5.gitbook.io/autopilot/protocol/markdown/execution-mechanism.md).

# Execution Mechanism

After vote allocations are determined, Autopilot handles on-chain execution using a **batched voting system**.

\
The design ensures efficient processing for users with one or many **veAERO** or **veVELO** positions, minimizing gas usage and handling edge cases through built-in fallback logic.

***

#### 🗳️ Batched Voting

Autopilot supports multiple veAERO and veVELO locks per wallet.\
To reduce overhead and ensure scalability, votes are submitted in **gas-optimized batches** specific to each network.

**Why Batching Is Required:**\
Without batching, each veNFT would require its own transaction, leading to:

* Higher gas consumption per vote
* Risk of exceeding block gas limits
* Increased latency for users with multiple positions

**How It Works:**\
**Batch construction:**

* veNFTs are grouped by owner and network (Base or Optimism).
* Batches are structured to remain within each chain’s gas limit — approximately 30M on Base and slightly lower on Optimism.

**On-chain submission:**

* Each batch contains multiple `vote()` calls submitted in a single transaction.
* This enables fast, low-cost execution during the limited voting window.
* For Velodrome, batching also accounts for **bridging and multichain sync latency**, ensuring votes confirm safely before the cutoff.

***

#### 🔁 Handling Failures

Autopilot includes internal logic to manage potential execution failures (e.g., congestion, outdated pool data, or invalid gauge reads).

**Built-in Resilience:**

* **Retry logic:** NFTs that fail to vote in a batch are retried individually through fallback transactions.
* **Error tracking:** Failed operations are emitted on-chain via `VotingCompleted` and `FallbackExecuted` events.
* **Non-blocking execution:** A single failed NFT does not interrupt the remaining batch.

📘 *Example:*\
If 1 out of 50 NFTs fails due to an outdated gauge on Velodrome, Autopilot completes the batch and retries the failed one in a separate transaction.

***

#### 🔐 Nonce Handling

Managing multiple NFTs per wallet requires accurate nonce sequencing to prevent transaction conflicts.

**Predictive Nonce Tracking:**

* Autopilot tracks wallet nonce states before each batch to prevent duplication or collision.
* **Gas-aware execution:** Nonce order is dynamically adjusted if pending transactions or retries occur, maintaining smooth flow even during high activity periods.

***

#### 📦 Execution at Scale

Autopilot’s execution framework is designed for scale and performance:

* Supports wallets holding dozens or hundreds of veAERO or veVELO NFTs
* Optimized for institutional users and DAOs managing large voting positions
* Executes all votes within the final blocks of each epoch, under constrained blockspace and network limits

Whether managing one lock or hundreds, execution remains predictable, gas-efficient, and fully automated — no manual action required.
