Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code broken by merge #4679

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions substrate/frame/broker/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use frame_support::{
};
use frame_system::RawOrigin::Root;
use pretty_assertions::assert_eq;
use sp_runtime::{traits::Get, TokenError};
use sp_runtime::{traits::Get, Perbill, TokenError};
use CoreAssignment::*;
use CoretimeTraceItem::*;
use Finality::*;
Expand Down Expand Up @@ -1137,7 +1137,7 @@ fn config_works() {
/// Ensure that a lease that ended before `start_sales` was called can be renewed.
#[test]
fn renewal_works_leases_ended_before_start_sales() {
TestExt::new().endow(1, 1000).execute_with(|| {
TestExt::new().endow(1, 100_000).execute_with(|| {
let config = Configuration::<Test>::get().unwrap();

// This lease is ended before `start_stales` was called.
Expand Down Expand Up @@ -1167,15 +1167,15 @@ fn renewal_works_leases_ended_before_start_sales() {
let new_core = Broker::do_renew(1, 0).unwrap();
// Renewing the active lease doesn't work.
assert_noop!(Broker::do_renew(1, 1), Error::<Test>::SoldOut);
assert_eq!(balance(1), 900);
assert_eq!(balance(1), 99000);

// This intializes the third sale and the period 2.
advance_sale_period();
let new_core = Broker::do_renew(1, new_core).unwrap();

// Renewing the active lease doesn't work.
assert_noop!(Broker::do_renew(1, 0), Error::<Test>::SoldOut);
assert_eq!(balance(1), 800);
assert_eq!(balance(1), 98900);

// All leases should have ended
assert!(Leases::<Test>::get().is_empty());
Expand All @@ -1187,7 +1187,7 @@ fn renewal_works_leases_ended_before_start_sales() {
assert_eq!(0, Broker::do_renew(1, new_core).unwrap());
// Renew the task 2.
assert_eq!(1, Broker::do_renew(1, 0).unwrap());
assert_eq!(balance(1), 600);
assert_eq!(balance(1), 98790);

// This intializes the fifth sale and the period 4.
advance_sale_period();
Expand Down
4 changes: 0 additions & 4 deletions substrate/frame/broker/src/tick_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ impl<T: Config> Pallet<T> {
Workplan::<T>::insert((region_begin, first_core), &schedule);
// Will the lease expire at the end of the period?
let expire = until < region_end;
if expire {
// last time for this one - make it renewable in the next sale.
// Will the lease expire at the end of the period?
let expire = until < region_end;
if expire {
// last time for this one - make it renewable in the next sale.
let renewal_id = AllowedRenewalId { core: first_core, when: region_end };
Expand Down
Loading