btcindexer: fix ingestor integration and types#186
Conversation
Signed-off-by: Robert Zaremba <robert@zaremba.ch>
Signed-off-by: Robert Zaremba <robert@zaremba.ch>
Signed-off-by: Robert Zaremba <robert@zaremba.ch>
There was a problem hiding this comment.
Sorry @robert-zaremba, your pull request is larger than the review limit of 150000 diff characters
|
@copilot update description of the pull request based on the changes. Ignore changes in |
|
@robert-zaremba I've opened a new pull request, #187, to work on those changes. Once the pull request is ready, I'll request review from you. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes integration issues and type inconsistencies in the btcindexer following PR #154. The main changes standardize the KV namespace binding names, refactor the block ingestion flow to use timestamps, and improve type organization.
Key changes:
- Renamed KV namespace binding from
btc_blockstoBtcBlocksfor consistency with naming conventions - Replaced
kv_keyfield withtimestamp_msinBlockQueueRecordinterface - Moved
NbtcDepositSenderinterface from models to storage module for better organization - Refactored block ingestion to generate timestamp once per batch and simplified queue message preparation
Reviewed Changes
Copilot reviewed 13 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/lib/src/nbtc.ts | Added timestamp_ms field to BlockQueueRecord, removed kv_key, and added kvBlocksKey helper function |
| packages/btcindexer/wrangler.jsonc | Updated KV namespace binding name to BtcBlocks and removed trailing commas |
| packages/btcindexer/src/storage.ts | Renamed method getBlockInfo to getBlockHash, moved NbtcDepositSender interface here, and renamed insertBtcDeposit to insertNbtcMintDeposit |
| packages/btcindexer/src/router.ts | Updated KV namespace reference from btc_blocks to BtcBlocks |
| packages/btcindexer/src/queue-handler.ts | Removed storage parameter, simplified block processing logic, and improved retry handling |
| packages/btcindexer/src/models.ts | Removed NbtcDepositSender interface (moved to storage.ts) |
| packages/btcindexer/src/index.ts | Updated function call to processBlockBatch to remove storage parameter |
| packages/btcindexer/src/cf-storage.ts | Updated imports, implemented renamed methods, and modified insertBlockInfo to use timestamp_ms |
| packages/btcindexer/src/btcindexer.ts | Reorganized imports, updated storage initialization with new binding name, and added insertBlockInfo call in processBlock |
| packages/btcindexer/src/btcindexer.test.ts | Updated test data to use timestamp_ms instead of kv_key |
| packages/btcindexer/db/migrations/0001_initial_schema.sql | Fixed indentation in SQL schema |
| packages/block-ingestor/wrangler.jsonc | Updated KV namespace binding to BtcBlocks and removed trailing commas |
| packages/block-ingestor/src/ingest.ts | Refactored to use kvBlocksKey helper, simplified batch preparation, and generate timestamp once per batch |
| packages/block-ingestor/src/index.ts | Updated parameter name from BlockStore to BtcBlocks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Robert Zaremba <robert@zaremba.ch>
Description
Follow up on: #154