Skip to content

HOTFIX: Prevent missing UDT records from stopping block sync - #2942

Merged
jiangxianliang007 merged 1 commit into
nervosnetwork:developfrom
eval-exec:hotfix
Aug 16, 2026
Merged

jiangxianliang007 merged 1 commit into
nervosnetwork:developfrom
eval-exec:hotfix

Conversation

@eval-exec

Copy link
Copy Markdown
Contributor

Summary

  • Replace both strict Udt lookups in update_or_create_udt_accounts! with non-raising lookups.
  • Log the missing CellOutput, cell type, type hash, and expected UDT type, then skip only that UDT account update.
  • Filter missing UDT IDs before writing UdtTransaction relationships.
  • Add a full process_block regression test for a consumed historical xUDT whose Udt row is missing.

Root cause

Explorer contains a historical CellOutput classified as xudt without a matching Udt row. When block 20,169,277 consumes that output, update_or_create_udt_accounts! calls take!, raises ActiveRecord::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 Udt is 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

  • Production-path regression: 1 run, 4 assertions, 0 failures, 0 errors
  • test/models/ckb_sync/node_data_processor_test.rb: 119 runs, 207 assertions, 0 failures, 0 errors
  • Ruby syntax checks pass for both changed files
  • git diff --check passes

@eval-exec
eval-exec marked this pull request as ready for review August 16, 2026 04:11
Copilot AI lite review requested due to automatic review settings August 16, 2026 04:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Udt lookups in update_or_create_udt_accounts! with non-raising lookups and skip only the affected update while logging details.
  • Filter out missing (nil) UDT IDs before writing UdtTransaction relationships to avoid persisting invalid associations.
  • Add a regression test ensuring process_block completes and marks the historical output as dead even when the consumed xUDT’s Udt row 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.

@eval-exec eval-exec changed the title Prevent missing UDT records from stopping block sync HOTFIX: Prevent missing UDT records from stopping block sync Aug 16, 2026
@jiangxianliang007
jiangxianliang007 self-requested a review August 16, 2026 04:21
@jiangxianliang007
jiangxianliang007 merged commit fe06b91 into nervosnetwork:develop Aug 16, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants