Skip to main content

Why should I re-simulate instead of retrying validation?

If validation fails or the simulationId has expired, re-simulate to get a fresh result. Retrying the same validate call will not repair a changed transaction or an expired cache.

J
Written by Javier Diaz

If validation fails or the simulationId has expired, re-simulate to get a fresh result. Retrying the same validate call will not repair a changed transaction or an expired cache.

Definition

Validate only compares the unsigned transaction with a cached simulation. It does not rebuild or fix the transaction. When the cache is gone, or when a check fails, the documented next step is a new simulation and a new review.

How it works

  • If validate returns 404, the simulation was not found or has expired (after five minutes). Simulate again.

  • If valid is false, inspect the checks object to see which field changed, then decide whether that change was intentional.

  • Re-simulate the transaction you now intend to sign, review amountOut and gas, and validate the new simulationId.

  • Sign only when valid is true.

How Enso does this

Validating Transactions and Error Handling both tell you to re-simulate on failure rather than retry the same validation. Use POST https://quoter.api.enso.build/api/v1/simulate, then POST /api/v1/validate. Validate as close to signing as possible within the five-minute window.

FAQ

What if nothing in the transaction changed and validate still fails?

Confirm you are sending the same data, to, from, value, and chainId as the simulation, and that the simulationId is still in cache. If the ID expired, only a new simulation will work.

Does Route need this re-simulate loop?

Not as a Quoter flow. Route already simulates internally when it returns tx. If the Route quote is no longer acceptable, request a new Route quote rather than editing tx.

Related articles

  • Why did Quoter return a 404 on validate?

  • How do I read Quoter validation checks?

  • What happens if calldata changes after I simulate?

  • How long is an Enso simulation cached?

  • Enso Route vs Enso Quoter

Sources

Did this answer your question?