Skip to content

Commit

Permalink
Fix storage meter unit test for fn nested
Browse files Browse the repository at this point in the history
  • Loading branch information
rockbmb committed Dec 14, 2024
1 parent 9804fec commit 376e944
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions substrate/frame/revive/src/storage/meter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,16 @@ mod tests {
}

#[test]
/// Previously, passing a limit of 0 meant unlimited storage for a nested call.
///
/// Now, a limit of 0 means the subcall will not be able to use any storage.
fn nested_zero_limit_requested() {
clear_ext();

let meter = TestMeter::new(&Origin::from_account_id(ALICE), 1_000, 0).unwrap();
assert_eq!(meter.available(), 1_000);
let nested0 = meter.nested(BalanceOf::<Test>::zero());
assert_eq!(nested0.available(), 1_000);
assert_eq!(nested0.available(), 0);
}

#[test]
Expand All @@ -751,7 +754,7 @@ mod tests {
let meter = TestMeter::new(&Origin::from_account_id(ALICE), 1_000, 0).unwrap();
assert_eq!(meter.available(), 1_000);
let nested0 = meter.nested(1_000);
assert_eq!(nested0.available(), 1_000);
assert_eq!(nested0.available(), 985);
}

#[test]
Expand All @@ -761,7 +764,7 @@ mod tests {
let meter = TestMeter::new(&Origin::from_account_id(ALICE), 1_000, 0).unwrap();
assert_eq!(meter.available(), 1_000);
let nested0 = meter.nested(2_000);
assert_eq!(nested0.available(), 1_000);
assert_eq!(nested0.available(), 985);
}

#[test]
Expand Down

0 comments on commit 376e944

Please sign in to comment.