merge new functionality which will be used for benchmarking purposes
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
		
						commit
						186fb58367
					
				| @ -1,6 +1,6 @@ | |||||||
| [package] | [package] | ||||||
| name = "ghost-networks" | name = "ghost-networks" | ||||||
| version = "0.1.4" | version = "0.1.5" | ||||||
| license.workspace = true | license.workspace = true | ||||||
| authors.workspace = true | authors.workspace = true | ||||||
| edition.workspace = true | edition.workspace = true | ||||||
|  | |||||||
| @ -697,4 +697,13 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T | |||||||
|     fn nullify_commission() { |     fn nullify_commission() { | ||||||
|         AccumulatedCommission::<T>::set(Default::default()); |         AccumulatedCommission::<T>::set(Default::default()); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     fn trigger_nullification() { | ||||||
|  |         if NullifyNeeded::<T>::get() { | ||||||
|  |             Self::nullify_commission(); | ||||||
|  |             NullifyNeeded::<T>::put(false); | ||||||
|  |         } else { | ||||||
|  |             NullifyNeeded::<T>::put(true); | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -935,3 +935,15 @@ fn bridged_inflation_era_payout_triggers_need_of_nullification() { | |||||||
|             assert_eq!(NullifyNeeded::<Test>::get(), false); |             assert_eq!(NullifyNeeded::<Test>::get(), false); | ||||||
|         }); |         }); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | #[test] | ||||||
|  | fn trigger_nullification_works_as_expected() { | ||||||
|  |     ExtBuilder::build() | ||||||
|  |         .execute_with(|| { | ||||||
|  |             assert_eq!(NullifyNeeded::<Test>::get(), false); | ||||||
|  |             GhostNetworks::trigger_nullification(); | ||||||
|  |             assert_eq!(NullifyNeeded::<Test>::get(), true); | ||||||
|  |             GhostNetworks::trigger_nullification(); | ||||||
|  |             assert_eq!(NullifyNeeded::<Test>::get(), false); | ||||||
|  |         }); | ||||||
|  | } | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| [package] | [package] | ||||||
| name = "ghost-traits" | name = "ghost-traits" | ||||||
| version = "0.3.20" | version = "0.3.21" | ||||||
| license.workspace = true | license.workspace = true | ||||||
| authors.workspace = true | authors.workspace = true | ||||||
| edition.workspace = true | edition.workspace = true | ||||||
|  | |||||||
| @ -38,4 +38,5 @@ pub trait NetworkDataMutateHandler<Network, Balance>: NetworkDataInspectHandler< | |||||||
|     ) -> Result<(Balance, Balance), ()>; |     ) -> Result<(Balance, Balance), ()>; | ||||||
|     fn accumulate_commission(commission: &Balance) -> Result<Balance, ()>; |     fn accumulate_commission(commission: &Balance) -> Result<Balance, ()>; | ||||||
|     fn nullify_commission(); |     fn nullify_commission(); | ||||||
|  |     fn trigger_nullification(); | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user