diff --git a/tools/observer/observer.mjs b/tools/observer/observer.mjs index fd445ef5e..5141e8800 100644 --- a/tools/observer/observer.mjs +++ b/tools/observer/observer.mjs @@ -109,6 +109,9 @@ async function setupSchema() { `ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS proof_records int`, `ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS subsidy_sompi bigint`, `ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS paid_sompi bigint`, + // wei-scale amounts on the Igneum 2.0 chain (8 Oct 2026): widen both in place, a no-op once numeric + `ALTER TABLE ${TB} ALTER COLUMN subsidy_sompi TYPE numeric(40,0)`, + `ALTER TABLE ${TB} ALTER COLUMN paid_sompi TYPE numeric(40,0)`, `ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS selected_parent text`, `ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS number bigint`, `ALTER TABLE ${TB} ADD COLUMN IF NOT EXISTS detail jsonb`, @@ -503,7 +506,8 @@ async function flushBlocks() { const rows = pendingBlocks.splice(0, 200); const cols = ['hash', 'blue_score', 'daa_score', 'timestamp_ms', 'parents', 'parent_hashes', 'is_chain_block', 'vote_key_hash', 'miner_address', 'engine', 'tx_count', 'evm_miner', 'proof_records', 'subsidy_sompi', 'paid_sompi', 'selected_parent', 'detail']; - const cast = { parent_hashes: '::text[]', detail: '::jsonb', subsidy_sompi: '::bigint', paid_sompi: '::bigint' }; + // numeric, not bigint: the Igneum 2.0 chain reports the subsidy and the paid amount in wei (9.52 IGN = 9522644482386090276, past int64; 8 Oct 2026) + const cast = { parent_hashes: '::text[]', detail: '::jsonb', subsidy_sompi: '::numeric', paid_sompi: '::numeric' }; const params = []; const values = []; for (const r of rows) { const ph = [];