Skip to content

Commit 2521ad6

Browse files
AIQnetLabclaude
andcommitted
emission: fail-safe warning when reward TX nears the 80MB block cap
Per-recipient accruals in the emission TX grow O(eligible). Log the TX size and warn at 50% of MAX_BLOCK_SIZE_BYTES so reward distribution is migrated to a merkle-root + claim model before the artifact can threaten block inclusion. Producer-side observability only — no consensus or crediting change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 750587a commit 2521ad6

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

  • development/qnet-integration/src

development/qnet-integration/src/node.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17876,15 +17876,27 @@ impl BlockchainNode {
1787617876

1787717877
// Serialize TX
1787817878
if let Ok(tx_bytes) = bincode::serialize(&emission_tx) {
17879+
let tx_sz = tx_bytes.len();
1787917880
emission_tx_opt = Some((emission_tx.hash.clone(), tx_bytes));
17880-
17881+
17882+
// Scale fail-safe: per-recipient accruals grow O(eligible) and the
17883+
// emission TX MUST fit in one block (MAX_BLOCK_SIZE_BYTES = 80MB).
17884+
// Warn well before that so reward distribution is migrated to a
17885+
// merkle-root + claim model before the artifact can block inclusion.
17886+
const EMISSION_TX_WARN_BYTES: usize = 40_000_000; // 50% of the 80MB block cap
17887+
if tx_sz > EMISSION_TX_WARN_BYTES {
17888+
println!("[WARN][EMISSION] tx_size={}MB eligible={} approaching 80MB block cap — migrate reward distribution to merkle/claim before this scale",
17889+
tx_sz / 1_000_000, total_eligible_count);
17890+
}
17891+
1788117892
if is_info() {
17882-
println!("[INFO][EMISSION] tx_created block={} mb={} amount={} QNC eligible={} (super={} light={}) hash={}",
17893+
println!("[INFO][EMISSION] tx_created block={} mb={} amount={} QNC eligible={} (super={} light={}) size={}KB hash={}",
1788317894
next_block_height, prev_macroblock_index,
1788417895
total_emission / 1_000_000_000,
1788517896
total_eligible_count,
1788617897
eligible_full_super_count,
1788717898
eligible_light_count,
17899+
tx_sz / 1000,
1788817900
&emission_tx.hash[..16.min(emission_tx.hash.len())]);
1788917901
}
1789017902
} else {

0 commit comments

Comments
 (0)