r/CryptoTechnology • u/BirdNext3884 • 10h ago
When should a wallet consider a transaction simulation stale?
Suppose a wallet simulates a token swap and shows the expected balance changes. The user leaves the confirmation screen open for a minute, then comes back and signs.
The simulation describes execution against a particular chain state. By the time the transaction is included, that state may have changed. What should the wallet do with the old result?
There seem to be a few different cases worth separating:
- Pool reserves change, affecting the amount received. An on-chain minimum-output condition can limit execution, even if the preview becomes inaccurate.
- An allowance or balance changes, so a transaction that simulated successfully may now revert.
- A transaction grants an approval. Showing no immediate token loss in the simulation says little about how that permission could be used later.
Refreshing before signing seems useful, but it still leaves a gap between simulation and inclusion. Refreshing after every new block could also make the confirmation screen constantly change.
Would you use a fixed expiry, refresh on specific state changes, or always rerun immediately before signing? And how should the interface distinguish an estimated outcome from a condition actually enforced by the transaction?
Interested in how wallet developers handle this trade-off, particularly when the user spends a while reviewing the details.