Skip to content

[explorer/puller] fix: widen symbol_blocks.total_fee to bigint to avoid overflow#2389

Merged
daoka merged 1 commit into
devfrom
explorer/backend/symbol-block-total-fee-overflow-fix
Jul 10, 2026
Merged

[explorer/puller] fix: widen symbol_blocks.total_fee to bigint to avoid overflow#2389
daoka merged 1 commit into
devfrom
explorer/backend/symbol-block-total-fee-overflow-fix

Conversation

@daoka

@daoka daoka commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Problem

symbol_blocks.total_fee was defined as int (PostgreSQL integer, max ~2.1B). Live-node validation against testnet (https://401-sai-dual.symboltest.net:3001) found a real block (height 6224) with totalFee = 13199992608, which exceeds that range and made upsert_blocks fail with psycopg2.errors.NumericValueOutOfRange.

total_fee sums fees across every transaction in a block, so unlike per-transaction fee fields it can plausibly exceed int4 on a block with many/large-fee transactions.

Solution

Widen total_fee to bigint, matching the existing difficulty/total_voting_balance columns.

Test plan

  • test_create_tables_creates_symbol_block_columns_and_constraints updated to expect int8
  • New regression test test_can_upsert_block_when_total_fee_exceeds_int4, using the real observed value (height 6224, 13199992608)
  • cd explorer/puller && PYTHONPATH=.:.. python -m pytest tests/ -v — 231 passed
  • bash scripts/ci/lint.sh — 10.00/10
  • 100% patch coverage on changed lines

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.15%. Comparing base (663f4b9) to head (5c13f26).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #2389   +/-   ##
=======================================
  Coverage   97.15%   97.15%           
=======================================
  Files         289      289           
  Lines       22381    22381           
  Branches      206      206           
=======================================
  Hits        21744    21744           
  Misses        631      631           
  Partials        6        6           
Flag Coverage Δ
explorer-puller 99.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
explorer/puller/puller/db/SymbolDatabase.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@daoka daoka requested review from Jaguar0625 and Wayonb July 9, 2026 23:34
…id overflow

Live-node validation against testnet found a block (height 6224) with
totalFee=13199992608, which exceeds PostgreSQL int4's ~2.1B range and
made upsert_blocks fail with NumericValueOutOfRange. total_fee sums
fees across every transaction in a block, so unlike per-transaction
fee fields it can plausibly exceed int4 on a busy block.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@daoka daoka force-pushed the explorer/backend/symbol-block-total-fee-overflow-fix branch from 65298d8 to 5c13f26 Compare July 10, 2026 00:26

@Jaguar0625 Jaguar0625 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@daoka daoka merged commit e882c42 into dev Jul 10, 2026
25 checks passed
@daoka daoka deleted the explorer/backend/symbol-block-total-fee-overflow-fix branch July 10, 2026 14:53
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.

2 participants