Merged
Conversation
qu0b
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
tx_uid— a compact 8-byte transaction identifier that replaces the redundant(block_uid, tx_hash)composite key in execution indexing tables, significantly reducing storage and index overhead.tx_uid encoding
tx_uid >> 16tx_uid & 0xFFFFtx_uid >> 32Schema changes
el_transactions — keeps
block_uid, addstx_uid, dropstx_index:tx_uidadded as a UNIQUE indexed column (block_uid << 16 | tx_index)tx_indexdropped (derivable fromtx_uid & 0xFFFF)(block_uid, tx_hash)for efficient block-based and hash-based lookupsel_event_index —
(block_uid, tx_hash, event_index)→(tx_uid, event_index):block_uid(8 bytes) andtx_hash(32 bytes)tx_uid(8 bytes)el_token_transfers —
(block_uid, tx_hash, tx_idx)→(tx_uid, tx_idx):block_uid(8 bytes),tx_hash(32 bytes), andtx_pos(4 bytes)tx_uid(8 bytes)el_transactions_internal —
(block_uid, tx_hash, tx_callidx)→(tx_uid, tx_callidx):block_uid(8 bytes) andtx_hash(32 bytes)tx_uid(8 bytes)Storage reduction estimate
Assumptions: mainnet-scale, 200 txs/block, ~2.5 events/tx, ~4 token transfers/tx, ~6.5 internal calls/tx.
Estimates include heap data + all associated indexes (PK + secondary). Dependent tables see large reductions because the 32-byte
tx_hashand 8-byteblock_uidare replaced by a single 8-bytetx_uidin both row data and every index entry.The three dependent tables hold ~93% of all execution index rows (events, transfers, and internal calls vastly outnumber transactions). The weighted overall reduction across all four tables is approximately ~45%.
Query changes
tx_uidinstead of(block_uid, tx_hash)for all lookupsORDER BY block_uid DESC, tx_index DESC→ORDER BY tx_uid DESC(equivalent ordering)tx_hashfromel_transactionsviaGetElTransactionsByTxUids()when needed for displayWHERE tx_uid < thresholdfor dependent tables (threshold =blockUidThreshold << 16)Migration
The migration (
20260417000000_tx-uid) performs the following in a single transaction:tx_uidcolumn toel_transactionsand populates ittx_uidvia JOIN, migrating existing datatx_indexfromel_transactionsBoth PostgreSQL and SQLite migrations are included.
Test plan