!5278odin/quote-residual-perf → develop454c9cec6f

Cheaper API swap quotes

AI-generatedEverything on this page was written by an AI agent from the diff: the summaries, the narration, the diagrams, the flags and the glossary. It can be wrong or incomplete, so check it against the code before you rely on it.

8commits
9files
851lines changed
346lines to read
−19 to −36%quote sec/op (author)
0consensus paths changed

Where the diff is

Where an API quote's store work goes

Only API quotes carry a live TxOutCache; contracts and txs keep develop's code.

newchanged

2-minute explainer

What changed

Chunked txout reads

A cache miss fills 1,000 aligned heights in one range iteration.

miss hClaimChunk(h/1000)IteratorFill

One window walk per sort

First vault collects unsent items; later vaults and sorts reuse them.

vault A: walkB: reuseC: reusenext sort: reuse

Touched pools by bytes

One pool iteration compares stored bytes instead of re-marshalling.

same touched setnew pools skippedcontracts keep GetPools

Line by line · every changed logic line, narrated

4:37runtime
7code chapters
100%logic lines narrated (280/280)
8flagged spots
speed

Chapters

What to check

Ask an AI about this change

Chat assistantClaude, ChatGPT, … (reads a link)

Coding agentClaude Code, Cursor, … (reads the repo)

The context file is context.md. Use Copy with context for an AI that can't open links; it pastes the whole file in.

Glossary

CtxWASMQuery
Context flag set for queries from CosmWasm contracts. Those run inside a tx, so their store reads are consensus-visible gas.
Fork (ForkTxOutCache)
A view of a cache for a discarded store branch, like simulate's CacheMultiStore. Its txout write disables only the view. txout_cache.go ↗
Live cache
A TxOutCache that is set and not disabled, nor forked from a disabled one. Only API quotes have one. txout_cache.go ↗
simulate()
Querier helper that runs a swap's handler and end blocks on a discarded store branch to build a quote. querier.go ↗
Txout window
Heights from block height minus the signing period up to now; their unsent items count toward each vault's value. keeper_vault.go ↗
TxOutCache
Per-query read-through snapshot of stored TxOut bytes by height. Any txout write through its context disables it for good. txout_cache.go ↗
Vault security sort
getSortedVaultSecurity: orders vaults by bond minus value held and owed, to pick outbound vaults. keeper_vault.go ↗