Skip to content

Commit

Permalink
fix: Update Rust Analyzer settings and fix balance setting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Orris committed Jan 30, 2024
1 parent cdf6966 commit 6d503cf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
],
// Set the features to use for cargo commands
"rust-analyzer.cargo.features": [
"frequency-no-relay"
"frequency-no-relay",
"runtime-benchmarks",
"frequency-lint-check"
],
"lldb.launch.preRunCommands": [
"script lldb.debugger.HandleCommand('settings set target.source-map /rustc/{} \"{}/lib/rustlib/src/rust\"'.format(os.popen('rustc --version --verbose').read().split('commit-hash: ')[1].split('\\n')[0].strip(), os.popen('rustc --print sysroot').readline().strip()))"
]
],
"rust-analyzer.diagnostics.useRustcErrorCode": true
}
4 changes: 2 additions & 2 deletions pallets/time-release/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub type Schedule<T> = ReleaseSchedule<BlockNumberFor<T>, BalanceOf<T>>;
const SEED: u32 = 0;

fn set_balance<T: Config>(who: &T::AccountId, balance: BalanceOf<T>) {
let actual_deposit = T::Currency::mint_into(&who, balance.saturated_into());
assert_eq!(balance, actual_deposit.unwrap());
let actual_deposit = T::Currency::set_balance(&who, balance.saturated_into());
assert_eq!(balance, actual_deposit);
}

fn lookup_of_account<T: Config>(
Expand Down
2 changes: 1 addition & 1 deletion pallets/time-release/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl BlockNumberProvider for MockBlockNumberProvider {
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type Currency = PalletBalances;
type MinReleaseTransfer = ConstU64<5>;
type MinReleaseTransfer = ConstU64<0>;
type TransferOrigin = EnsureAliceOrBob;
type WeightInfo = ();
type MaxReleaseSchedules = ConstU32<50>;
Expand Down
2 changes: 1 addition & 1 deletion pallets/time-release/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ fn transfer_check_for_min() {
ReleaseSchedule { start: 1u32, period: 1u32, period_count: 1u32, per_period: 3u64 };
assert_noop!(
TimeRelease::transfer(RuntimeOrigin::signed(BOB), ALICE, schedule),
Error::<Test>::AmountLow
TokenError::FundsUnavailable
);
});
}
Expand Down

0 comments on commit 6d503cf

Please sign in to comment.