Skip to content

Commit

Permalink
Fix code broken by merge (#4679)
Browse files Browse the repository at this point in the history
When merging the two backports (#4194 and #4656) for the broker pallet,
the priority of the changes seems to have been reversed and ended up
with some broken code.

CI doesn't actually run before merging on these release branches so it
merged with broken tests. `release-` branches are protected so it needs
this PR to remove the duplication. Sorry for the noise.
  • Loading branch information
seadanda committed Jun 3, 2024
1 parent 3bbbffa commit bf8632a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
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

0 comments on commit bf8632a

Please sign in to comment.