!5280odin/endblock-txout-window → developa2cdfab54e

EndBlock loads the past and scheduled txout windows with one iteration each

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.

4commits
5files
516lines changed
250lines to read
900 + 721heights per load (past + scheduled)
−38%GetTxOut CPU, reported, past window only

Where the diff is

Where the windows sit

3-minute explainer

What changed

Per-height misses

Each empty height cost a goleveldb miss, per block

Has(txout//N)IAVLgoleveldb miss

One iteration

First read loads h−900…h−1 with one seek

~900 point reads1 seek + present keys

Scheduled window

A second window, h+1…h+721, stacks over the past one

pasth: neitherscheduled

Writes disable it

A write to a covered height turns that window off for the block

  • covered write → that window off
  • bad txout key → both off
  • current height → both stay on

Key order

Byte order catches other-length heights; only canonical keys kept

txout//28123699txout//2812370txout//28123700

Gas and evidence

EndBlock only; reported replay covers the past window

tx gas unchangedGetTxOut −38%, reportedEndBlock −6.6%, reported

Line by line · every changed logic line, narrated

5:24runtime
8code chapters
100%logic lines narrated (191/191)
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

EndBlock
The module hook run after a block's transactions; its gas is not charged to any transaction result. module.go ↗
IAVL
The Merkle tree backing Cosmos SDK stores; a lookup of a missing key walks it down to goleveldb. cosmos/iavl ↗
Inter-block cache
Cosmos SDK store cache kept across blocks; it holds only existing values, so absent keys reach disk.
MaxTxOutOffset
Mimir-settable blocks an outbound may be delayed ahead (720 by default); it sets the scheduled window's end. constant_values.go ↗
SigningTransactionPeriod
Mimir-settable number of blocks an outbound may stay unsigned (300); XMR and EVM use the extended ×3 period. type_tx_out.go ↗
TxOut
The outbound items scheduled at a block height, stored under key txout//<height>. keeper_txout.go ↗
TxOutCache
Existing query-scoped cache of TxOut reads; the window is checked before it.
TxOutWindow
New per-EndBlock snapshot of stored TxOut bytes for a height range; one covers past heights, one scheduled, each loaded with one iteration. txout_window.go ↗