Skip to content

Conversation

claireclark1
Copy link
Collaborator

Goal

The goal of this PR is to update mocks to have >1 ED so that we can test over and under cases in the future.

Closes #1852

Discussion

  • Only for time-release pallet and capacity pallet
  • Increased from 1 to 10
  • Fixed breaking tests

Checklist

  • Updated Pallet Readme?
  • Updated js/api-augment for Custom RPC APIs?
  • Design doc(s) updated?
  • Unit Tests added?
  • e2e Tests added?
  • Benchmarks added?
  • Spec version incremented?

Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

pallet_balances::GenesisConfig::<Test> {
balances: vec![
(50, 5),
(50, 15),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: balances pallet will not allow accounts to be created with less than ED, now 10 is the minimum.

PalletBalances::can_withdraw(&CHARLIE, 30),
WithdrawConsequence::ReducedToZero(0)
);
assert_eq!(PalletBalances::can_withdraw(&CHARLIE, 29), WithdrawConsequence::Success);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: can_withdraw maxes out at 20 because of 10 ED (30 - ED(10) = 20). The ReducedToZero(0) error validates that the entire balance is available, else the error returned would be WithdrawConsequence:Frozen as in the above cases.

Copy link
Collaborator

@mattheworris mattheworris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pallet Unit Tests concerning Balances: Modify mock.rs to have ED > 1, to test balances less than ED.
2 participants