HOTFIX: Prevent missing UDT records from stopping block sync - #2942
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the block sync pipeline against a historical data inconsistency where a CellOutput is classified as xudt but its corresponding Udt row is missing, preventing a RecordNotFound from rolling back the entire block processing transaction and halting the syncer.
Changes:
- Replace raising
Udtlookups inupdate_or_create_udt_accounts!with non-raising lookups and skip only the affected update while logging details. - Filter out missing (
nil) UDT IDs before writingUdtTransactionrelationships to avoid persisting invalid associations. - Add a regression test ensuring
process_blockcompletes and marks the historical output as dead even when the consumed xUDT’sUdtrow is missing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
app/models/ckb_sync/new_node_data_processor.rb |
Makes UDT account updates and UDT-transaction relationship writes resilient to missing Udt rows. |
test/models/ckb_sync/node_data_processor_test.rb |
Adds an end-to-end regression test covering the missing-historical-xUDT scenario during process_block. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jiangxianliang007
self-requested a review
August 16, 2026 04:21
jiangxianliang007
enabled auto-merge
August 16, 2026 04:22
jiangxianliang007
approved these changes
Aug 16, 2026
jiangxianliang007
disabled auto-merge
August 16, 2026 04:25
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
Udtlookups inupdate_or_create_udt_accounts!with non-raising lookups.CellOutput, cell type, type hash, and expected UDT type, then skip only that UDT account update.UdtTransactionrelationships.process_blockregression test for a consumed historical xUDT whoseUdtrow is missing.Root cause
Explorer contains a historical
CellOutputclassified asxudtwithout a matchingUdtrow. When block20,169,277consumes that output,update_or_create_udt_accounts!callstake!, raisesActiveRecord::RecordNotFound, rolls back the block transaction, and terminates the blocksyncer. Restarting retries the same block and fails again.Impact
After deployment and a blocksyncer restart, this narrow historical inconsistency no longer blocks synchronization. The affected UDT account update and transaction relationship are intentionally skipped, and the missing
Udtis not fabricated in the sync hot path.This is an emergency tolerance fix. A separate follow-up should backfill and verify the missing historical UDT data.
Validation
test/models/ckb_sync/node_data_processor_test.rb: 119 runs, 207 assertions, 0 failures, 0 errorsgit diff --checkpasses