[explorer/puller] fix: widen symbol_blocks.total_fee to bigint to avoid overflow#2389
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…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>
65298d8 to
5c13f26
Compare
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.
Problem
symbol_blocks.total_feewas defined asint(PostgreSQLinteger, max ~2.1B). Live-node validation against testnet (https://401-sai-dual.symboltest.net:3001) found a real block (height 6224) withtotalFee = 13199992608, which exceeds that range and madeupsert_blocksfail withpsycopg2.errors.NumericValueOutOfRange.total_feesums fees across every transaction in a block, so unlike per-transaction fee fields it can plausibly exceedint4on a block with many/large-fee transactions.Solution
Widen
total_feetobigint, matching the existingdifficulty/total_voting_balancecolumns.Test plan
test_create_tables_creates_symbol_block_columns_and_constraintsupdated to expectint8test_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 passedbash scripts/ci/lint.sh— 10.00/10