Skip to content

Commit

Permalink
Fee Adjustment Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriele-0201 committed Dec 24, 2023
1 parent 5398c0b commit 73dd8bd
Show file tree
Hide file tree
Showing 3 changed files with 620 additions and 33 deletions.
33 changes: 0 additions & 33 deletions sugondat-chain/runtimes/sugondat-kusama/src/fee_adjustment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,37 +225,4 @@ mod tests {
);
});
}

#[test]
fn test_blobs_fee_adjustment_convert() {
use codec::Encode;
use sp_core::twox_128;

for len in (0..MaxBlobSize::get()).into_iter().step_by(100) {
new_test_ext().execute_with(|| {
// AllExtrinsicsLen is a private storage value of the system pallet
// so the key must be manually constructed
sp_io::storage::set(
&[twox_128(b"System"), twox_128(b"AllExtrinsicsLen")].concat(),
&len.encode(),
);

let fee_multiplier = Multiplier::saturating_from_rational(7, 8);

let new_fee_multiplier = BlobsFeeAdjustment::<Runtime>::convert(fee_multiplier);

// fee_multiplier should follow the standard behavior
let expected_fee_multiplier = TargetedFeeAdjustment::<
Runtime,
TargetBlockFullness,
AdjustmentVariableBlockFullness,
MinimumMultiplierBlockFullness,
MaximumMultiplierBlockFullness,
>::convert(fee_multiplier);
assert_eq!(new_fee_multiplier, expected_fee_multiplier);

// TODO: Ensure length multiplier is update properly
});
}
}
}
Loading

0 comments on commit 73dd8bd

Please sign in to comment.