Skip to content

@odatano/nightgate 0.25.0

Choose a tag to compare

@maxalexweber1 maxalexweber1 released this 21 Sep 19:07
· 84 commits to main since this release
45dcd0e

@odatano/nightgate 0.25.0

The crawler indexes unshielded UTXOs, and two optional passes fill the rest.
No circuit change; one schema delta.

The Midnight pallet reports every applied ledger transaction in
System.Events, which the crawler already fetched and decoded with the
block's own runtime metadata before keeping only ExtrinsicSuccess and
ExtrinsicFailed. What follows comes out of the records it was dropping, so
it costs no extra call per block.

  • UnshieldedUtxos from Midnight.UnshieldedTokens, which carries a
    transaction's consumed and produced outputs. A spend is matched to its
    output by (intentHash, outputIndex), including one created in the same
    block. The Bech32m owner and the DUST initialNonce are derived per row
    and reproduce the Midnight indexer's values; ctime is the block
    timestamp.
  • NightBalances follow, folded in block by block under the same rule
    the reorg rollback rebuilds them with. NIGHT only: other tokens in the
    same UTXO set stay out of these figures.
  • ContractActions carry their address and record a maintenance
    update as UPDATE, one row per action the chain reported. These are the
    actions that APPLIED; a call in a failed segment of a partial success is
    not among them.
  • Transactions carry ledgerTxHash, contractAddress and the
    transfer participants where the movement is unambiguous. txType follows
    the events, not the pallet index alone.
  • TransactionResults record PARTIAL_SUCCESS.

Two optional passes

Both trail the indexed tip with their own cursor on SyncState, both are
off by default, and neither can hold up indexing. A pass advances its cursor
only when neither the cursor nor reorgGeneration moved since it read them;
resetting a cursor replays the range.

  • crawler.decodePayloads / NIGHTGATE_CRAWLER_DECODE_PAYLOADS decodes
    the ledger transaction inside each stored extrinsic into circuit names,
    identifiers and the zswap and DUST counts, recording decoded, absent
    or failed per row. Off by default because the decode runs in wasm on the
    main thread: 9 ms median, 139 ms worst case over 122 live payloads.
  • crawler.indexerSupplement / NIGHTGATE_CRAWLER_INDEXER_SUPPLEMENT
    fills TransactionFees.paidFees, TransactionSegments,
    ContractActions.state, ContractBalances, both ledger-event streams and
    registeredForDustGeneration from the Midnight indexer. A second source
    with its own cursor, not a wider crawl: with the pass off the crawler
    still reads a node and owes nothing to an indexer. Rows join on
    ledgerTxHash, and re-running a block replaces its rows.

The paid fee is computable from the ledger with the block's parameters, but
those change per block and only the indexer serves them, so it is read
rather than recomputed. Without the supplement it stays zero.
Transactions.dustConsumed is a different figure: what a transaction's DUST
spends declare.

Upgrade. npx nightgate-schema-delta migrates the DB. UnshieldedUtxos
becomes unique on (intentHash, outputIndex) instead of
(createdAtTransaction, outputIndex), because one transaction can carry
several intents whose outputs both start at 0. Blocks.stateRoot takes over
the substrate header's state root, which was being written into a column
named ledgerParameters; the migration moves existing values across and
that column now holds the ledger parameters, filled by the supplement only
when they change. An index built before this release holds no UTXO rows, so
the new columns fill from the first block indexed afterward; a full history
needs a re-index.

Full Changelog: v0.24.5...v0.25.0