Ordering and identity
Process logs in(blockNumber, transactionIndex, logIndex) order. Preserve block hash and parent hash so every derived write can be rolled back on a reorg.
Canonical keys include:
orderId.
Bootstrap
- Start from the component and market
fromBlockvalues on Testnet Deployments. - Discover markets from SpotRouter registration events and confirm them against AccountCore registration.
- Cache immutable market fields and current application-visible configuration.
- Replay all logs in order.
- Periodically compare balances, active slots, band state, and top-of-book views against the chain.
Source precedence
TradesPackedis required for execution-induced active and passive depth changes.BookUpdatesPackedcovers newly resting state and non-trade removals.MATCH_ENDpartitions fee and settlement groups inside one packed action.SpotReserveUpdatedis an AccountCore post-state snapshot. Apply every snapshot in log order; do not also applyDeposit,Withdrawal, or transfer as a second balance mutation.PassiveBandUpdatedis the passive inventory snapshot.SpotSwapis a taker summary, not a complete trade tape.