iuna

iuna

iuna - experimental mainnet-candidate protocol
git clone https://getiuna.org/git/iuna.git
Log | Files | Refs | README | LICENSE

commit ed480eea0d5dd63b3596aa592884d62e1c9e5b9a
parent e813905c1e59385f3a4545c20bfa81b129db36ab
Author: Joris Hartog <jorishartog@hotmail.com>
Date:   Wed,  9 Sep 2026 23:36:49 +0200

fix(tests): keep adversarial difficulty cache consistent

Diffstat:
Msrc/domain/adversarial_tests.rs | 12+++++++++---
Msrc/domain/ledger_pending.rs | 7++++++-
2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/domain/adversarial_tests.rs b/src/domain/adversarial_tests.rs @@ -183,6 +183,7 @@ impl Harness { ); let mut ledger = Ledger::new_with_genesis_burns(allocations, genesis_burns, 1).unwrap(); ledger.launch_profile.mine_difficulty_bits = 0; + ledger.mine_difficulty_windows[0] = 0; let wallets = all_wallets .into_iter() @@ -2307,9 +2308,14 @@ fn check_committee_selection(seed: u64, lineage_idx: usize) -> TestCaseResult { let committee = harness.ledger.burn_committee_for_next_block(); let mini_committee = mini_burn_committee_for_next_block(&harness.ledger) .expect("mini committee oracle should replay generated lineage"); - let snapshot_committee = Ledger::from_snapshot_at(harness.ledger.snapshot(), NOW_MS) - .unwrap() - .burn_committee_for_next_block(); + let snapshot_ledger = Ledger::from_snapshot_at(harness.ledger.snapshot(), NOW_MS); + prop_assert!( + snapshot_ledger.is_ok(), + "seed={} snapshot replay failed: {}", + seed, + snapshot_ledger.as_ref().err().unwrap() + ); + let snapshot_committee = snapshot_ledger.unwrap().burn_committee_for_next_block(); prop_assert_eq!( committee.clone(), diff --git a/src/domain/ledger_pending.rs b/src/domain/ledger_pending.rs @@ -464,7 +464,12 @@ impl Ledger { let required_difficulty = self.mine_difficulty_bits_for_anchor_height(anchor_block.height); if *difficulty_bits != required_difficulty { - bail!("mine transaction difficulty is invalid"); + bail!( + "mine transaction difficulty is invalid: got {}, required {} at anchor height {}", + difficulty_bits, + required_difficulty, + anchor_block.height + ); } } }