11//! Pallet Domains
22
33#![ cfg_attr( not( feature = "std" ) , no_std) ]
4- #![ feature( array_windows, let_chains , variant_count) ]
4+ #![ feature( array_windows, variant_count) ]
55
66#[ cfg( feature = "runtime-benchmarks" ) ]
77mod benchmarking;
@@ -21,13 +21,13 @@ pub mod weights;
2121
2222extern crate alloc;
2323
24- use crate :: block_tree:: { verify_execution_receipt , Error as BlockTreeError } ;
24+ use crate :: block_tree:: { Error as BlockTreeError , verify_execution_receipt } ;
2525use crate :: bundle_storage_fund:: { charge_bundle_storage_fee, storage_fund_account} ;
2626use crate :: domain_registry:: { DomainConfig , Error as DomainRegistryError } ;
2727use crate :: runtime_registry:: into_complete_raw_genesis;
2828#[ cfg( feature = "runtime-benchmarks" ) ]
2929pub use crate :: staking:: do_register_operator;
30- use crate :: staking:: { do_reward_operators , OperatorStatus } ;
30+ use crate :: staking:: { OperatorStatus , do_reward_operators } ;
3131use crate :: staking_epoch:: EpochTransitionResult ;
3232use crate :: weights:: WeightInfo ;
3333#[ cfg( not( feature = "std" ) ) ]
@@ -48,15 +48,15 @@ use frame_system::pallet_prelude::*;
4848pub use pallet:: * ;
4949use parity_scale_codec:: { Decode , Encode , MaxEncodedLen } ;
5050use scale_info:: TypeInfo ;
51- use sp_consensus_subspace:: consensus:: is_proof_of_time_valid;
5251use sp_consensus_subspace:: WrappedPotOutput ;
52+ use sp_consensus_subspace:: consensus:: is_proof_of_time_valid;
5353use sp_core:: H256 ;
5454use sp_domains:: bundle_producer_election:: BundleProducerElectionParams ;
5555use sp_domains:: {
56- ChainId , DomainBundleLimit , DomainId , DomainInstanceData , ExecutionReceipt , OpaqueBundle ,
57- OperatorId , OperatorPublicKey , OperatorRewardSource , OperatorSignature , ProofOfElection ,
58- RuntimeId , SealedSingletonReceipt , DOMAIN_EXTRINSICS_SHUFFLING_SEED_SUBJECT ,
59- EMPTY_EXTRINSIC_ROOT ,
56+ ChainId , DOMAIN_EXTRINSICS_SHUFFLING_SEED_SUBJECT , DomainBundleLimit , DomainId ,
57+ DomainInstanceData , EMPTY_EXTRINSIC_ROOT , ExecutionReceipt , OpaqueBundle , OperatorId ,
58+ OperatorPublicKey , OperatorRewardSource , OperatorSignature , ProofOfElection , RuntimeId ,
59+ SealedSingletonReceipt ,
6060} ;
6161use sp_domains_fraud_proof:: fraud_proof:: {
6262 DomainRuntimeCodeAt , FraudProof , FraudProofVariant , InvalidBlockFeesProof ,
@@ -200,45 +200,46 @@ pub(crate) type StateRootOf<T> = <<T as frame_system::Config>::Hashing as Hash>:
200200#[ expect( clippy:: useless_conversion, reason = "Macro-generated" ) ]
201201#[ frame_support:: pallet]
202202mod pallet {
203+ #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
204+ use crate :: DomainHashingFor ;
205+ #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
206+ use crate :: MAX_NOMINATORS_TO_SLASH ;
203207 #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
204208 use crate :: block_tree:: AcceptedReceiptType ;
205209 use crate :: block_tree:: {
206- execution_receipt_type , process_execution_receipt , prune_receipt , Error as BlockTreeError ,
207- ReceiptType ,
210+ Error as BlockTreeError , ReceiptType , execution_receipt_type , process_execution_receipt ,
211+ prune_receipt ,
208212 } ;
213+ use crate :: bundle_storage_fund:: Error as BundleStorageFundError ;
209214 #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
210215 use crate :: bundle_storage_fund:: refund_storage_fee;
211- use crate :: bundle_storage_fund:: Error as BundleStorageFundError ;
212216 use crate :: domain_registry:: {
213- do_instantiate_domain , do_update_domain_allow_list , DomainConfigParams , DomainObject ,
214- Error as DomainRegistryError ,
217+ DomainConfigParams , DomainObject , Error as DomainRegistryError , do_instantiate_domain ,
218+ do_update_domain_allow_list ,
215219 } ;
216220 use crate :: runtime_registry:: {
221+ DomainRuntimeUpgradeEntry , Error as RuntimeRegistryError , ScheduledRuntimeUpgrade ,
217222 do_register_runtime, do_schedule_runtime_upgrade, do_upgrade_runtimes,
218- register_runtime_at_genesis, DomainRuntimeUpgradeEntry , Error as RuntimeRegistryError ,
219- ScheduledRuntimeUpgrade ,
223+ register_runtime_at_genesis,
220224 } ;
221225 #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
222226 use crate :: staking:: do_reward_operators;
223227 use crate :: staking:: {
224- do_deregister_operator , do_mark_operators_as_slashed , do_nominate_operator ,
225- do_register_operator , do_unlock_funds , do_unlock_nominator , do_withdraw_stake , Deposit ,
226- DomainEpoch , Error as StakingError , Operator , OperatorConfig , SharePrice , StakingSummary ,
227- WithdrawStake , Withdrawal ,
228+ Deposit , DomainEpoch , Error as StakingError , Operator , OperatorConfig , SharePrice ,
229+ StakingSummary , WithdrawStake , Withdrawal , do_deregister_operator ,
230+ do_mark_operators_as_slashed , do_nominate_operator , do_register_operator , do_unlock_funds ,
231+ do_unlock_nominator , do_withdraw_stake ,
228232 } ;
229233 #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
230234 use crate :: staking_epoch:: do_slash_operator;
231- use crate :: staking_epoch:: { do_finalize_domain_current_epoch , Error as StakingEpochError } ;
235+ use crate :: staking_epoch:: { Error as StakingEpochError , do_finalize_domain_current_epoch } ;
232236 use crate :: storage_proof:: InherentExtrinsicData ;
233237 use crate :: weights:: WeightInfo ;
234- #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
235- use crate :: DomainHashingFor ;
236- #[ cfg( not( feature = "runtime-benchmarks" ) ) ]
237- use crate :: MAX_NOMINATORS_TO_SLASH ;
238238 use crate :: {
239239 BalanceOf , BlockSlot , BlockTreeNodeFor , DomainBlockNumberFor , ElectionVerificationParams ,
240- ExecutionReceiptOf , FraudProofFor , HoldIdentifier , NominatorId , OpaqueBundleOf , RawOrigin ,
241- ReceiptHashFor , SingletonReceiptOf , StateRootOf , MAX_BUNDLE_PER_BLOCK , STORAGE_VERSION ,
240+ ExecutionReceiptOf , FraudProofFor , HoldIdentifier , MAX_BUNDLE_PER_BLOCK , NominatorId ,
241+ OpaqueBundleOf , RawOrigin , ReceiptHashFor , STORAGE_VERSION , SingletonReceiptOf ,
242+ StateRootOf ,
242243 } ;
243244 #[ cfg( not( feature = "std" ) ) ]
244245 use alloc:: string:: String ;
@@ -266,11 +267,11 @@ mod pallet {
266267 use sp_domains_fraud_proof:: fraud_proof_runtime_interface:: domain_runtime_call;
267268 use sp_domains_fraud_proof:: storage_proof:: { self , FraudProofStorageKeyProvider } ;
268269 use sp_domains_fraud_proof:: { InvalidTransactionCode , StatelessDomainRuntimeCall } ;
270+ use sp_runtime:: Saturating ;
269271 use sp_runtime:: traits:: {
270272 AtLeast32BitUnsigned , BlockNumberProvider , CheckEqual , CheckedAdd , Header as HeaderT ,
271273 MaybeDisplay , One , SimpleBitOps , Zero ,
272274 } ;
273- use sp_runtime:: Saturating ;
274275 use sp_std:: boxed:: Box ;
275276 use sp_std:: collections:: btree_map:: BTreeMap ;
276277 use sp_std:: collections:: btree_set:: BTreeSet ;
@@ -447,11 +448,7 @@ mod pallet {
447448 type MmrHash : Parameter + Member + Default + Clone ;
448449
449450 /// MMR proof verifier
450- type MmrProofVerifier : MmrProofVerifier <
451- Self :: MmrHash ,
452- BlockNumberFor < Self > ,
453- StateRootOf < Self > ,
454- > ;
451+ type MmrProofVerifier : MmrProofVerifier < Self :: MmrHash , BlockNumberFor < Self > , StateRootOf < Self > > ;
455452
456453 /// Fraud proof storage key provider
457454 type FraudProofStorageKeyProvider : FraudProofStorageKeyProvider < BlockNumberFor < Self > > ;
0 commit comments