diff --git a/distance-oracle/src/lib.rs b/distance-oracle/src/lib.rs index e88782ed4e356d34501c7136c349efa23a576166..8d0425134685f797fdfd05658e893c94af2a65c4 100644 --- a/distance-oracle/src/lib.rs +++ b/distance-oracle/src/lib.rs @@ -40,15 +40,15 @@ pub mod runtime {} pub enum RuntimeConfig {} impl subxt::config::Config for RuntimeConfig { - type Hash = sp_core::H256; - type Hasher = subxt::config::substrate::BlakeTwo256; type AccountId = AccountId; type Address = subxt::ext::sp_runtime::MultiAddress<Self::AccountId, u32>; + type AssetId = (); + type ExtrinsicParams = subxt::config::substrate::SubstrateExtrinsicParams<Self>; + type Hash = sp_core::H256; + type Hasher = subxt::config::substrate::BlakeTwo256; type Header = subxt::config::substrate::SubstrateHeader<u32, subxt::config::substrate::BlakeTwo256>; type Signature = subxt::ext::sp_runtime::MultiSignature; - type ExtrinsicParams = subxt::config::substrate::SubstrateExtrinsicParams<Self>; - type AssetId = (); } #[derive(Copy, Clone, Debug, Default, Encode)] diff --git a/end2end-tests/tests/common/mod.rs b/end2end-tests/tests/common/mod.rs index 7f1eca64ecf95ba585bad962b56cd41643690b50..6b65e5ec757f6ba4085b04223ac4c7f1b62d4c2f 100644 --- a/end2end-tests/tests/common/mod.rs +++ b/end2end-tests/tests/common/mod.rs @@ -52,15 +52,15 @@ pub type TxProgress = subxt::tx::TxProgress<GdevConfig, Client>; pub enum GdevConfig {} impl subxt::config::Config for GdevConfig { - type Hash = sp_core::H256; type AccountId = subxt::utils::AccountId32; type Address = sp_runtime::MultiAddress<Self::AccountId, u32>; - type Hasher = subxt::config::substrate::BlakeTwo256; - type Signature = sp_runtime::MultiSignature; + type AssetId = (); type ExtrinsicParams = SubstrateExtrinsicParams<Self>; + type Hash = sp_core::H256; + type Hasher = subxt::config::substrate::BlakeTwo256; type Header = subxt::config::substrate::SubstrateHeader<u32, subxt::config::substrate::BlakeTwo256>; - type AssetId = (); + type Signature = sp_runtime::MultiSignature; } #[derive(Copy, Clone, Debug, Default, Encode)] diff --git a/end2end-tests/tests/cucumber_tests.rs b/end2end-tests/tests/cucumber_tests.rs index 7fbacf2dfe656ec958b8a92ac59fe29c3d6e7fe8..3b1d5fe9fa7328b01fa1f0baeaa2eb5022785241 100644 --- a/end2end-tests/tests/cucumber_tests.rs +++ b/end2end-tests/tests/cucumber_tests.rs @@ -45,14 +45,17 @@ impl DuniterWorld { } self.inner = Some(DuniterWorldInner::new(maybe_genesis_conf_file, no_spawn).await); } + fn kill(&mut self) { if let Some(ref mut inner) = self.inner { inner.kill(); } } + fn set_ignore_errors(&mut self, ignore_errors: bool) { self.ignore_errors = ignore_errors; } + // Read methods fn rpc_client(&self) -> &RpcClient { if let Some(ref inner) = self.inner { @@ -61,6 +64,7 @@ impl DuniterWorld { panic!("uninit") } } + fn client(&self) -> &Client { if let Some(ref inner) = self.inner { &inner.client.client @@ -68,6 +72,7 @@ impl DuniterWorld { panic!("uninit") } } + fn full_client(&self) -> &FullClient { if let Some(ref inner) = self.inner { &inner.client @@ -75,10 +80,12 @@ impl DuniterWorld { panic!("uninit") } } + // Read methods fn ignore_errors(&self) -> bool { self.ignore_errors } + // Read storage entry on last block async fn read<'a, Address>( &self, @@ -96,6 +103,7 @@ impl DuniterWorld { .unwrap() .fetch(address) } + // Read storage entry with default value (on last block) async fn read_or_default<'a, Address>( &self, @@ -150,6 +158,7 @@ impl DuniterWorldInner { ws_port, } } + fn kill(&mut self) { if let Some(p) = &mut self.process { p.kill(); diff --git a/node/src/service/client.rs b/node/src/service/client.rs index 72c9edbcfdbf0bf3624b6c2500c55011b92dbf70..76a1b4718e175375c5faea3b5522be0ec167165b 100644 --- a/node/src/service/client.rs +++ b/node/src/service/client.rs @@ -376,9 +376,11 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for Client { fn pallet(&self) -> &str { "system" } + fn extrinsic(&self) -> &str { "remark" } + fn build(&self, nonce: u32) -> std::result::Result<sp_runtime::OpaqueExtrinsic, &'static str> { with_client! { self, client, { @@ -398,6 +400,7 @@ impl sp_blockchain::HeaderBackend<Block> for Client { fn header(&self, hash: Hash) -> sp_blockchain::Result<Option<Header>> { match_client!(self, header(hash)) } + fn info(&self) -> sp_blockchain::Info<Block> { match_client!(self, info()) } @@ -486,6 +489,7 @@ impl sc_client_api::StorageProvider<Block, super::FullBackend> for Client { ) -> sp_blockchain::Result<Option<<Block as BlockT>::Hash>> { match_client!(self, child_storage_hash(hash, child_info, key)) } + fn closest_merkle_value( &self, hash: <Block as BlockT>::Hash, diff --git a/pallets/authority-members/src/lib.rs b/pallets/authority-members/src/lib.rs index 28c6274269deb5a54310380f4ada8cdcbf91a85b..963a180b59a92982758d71828484d7b7eabdb657 100644 --- a/pallets/authority-members/src/lib.rs +++ b/pallets/authority-members/src/lib.rs @@ -232,6 +232,7 @@ pub mod pallet { Ok(().into()) } + /// ask to join the set of validators two sessions after #[pallet::call_index(1)] #[pallet::weight(<T as pallet::Config>::WeightInfo::go_online())] @@ -290,6 +291,7 @@ pub mod pallet { Ok(().into()) } + /// remove an identity from the set of authorities #[pallet::call_index(3)] #[pallet::weight(<T as pallet::Config>::WeightInfo::remove_member())] @@ -304,6 +306,7 @@ pub mod pallet { Ok(().into()) } + #[pallet::call_index(4)] #[pallet::weight(<T as pallet::Config>::WeightInfo::remove_member_from_blacklist())] /// remove an identity from the blacklist @@ -403,6 +406,7 @@ pub mod pallet { // Emit event Self::deposit_event(Event::MemberRemoved { member: member_id }); } + /// perform incoming authorities insertion fn insert_in(member_id: T::MemberId) -> bool { let not_already_inserted = IncomingAuthorities::<T>::mutate(|members_ids| { @@ -418,6 +422,7 @@ pub mod pallet { } not_already_inserted } + /// perform outgoing authority insertion pub fn insert_out(member_id: T::MemberId) -> bool { let not_already_inserted = OutgoingAuthorities::<T>::mutate(|members_ids| { @@ -433,28 +438,33 @@ pub mod pallet { } not_already_inserted } + /// check if member is incoming fn is_incoming(member_id: T::MemberId) -> bool { IncomingAuthorities::<T>::get() .binary_search(&member_id) .is_ok() } + /// check if member is online fn is_online(member_id: T::MemberId) -> bool { OnlineAuthorities::<T>::get() .binary_search(&member_id) .is_ok() } + /// check if member is outgoing fn is_outgoing(member_id: T::MemberId) -> bool { OutgoingAuthorities::<T>::get() .binary_search(&member_id) .is_ok() } + /// check if member is blacklisted fn is_blacklisted(member_id: T::MemberId) -> bool { Blacklist::<T>::get().contains(&member_id) } + /// perform removal from incoming authorities fn remove_in(member_id: T::MemberId) { IncomingAuthorities::<T>::mutate(|members_ids| { @@ -463,6 +473,7 @@ pub mod pallet { } }) } + /// perform removal from online authorities fn remove_online(member_id: T::MemberId) { OnlineAuthorities::<T>::mutate(|members_ids| { @@ -471,6 +482,7 @@ pub mod pallet { } }); } + /// perform removal from outgoing authorities fn remove_out(member_id: T::MemberId) { OutgoingAuthorities::<T>::mutate(|members_ids| { @@ -479,6 +491,7 @@ pub mod pallet { } }); } + /// check that accountid is member fn verify_ownership_and_membership( who: &T::AccountId, @@ -557,6 +570,7 @@ impl<T: Config> pallet_session::SessionManager<T::ValidatorId> for Pallet<T> { .collect(), ) } + /// Same as `new_session`, but it this should only be called at genesis. fn new_session_genesis(_new_index: SessionIndex) -> Option<Vec<T::ValidatorId>> { Some( @@ -572,11 +586,13 @@ impl<T: Config> pallet_session::SessionManager<T::ValidatorId> for Pallet<T> { .collect(), ) } + /// End the session. /// /// Because the session pallet can queue validator set the ending session can be lower than the /// last new session index. fn end_session(_end_index: SessionIndex) {} + /// Start an already planned session. /// /// The session start to be used for validation. @@ -608,6 +624,7 @@ impl<T: Config> pallet_session::historical::SessionManager<T::ValidatorId, T::Fu .collect() }) } + fn new_session_genesis( new_index: SessionIndex, ) -> Option<sp_std::vec::Vec<(T::ValidatorId, T::FullIdentification)>> { @@ -620,9 +637,11 @@ impl<T: Config> pallet_session::historical::SessionManager<T::ValidatorId, T::Fu }, ) } + fn start_session(start_index: SessionIndex) { <Self as pallet_session::SessionManager<_>>::start_session(start_index) } + fn end_session(end_index: SessionIndex) { <Self as pallet_session::SessionManager<_>>::end_session(end_index) } diff --git a/pallets/authority-members/src/mock.rs b/pallets/authority-members/src/mock.rs index a6ad3be6b4125b041561add5c94e7c28015dabc2..f4d412df500eacbd3f611a7d28f574f92e3c77a3 100644 --- a/pallets/authority-members/src/mock.rs +++ b/pallets/authority-members/src/mock.rs @@ -63,30 +63,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = (); + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } pub struct TestSessionHandler; @@ -114,14 +114,14 @@ impl ShouldEndSession<u64> for TestShouldEndSession { } impl pallet_session::Config for Test { + type Keys = MockSessionKeys; + type NextSessionRotation = (); type RuntimeEvent = RuntimeEvent; + type SessionHandler = TestSessionHandler; + type SessionManager = AuthorityMembers; + type ShouldEndSession = TestShouldEndSession; type ValidatorId = u64; type ValidatorIdOf = ConvertInto; - type ShouldEndSession = TestShouldEndSession; - type NextSessionRotation = (); - type SessionManager = AuthorityMembers; - type SessionHandler = TestSessionHandler; - type Keys = MockSessionKeys; type WeightInfo = (); } @@ -148,12 +148,12 @@ impl pallet_authority_members::Config for Test { type MaxAuthorities = ConstU32<4>; type MemberId = u64; type MemberIdOf = ConvertInto; + type OnIncomingMember = (); type OnNewSession = (); + type OnOutgoingMember = (); type RemoveMemberOrigin = system::EnsureRoot<u64>; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); - type OnIncomingMember = (); - type OnOutgoingMember = (); } // Build genesis storage according to the mock runtime. diff --git a/pallets/authority-members/src/weights.rs b/pallets/authority-members/src/weights.rs index f4160f078ea244501f2cba30c0a7e04695eee4ca..5a32bf50f759048bbfb13a032872e35ec863f0a2 100644 --- a/pallets/authority-members/src/weights.rs +++ b/pallets/authority-members/src/weights.rs @@ -42,6 +42,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(7 as u64)) .saturating_add(RocksDbWeight::get().writes(2 as u64)) } + // Storage: Identity IdentityIndexOf (r:1 w:0) // Storage: SmithMembership Membership (r:1 w:0) // Storage: AuthorityMembers Members (r:1 w:0) @@ -56,6 +57,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(8 as u64)) .saturating_add(RocksDbWeight::get().writes(2 as u64)) } + // Storage: Identity IdentityIndexOf (r:1 w:0) // Storage: SmithMembership Membership (r:1 w:0) // Storage: System Account (r:1 w:0) @@ -70,6 +72,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(11 as u64)) .saturating_add(RocksDbWeight::get().writes(3 as u64)) } + // Storage: AuthorityMembers Members (r:1 w:1) // Storage: AuthorityMembers OnlineAuthorities (r:1 w:1) // Storage: AuthorityMembers OutgoingAuthorities (r:1 w:1) @@ -86,6 +89,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(9 as u64)) .saturating_add(RocksDbWeight::get().writes(13 as u64)) } + // Storage: AuthorityMembers BlackList (r:1 w:1) fn remove_member_from_blacklist() -> Weight { // Minimum execution time: 60_023 nanoseconds. diff --git a/pallets/certification/src/mock.rs b/pallets/certification/src/mock.rs index 033800b34b91468f25a77e53784ab92a3f34d6a0..4cbd9aa6afa063ef747b722134c5973d1cb85c51 100644 --- a/pallets/certification/src/mock.rs +++ b/pallets/certification/src/mock.rs @@ -44,30 +44,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = (); + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } parameter_types! { @@ -79,16 +79,16 @@ parameter_types! { impl pallet_certification::Config for Test { type CertPeriod = CertPeriod; - type IdtyIndex = IdtyIndex; - type OwnerKeyOf = sp_runtime::traits::ConvertInto; type CheckCertAllowed = (); + type IdtyIndex = IdtyIndex; type MaxByIssuer = MaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type OnNewcert = (); type OnRemovedCert = (); + type OwnerKeyOf = sp_runtime::traits::ConvertInto; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); type ValidityPeriod = ValidityPeriod; + type WeightInfo = (); } // Build genesis storage according to the mock runtime. diff --git a/pallets/certification/src/weights.rs b/pallets/certification/src/weights.rs index 1f5918b2a6abdad08e259e4448dd7368db486774..4a1a02f423cd53d8e86944b369030c344e0b7d48 100644 --- a/pallets/certification/src/weights.rs +++ b/pallets/certification/src/weights.rs @@ -41,6 +41,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(7 as u64)) .saturating_add(RocksDbWeight::get().writes(4 as u64)) } + // Storage: Cert CertsByReceiver (r:1 w:1) // Storage: Cert StorageIdtyCertMeta (r:2 w:2) // Storage: Parameters ParametersStorage (r:1 w:0) @@ -51,6 +52,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(5 as u64)) .saturating_add(RocksDbWeight::get().writes(3 as u64)) } + // Storage: Cert CertsByReceiver (r:1 w:1) // Storage: Cert StorageIdtyCertMeta (r:2 w:2) // Storage: Parameters ParametersStorage (r:1 w:0) @@ -66,18 +68,21 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(1 as u64)) .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } + fn on_initialize() -> Weight { // Minimum execution time: 259_247 nanoseconds. Weight::from_parts(269_348_000 as u64, 0) .saturating_add(RocksDbWeight::get().reads(7 as u64)) .saturating_add(RocksDbWeight::get().writes(4 as u64)) } + fn do_remove_cert_noop() -> Weight { // Minimum execution time: 259_247 nanoseconds. Weight::from_parts(269_348_000 as u64, 0) .saturating_add(RocksDbWeight::get().reads(7 as u64)) .saturating_add(RocksDbWeight::get().writes(4 as u64)) } + fn do_remove_cert() -> Weight { // Minimum execution time: 259_247 nanoseconds. Weight::from_parts(269_348_000 as u64, 0) diff --git a/pallets/distance/src/lib.rs b/pallets/distance/src/lib.rs index 1790134a02e738b41eb2588b7b39b77e9131fc02..ddcff521833871062ddab62fe08951f7d37705c1 100644 --- a/pallets/distance/src/lib.rs +++ b/pallets/distance/src/lib.rs @@ -332,6 +332,7 @@ pub mod pallet { _ => unreachable!("index % 3 < 3"), } } + /// Mutate the evaluation pool containing the results sent by evaluators on this session. fn mutate_next_pool< R, @@ -581,6 +582,7 @@ pub mod pallet { computation_result: inherent_data, }) } + fn is_inherent(call: &Self::Call) -> bool { matches!(call, Self::Call::update_evaluation { .. }) } diff --git a/pallets/distance/src/mock.rs b/pallets/distance/src/mock.rs index d56212bd7e0d04e360c98cbc05c01877c5cfce35..c95da08752eb25e07acb39bd2fe6ce8980738b21 100644 --- a/pallets/distance/src/mock.rs +++ b/pallets/distance/src/mock.rs @@ -69,30 +69,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = AccountData<u64>; + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = AccountData<u64>; - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } pub struct TestSessionHandler; @@ -120,14 +120,14 @@ impl ShouldEndSession<u64> for TestShouldEndSession { } impl pallet_session::Config for Test { + type Keys = MockSessionKeys; + type NextSessionRotation = (); type RuntimeEvent = RuntimeEvent; + type SessionHandler = TestSessionHandler; + type SessionManager = AuthorityMembers; + type ShouldEndSession = TestShouldEndSession; type ValidatorId = AccountId; type ValidatorIdOf = ConvertInto; - type ShouldEndSession = TestShouldEndSession; - type NextSessionRotation = (); - type SessionManager = AuthorityMembers; - type SessionHandler = TestSessionHandler; - type Keys = MockSessionKeys; type WeightInfo = (); } @@ -154,8 +154,8 @@ impl<T: From<u64>> frame_support::traits::FindAuthor<T> for ConstantAuthor<T> { } impl pallet_authorship::Config for Test { - type FindAuthor = ConstantAuthor<Self::AccountId>; type EventHandler = (); + type FindAuthor = ConstantAuthor<Self::AccountId>; } pub struct TestIsSmithMember; @@ -180,12 +180,12 @@ impl pallet_authority_members::Config for Test { type MaxAuthorities = ConstU32<4>; type MemberId = u32; type MemberIdOf = IdentityIndexOf<Self>; + type OnIncomingMember = (); type OnNewSession = (); + type OnOutgoingMember = (); type RemoveMemberOrigin = system::EnsureRoot<AccountId>; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); - type OnOutgoingMember = (); - type OnIncomingMember = (); } parameter_types! { @@ -194,20 +194,20 @@ parameter_types! { } impl pallet_balances::Config for Test { + type AccountStore = System; type Balance = Balance; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; + type MaxHolds = ConstU32<0>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type RuntimeEvent = RuntimeEvent; - type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; - type MaxFreezes = ConstU32<0>; - type RuntimeHoldReason = (); type RuntimeFreezeReason = (); + type RuntimeHoldReason = (); + type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; } parameter_types! { @@ -227,21 +227,21 @@ impl pallet_identity::traits::IdtyNameValidator for IdtyNameValidatorTestImpl { } impl pallet_identity::Config for Test { + type AccountLinker = (); + type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckIdtyCallAllowed = (); type ConfirmPeriod = ConfirmPeriod; - type ValidationPeriod = ValidationPeriod; - type AutorevocationPeriod = AutorevocationPeriod; type DeletionPeriod = DeletionPeriod; - type CheckIdtyCallAllowed = (); type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = (); - type IdtyNameValidator = IdtyNameValidatorTestImpl; type IdtyIndex = u32; - type AccountLinker = (); - type Signer = UintAuthorityId; - type Signature = TestSignature; + type IdtyNameValidator = IdtyNameValidatorTestImpl; type OnIdtyChange = (); type RuntimeEvent = RuntimeEvent; + type Signature = TestSignature; + type Signer = UintAuthorityId; + type ValidationPeriod = ValidationPeriod; type WeightInfo = (); } @@ -249,14 +249,14 @@ parameter_types! { pub const MinAccessibleReferees: Perbill = Perbill::from_percent(80); } impl pallet_distance::Config for Test { + type CheckRequestDistanceEvaluation = (); type Currency = Balances; type EvaluationPrice = frame_support::traits::ConstU64<1000>; type MaxRefereeDistance = frame_support::traits::ConstU32<5>; type MinAccessibleReferees = MinAccessibleReferees; + type OnValidDistanceStatus = (); type RuntimeEvent = RuntimeEvent; type WeightInfo = (); - type OnValidDistanceStatus = (); - type CheckRequestDistanceEvaluation = (); } // Build genesis storage according to the mock runtime. diff --git a/pallets/duniter-account/src/weights.rs b/pallets/duniter-account/src/weights.rs index 212eb7fe4f6fe00e35abbc052926e6b1fa2a3ce7..d8ccf6bb58cbb363ba0c5a885bdc9f008b06295d 100644 --- a/pallets/duniter-account/src/weights.rs +++ b/pallets/duniter-account/src/weights.rs @@ -41,6 +41,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 3591)) .saturating_add(RocksDbWeight::get().reads(1)) } + // Storage: Account PendingNewAccounts (r:1 w:0) // Storage: ProvideRandomness RequestIdProvider (r:1 w:1) // Storage: ProvideRandomness RequestsIds (r:1 w:1) @@ -59,6 +60,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads((6 as u64).saturating_mul(i as u64))) .saturating_add(RocksDbWeight::get().writes((6 as u64).saturating_mul(i as u64))) } + // Storage: Account PendingNewAccounts (r:1 w:0) // Storage: ProvideRandomness RequestIdProvider (r:1 w:1) // Storage: ProvideRandomness RequestsIds (r:1 w:1) @@ -77,6 +79,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads((6 as u64).saturating_mul(i as u64))) .saturating_add(RocksDbWeight::get().writes((6 as u64).saturating_mul(i as u64))) } + // Storage: Account PendingNewAccounts (r:1 w:0) /// The range of component `i` is `[0, 1]`. fn on_initialize_no_balance(i: u32) -> Weight { @@ -87,6 +90,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1 as u64)) .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } + // Storage: Account PendingRandomIdAssignments (r:1 w:1) fn on_filled_randomness_pending() -> Weight { // Minimum execution time: 66_963 nanoseconds. @@ -94,6 +98,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1 as u64)) .saturating_add(RocksDbWeight::get().writes(1 as u64)) } + // Storage: Account PendingRandomIdAssignments (r:1 w:0) fn on_filled_randomness_no_pending() -> Weight { // Minimum execution time: 16_088 nanoseconds. diff --git a/pallets/duniter-wot/src/mock.rs b/pallets/duniter-wot/src/mock.rs index 3ac80658c6e84155fe71e035758f37e7f89f80ed..9dbee1687bbe7d682dfa57323768f7337e64f4c3 100644 --- a/pallets/duniter-wot/src/mock.rs +++ b/pallets/duniter-wot/src/mock.rs @@ -57,30 +57,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = (); + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); + type Block = Block; + type BlockHashCount = BlockHashCount; type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type Block = Block; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } // DuniterWot @@ -91,9 +91,9 @@ parameter_types! { } impl pallet_duniter_wot::Config for Test { - type MinCertForMembership = MinCertForMembership; - type MinCertForCreateIdtyRight = MinCertForCreateIdtyRight; type FirstIssuableOn = FirstIssuableOn; + type MinCertForCreateIdtyRight = MinCertForCreateIdtyRight; + type MinCertForMembership = MinCertForMembership; } // Identity @@ -114,21 +114,21 @@ impl pallet_identity::traits::IdtyNameValidator for IdtyNameValidatorTestImpl { } impl pallet_identity::Config for Test { + type AccountLinker = (); + type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; - type ConfirmPeriod = ConfirmPeriod; type CheckIdtyCallAllowed = DuniterWot; - type IdtyCreationPeriod = IdtyCreationPeriod; - type ValidationPeriod = ValidationPeriod; - type AutorevocationPeriod = AutorevocationPeriod; + type ConfirmPeriod = ConfirmPeriod; type DeletionPeriod = DeletionPeriod; + type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = (); - type IdtyNameValidator = IdtyNameValidatorTestImpl; type IdtyIndex = IdtyIndex; - type AccountLinker = (); - type Signer = UintAuthorityId; - type Signature = TestSignature; + type IdtyNameValidator = IdtyNameValidatorTestImpl; type OnIdtyChange = DuniterWot; type RuntimeEvent = RuntimeEvent; + type Signature = TestSignature; + type Signer = UintAuthorityId; + type ValidationPeriod = ValidationPeriod; type WeightInfo = (); } @@ -139,17 +139,17 @@ parameter_types! { } impl pallet_membership::Config for Test { + type AccountIdOf = (); + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkSetupHandler = (); type CheckMembershipOpAllowed = DuniterWot; type IdtyId = IdtyIndex; type IdtyIdOf = IdentityIndexOf<Self>; - type AccountIdOf = (); type MembershipPeriod = MembershipPeriod; type MembershipRenewalPeriod = MembershipRenewalPeriod; type OnEvent = DuniterWot; type RuntimeEvent = RuntimeEvent; type WeightInfo = (); - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkSetupHandler = (); } // Cert @@ -162,16 +162,16 @@ parameter_types! { impl pallet_certification::Config for Test { type CertPeriod = CertPeriod; - type IdtyIndex = IdtyIndex; - type OwnerKeyOf = Identity; type CheckCertAllowed = DuniterWot; + type IdtyIndex = IdtyIndex; type MaxByIssuer = MaxByIssuer; type MinReceivedCertToBeAbleToIssueCert = MinReceivedCertToBeAbleToIssueCert; type OnNewcert = DuniterWot; type OnRemovedCert = DuniterWot; + type OwnerKeyOf = Identity; type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); type ValidityPeriod = ValidityPeriod; + type WeightInfo = (); } pub const NAMES: [&str; 6] = ["Alice", "Bob", "Charlie", "Dave", "Eve", "Ferdie"]; diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 4a6a68e78f51eb8cccd5f38b4511e1d32ccad991..45c18f0d79ae638732d0f328634a7070bda1c5ef 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -792,6 +792,7 @@ pub mod pallet { IdentityChangeSchedule::<T>::set(block_number, scheduled); } } + /// schedule identity change after given period fn schedule_identity_change( idty_id: T::IdtyIndex, @@ -869,6 +870,7 @@ where Default::default() } } + /// mutate an account given a function of its data fn try_mutate_exists<R, E: From<sp_runtime::DispatchError>>( key: &T::AccountId, diff --git a/pallets/identity/src/mock.rs b/pallets/identity/src/mock.rs index 2458ca8f0e1faf022400b23fcbba4fd4bdf96b56..8941544143f6bcc790726e2f08def0c65d091efc 100644 --- a/pallets/identity/src/mock.rs +++ b/pallets/identity/src/mock.rs @@ -56,30 +56,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = (); + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); + type Block = Block; + type BlockHashCount = BlockHashCount; type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type Block = Block; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } parameter_types! { @@ -99,21 +99,21 @@ impl pallet_identity::traits::IdtyNameValidator for IdtyNameValidatorTestImpl { } impl pallet_identity::Config for Test { + type AccountLinker = (); + type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckIdtyCallAllowed = (); type ConfirmPeriod = ConfirmPeriod; - type ValidationPeriod = ValidationPeriod; - type AutorevocationPeriod = AutorevocationPeriod; type DeletionPeriod = DeletionPeriod; - type CheckIdtyCallAllowed = (); type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = (); - type IdtyNameValidator = IdtyNameValidatorTestImpl; type IdtyIndex = u64; - type AccountLinker = (); - type Signer = AccountPublic; - type Signature = Signature; + type IdtyNameValidator = IdtyNameValidatorTestImpl; type OnIdtyChange = (); type RuntimeEvent = RuntimeEvent; + type Signature = Signature; + type Signer = AccountPublic; + type ValidationPeriod = ValidationPeriod; type WeightInfo = (); } diff --git a/pallets/identity/src/weights.rs b/pallets/identity/src/weights.rs index ee07fdec978c74ce96b9b7f70f25c263b8e50fa5..879cbe3f40d0816d10ce88cb99d309200dbdf34f 100644 --- a/pallets/identity/src/weights.rs +++ b/pallets/identity/src/weights.rs @@ -48,6 +48,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(14)) .saturating_add(RocksDbWeight::get().writes(12)) } + fn confirm_identity() -> Weight { // Proof Size summary in bytes: // Measured: `661` @@ -58,6 +59,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(5)) .saturating_add(RocksDbWeight::get().writes(4)) } + fn change_owner_key() -> Weight { // Proof Size summary in bytes: // Measured: `837` @@ -68,6 +70,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(7)) .saturating_add(RocksDbWeight::get().writes(5)) } + fn revoke_identity() -> Weight { // Proof Size summary in bytes: // Measured: `778` @@ -78,6 +81,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(6)) .saturating_add(RocksDbWeight::get().writes(6)) } + fn prune_item_identities_names(i: u32) -> Weight { // Proof Size summary in bytes: // Measured: `0` @@ -89,6 +93,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(30_016_649, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } + fn fix_sufficients() -> Weight { // Proof Size summary in bytes: // Measured: `67` @@ -99,6 +104,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } + fn link_account() -> Weight { // Proof Size summary in bytes: // Measured: `307` @@ -109,6 +115,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(3)) .saturating_add(RocksDbWeight::get().writes(1)) } + fn on_initialize() -> Weight { // Proof Size summary in bytes: // Measured: `0` @@ -116,6 +123,7 @@ impl WeightInfo for () { // Minimum execution time: 4_529_000 picoseconds. Weight::from_parts(7_360_000, 0).saturating_add(Weight::from_parts(0, 0)) } + fn do_revoke_identity_noop() -> Weight { // Proof Size summary in bytes: // Measured: `269` @@ -125,6 +133,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 3734)) .saturating_add(RocksDbWeight::get().reads(1)) } + fn do_revoke_identity() -> Weight { // Proof Size summary in bytes: // Measured: `1525` @@ -135,6 +144,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(17)) .saturating_add(RocksDbWeight::get().writes(20)) } + fn do_remove_identity_noop() -> Weight { // Proof Size summary in bytes: // Measured: `269` @@ -144,6 +154,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 3734)) .saturating_add(RocksDbWeight::get().reads(1)) } + fn do_remove_identity() -> Weight { // Proof Size summary in bytes: // Measured: `1432` @@ -154,6 +165,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(16)) .saturating_add(RocksDbWeight::get().writes(22)) } + fn prune_identities_noop() -> Weight { // Proof Size summary in bytes: // Measured: `108` @@ -163,6 +175,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 3573)) .saturating_add(RocksDbWeight::get().reads(1)) } + fn prune_identities_none() -> Weight { // Proof Size summary in bytes: // Measured: `292` @@ -173,6 +186,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(1)) } + fn prune_identities_err() -> Weight { // Proof Size summary in bytes: // Measured: `1177` diff --git a/pallets/membership/src/lib.rs b/pallets/membership/src/lib.rs index d266fede5817d1a3a0710d439b55702df4da3c58..d480be95f388051008bf9726df60e35382fafd37 100644 --- a/pallets/membership/src/lib.rs +++ b/pallets/membership/src/lib.rs @@ -48,6 +48,7 @@ pub trait SetupBenchmark<IdtyId, AccountId> { #[cfg(feature = "runtime-benchmarks")] impl<IdtyId, AccountId> SetupBenchmark<IdtyId, AccountId> for () { fn force_valid_distance_status(_idty_id: &IdtyId) {} + fn add_cert(_issuer: &IdtyId, _receiver: &IdtyId) {} } @@ -218,6 +219,7 @@ pub mod pallet { MembershipsExpireOn::<T>::set(block_number, scheduled); } } + /// schedule membership expiry fn insert_membership_and_schedule_expiry(idty_id: T::IdtyId) -> BlockNumberFor<T> { let block_number = frame_system::pallet::Pallet::<T>::block_number(); diff --git a/pallets/membership/src/mock.rs b/pallets/membership/src/mock.rs index 0815a5dd463cacfe6200b6cbbc2787079ff3553e..27070cd5ff7199212632dfebdfd7e537bdeab161 100644 --- a/pallets/membership/src/mock.rs +++ b/pallets/membership/src/mock.rs @@ -45,30 +45,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = (); + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); + type Block = Block; + type BlockHashCount = BlockHashCount; type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type Block = Block; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } parameter_types! { @@ -77,17 +77,17 @@ parameter_types! { } impl pallet_membership::Config for Test { + type AccountIdOf = ConvertInto; + #[cfg(feature = "runtime-benchmarks")] + type BenchmarkSetupHandler = (); type CheckMembershipOpAllowed = (); type IdtyId = IdtyId; type IdtyIdOf = ConvertInto; - type AccountIdOf = ConvertInto; type MembershipPeriod = MembershipPeriod; type MembershipRenewalPeriod = MembershipRenewalPeriod; type OnEvent = (); type RuntimeEvent = RuntimeEvent; type WeightInfo = (); - #[cfg(feature = "runtime-benchmarks")] - type BenchmarkSetupHandler = (); } // Build genesis storage according to the mock runtime. diff --git a/pallets/membership/src/weights.rs b/pallets/membership/src/weights.rs index e8024faf080c4e3e7c83c6905f7d4717cf894a9e..e5ad978271dbdac611349160cf1b8eb0c26fb97a 100644 --- a/pallets/membership/src/weights.rs +++ b/pallets/membership/src/weights.rs @@ -33,6 +33,7 @@ impl WeightInfo for () { // Minimum execution time: 4_012_000 picoseconds. Weight::from_parts(4_629_000, 0).saturating_add(Weight::from_parts(0, 0)) } + fn expire_memberships(i: u32) -> Weight { // Proof Size summary in bytes: // Measured: `567 + i * (23 ±0)` diff --git a/pallets/offences/src/mock.rs b/pallets/offences/src/mock.rs index 839b188516663d4e0edbde121bb625181f3350ff..11b2b4109bf36dbc31dca713ee06fe3ba95bccbd 100644 --- a/pallets/offences/src/mock.rs +++ b/pallets/offences/src/mock.rs @@ -64,36 +64,36 @@ frame_support::construct_runtime!( ); impl frame_system::Config for Runtime { + type AccountData = (); + type AccountId = u64; type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); + type Block = Block; + type BlockHashCount = ConstU64<250>; type BlockLength = (); + type BlockWeights = (); type DbWeight = RocksDbWeight; - type RuntimeOrigin = RuntimeOrigin; - type Block = Block; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u64; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = ConstU64<250>; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); } impl Config for Runtime { - type RuntimeEvent = RuntimeEvent; type IdentificationTuple = u64; type OnOffenceHandler = OnOffenceHandler; + type RuntimeEvent = RuntimeEvent; } pub fn new_test_ext() -> sp_io::TestExternalities { @@ -126,9 +126,10 @@ pub struct Offence { } impl pallet_offences::Offence<u64> for Offence { - const ID: pallet_offences::Kind = KIND; type TimeSlot = u128; + const ID: pallet_offences::Kind = KIND; + fn offenders(&self) -> Vec<u64> { self.offenders.clone() } diff --git a/pallets/oneshot-account/src/check_nonce.rs b/pallets/oneshot-account/src/check_nonce.rs index fc2103a1655309b14b7428a0ae20bf9f7a449b47..83bd7494fe4c7ce9408d163b904352bcc104873e 100644 --- a/pallets/oneshot-account/src/check_nonce.rs +++ b/pallets/oneshot-account/src/check_nonce.rs @@ -53,9 +53,10 @@ where T::RuntimeCall: Dispatchable<Info = DispatchInfo> + IsSubType<crate::Call<T>>, { type AccountId = <T as frame_system::Config>::AccountId; - type Call = <T as frame_system::Config>::RuntimeCall; type AdditionalSigned = (); + type Call = <T as frame_system::Config>::RuntimeCall; type Pre = (); + const IDENTIFIER: &'static str = "CheckNonce"; fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { diff --git a/pallets/oneshot-account/src/lib.rs b/pallets/oneshot-account/src/lib.rs index 12a7f677afd54a58b041823d6b9c1449a46ab3b2..0c86b3ce425d5bd0028745615e0d3d3a7f7db50c 100644 --- a/pallets/oneshot-account/src/lib.rs +++ b/pallets/oneshot-account/src/lib.rs @@ -162,6 +162,7 @@ pub mod pallet { Ok(()) } + /// Consume a oneshot account and transfer its balance to an account /// /// - `block_height`: Must be a recent block number. The limit is `BlockHashCount` in the past. (this is to prevent replay attacks) @@ -216,6 +217,7 @@ pub mod pallet { Ok(()) } + /// Consume a oneshot account then transfer some amount to an account, /// and the remaining amount to another account. /// @@ -328,6 +330,7 @@ where { type Balance = <T::Currency as Currency<T::AccountId>>::Balance; type LiquidityInfo = Option<<T::Currency as Currency<T::AccountId>>::NegativeImbalance>; + fn withdraw_fee( who: &T::AccountId, call: &T::RuntimeCall, @@ -364,6 +367,7 @@ where T::InnerOnChargeTransaction::withdraw_fee(who, call, dispatch_info, fee, tip) } } + fn correct_and_deposit_fee( who: &T::AccountId, dispatch_info: &DispatchInfoOf<T::RuntimeCall>, diff --git a/pallets/oneshot-account/src/mock.rs b/pallets/oneshot-account/src/mock.rs index beee56bdc99b36a684a13b986388d41c53c4492b..7e35d0efe45e8841223925ce63d38682028f286d 100644 --- a/pallets/oneshot-account/src/mock.rs +++ b/pallets/oneshot-account/src/mock.rs @@ -45,30 +45,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = pallet_balances::AccountData<Balance>; + type AccountId = u64; type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u64; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData<Balance>; - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } parameter_types! { @@ -77,28 +77,28 @@ parameter_types! { } impl pallet_balances::Config for Test { + type AccountStore = System; type Balance = Balance; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; + type MaxHolds = ConstU32<0>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type RuntimeEvent = RuntimeEvent; - type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; - type MaxFreezes = ConstU32<0>; - type RuntimeHoldReason = (); type RuntimeFreezeReason = (); + type RuntimeHoldReason = (); + type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; } impl pallet_transaction_payment::Config for Test { - type RuntimeEvent = RuntimeEvent; + type FeeMultiplierUpdate = (); + type LengthToFee = IdentityFee<u64>; type OnChargeTransaction = OneshotAccount; type OperationalFeeMultiplier = frame_support::traits::ConstU8<5>; + type RuntimeEvent = RuntimeEvent; type WeightToFee = IdentityFee<u64>; - type LengthToFee = IdentityFee<u64>; - type FeeMultiplierUpdate = (); } impl pallet_oneshot_account::Config for Test { type Currency = Balances; diff --git a/pallets/oneshot-account/src/weights.rs b/pallets/oneshot-account/src/weights.rs index 5308ff1d06526f0cdea54719c84ff08d1dc2cd9c..f8fabe3ccfb93156edfcdb2f75d8c2bd71d6d725 100644 --- a/pallets/oneshot-account/src/weights.rs +++ b/pallets/oneshot-account/src/weights.rs @@ -33,6 +33,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().writes(1)) } + // Storage: OneshotAccount OneshotAccounts (r:1 w:1) // Storage: System BlockHash (r:1 w:0) // Storage: System Account (r:1 w:1) @@ -41,6 +42,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(3)) .saturating_add(RocksDbWeight::get().writes(2)) } + // Storage: OneshotAccount OneshotAccounts (r:1 w:1) // Storage: System BlockHash (r:1 w:0) // Storage: System Account (r:2 w:2) diff --git a/pallets/provide-randomness/src/lib.rs b/pallets/provide-randomness/src/lib.rs index 28d62e41649ace857376874fc1bedef3fc79c5c6..b6c36c3454f54e2da6e22f1b374d14b0e5a71bee 100644 --- a/pallets/provide-randomness/src/lib.rs +++ b/pallets/provide-randomness/src/lib.rs @@ -234,9 +234,11 @@ pub mod pallet { // Apply phase Ok(Self::apply_request(randomness_type, salt)) } + pub fn force_request(randomness_type: RandomnessType, salt: H256) -> RequestId { Self::apply_request(randomness_type, salt) } + pub fn on_new_epoch() { NexEpochHookIn::<T>::put(5) } @@ -255,6 +257,7 @@ pub mod pallet { T::OnUnbalanced::on_unbalanced(imbalance); Ok(()) } + fn apply_request(randomness_type: RandomnessType, salt: H256) -> RequestId { let request_id = RequestIdProvider::<T>::mutate(|next_request_id| { core::mem::replace(next_request_id, next_request_id.saturating_add(1)) diff --git a/pallets/provide-randomness/src/weights.rs b/pallets/provide-randomness/src/weights.rs index be2f03e8710d8f6e329d3e29d40e5320a8894e2d..94e99db3b570df1fadbe035cb906439fa3c8d66a 100644 --- a/pallets/provide-randomness/src/weights.rs +++ b/pallets/provide-randomness/src/weights.rs @@ -39,6 +39,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(6 as u64)) .saturating_add(RocksDbWeight::get().writes(4 as u64)) } + // Storage: ProvideRandomness RequestsReadyAtNextBlock (r:1 w:1) // Storage: Babe AuthorVrfRandomness (r:1 w:0) // Storage: ProvideRandomness RequestsIds (r:1 w:1) @@ -56,6 +57,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(3 as u64)) .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } + fn on_initialize_epoch(i: u32) -> Weight { // Minimum execution time: 175_645 nanoseconds. Weight::from_parts(461_442_906 as u64, 0) diff --git a/pallets/quota/src/lib.rs b/pallets/quota/src/lib.rs index ac9873f4fb7e285f8c44b07bf7b49027d449fa1c..8a063dcb13ca8b19f79023df55f69854ef5c9ede 100644 --- a/pallets/quota/src/lib.rs +++ b/pallets/quota/src/lib.rs @@ -258,6 +258,7 @@ pub mod pallet { quota.last_use = current_block; quota.amount = core::cmp::min(quota.amount + quota_growth, T::MaxQuota::get()); } + /// spend a certain amount of quota and return what was spent fn do_spend_quota( quota: &mut Quota<BlockNumberFor<T>, BalanceOf<T>>, diff --git a/pallets/quota/src/mock.rs b/pallets/quota/src/mock.rs index cf3bcbc0e2a51d23f2b65a827d3b20aba44e6512..5f7f79a2f411b12dc7082727c41529acab238223 100644 --- a/pallets/quota/src/mock.rs +++ b/pallets/quota/src/mock.rs @@ -66,10 +66,10 @@ parameter_types! { pub const MaxQuota: u64 = 1000; } impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type ReloadRate = ReloadRate; type MaxQuota = MaxQuota; type RefundAccount = TreasuryAccountId; + type ReloadRate = ReloadRate; + type RuntimeEvent = RuntimeEvent; type WeightInfo = (); } @@ -79,30 +79,30 @@ parameter_types! { pub const SS58Prefix: u8 = 42; } impl system::Config for Test { + type AccountData = pallet_balances::AccountData<Balance>; + type AccountId = AccountId; type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = AccountId; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData<Balance>; - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } // BALANCES // @@ -111,20 +111,20 @@ parameter_types! { pub const MaxLocks: u32 = 50; } impl pallet_balances::Config for Test { + type AccountStore = System; type Balance = Balance; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; + type MaxHolds = ConstU32<0>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type RuntimeEvent = RuntimeEvent; - type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; - type MaxFreezes = ConstU32<0>; - type RuntimeHoldReason = (); type RuntimeFreezeReason = (); + type RuntimeHoldReason = (); + type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; } // IDENTITY // @@ -143,21 +143,21 @@ impl pallet_identity::traits::IdtyNameValidator for IdtyNameValidatorTestImpl { } } impl pallet_identity::Config for Test { + type AccountLinker = (); + type AutorevocationPeriod = AutorevocationPeriod; type ChangeOwnerKeyPeriod = ChangeOwnerKeyPeriod; + type CheckIdtyCallAllowed = (); type ConfirmPeriod = ConfirmPeriod; - type ValidationPeriod = ValidationPeriod; - type AutorevocationPeriod = AutorevocationPeriod; type DeletionPeriod = DeletionPeriod; - type CheckIdtyCallAllowed = (); type IdtyCreationPeriod = IdtyCreationPeriod; type IdtyData = (); - type IdtyNameValidator = IdtyNameValidatorTestImpl; type IdtyIndex = u64; - type AccountLinker = (); - type Signer = AccountPublic; - type Signature = Signature; + type IdtyNameValidator = IdtyNameValidatorTestImpl; type OnIdtyChange = (); type RuntimeEvent = RuntimeEvent; + type Signature = Signature; + type Signer = AccountPublic; + type ValidationPeriod = ValidationPeriod; type WeightInfo = (); } diff --git a/pallets/quota/src/weights.rs b/pallets/quota/src/weights.rs index 076daa4b1800aa0a9a90c82f2a64474c364700b7..23a9f77745e614cd9e4f8eac52d3a343a2ee2ee3 100644 --- a/pallets/quota/src/weights.rs +++ b/pallets/quota/src/weights.rs @@ -15,18 +15,23 @@ impl WeightInfo for () { fn queue_refund() -> Weight { Weight::from_parts(100u64, 0) } + fn spend_quota() -> Weight { Weight::from_parts(25u64, 0) } + fn try_refund() -> Weight { Weight::from_parts(100u64, 0) } + fn do_refund() -> Weight { Weight::from_parts(25u64, 0) } + fn on_process_refund_queue() -> Weight { Weight::from_parts(1u64, 0) } + fn on_process_refund_queue_elements(_i: u32) -> Weight { Weight::from_parts(1u64, 0) } diff --git a/pallets/smith-members/src/mock.rs b/pallets/smith-members/src/mock.rs index de27e77057726c11f8e039294798776359d6febd..2e7ddf15b5147d2ee1fc40cd7220bcecb198dfe8 100644 --- a/pallets/smith-members/src/mock.rs +++ b/pallets/smith-members/src/mock.rs @@ -45,30 +45,30 @@ frame_support::construct_runtime!( ); impl frame_system::Config for Runtime { + type AccountData = (); + type AccountId = u64; type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = ConstU64<250>; + type BlockLength = (); + type BlockWeights = (); type DbWeight = RocksDbWeight; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u64; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = ConstU64<250>; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = (); - type OnNewAccount = (); + type MaxConsumers = ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = (); + type SystemWeightInfo = (); + type Version = (); } pub struct EveryoneExceptIdZero; @@ -79,17 +79,17 @@ impl IsMember<u64> for EveryoneExceptIdZero { } impl pallet_smith_members::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type IdtyIdOf = ConvertInto; + type IdtyIdOfAuthorityId = ConvertInto; type IdtyIndex = u64; type IsWoTMember = EveryoneExceptIdZero; - type IdtyIdOf = ConvertInto; - type MinCertForMembership = ConstU32<2>; type MaxByIssuer = ConstU32<3>; - type SmithInactivityMaxDuration = ConstU32<5>; - type OnSmithDelete = (); - type IdtyIdOfAuthorityId = ConvertInto; type MemberId = u64; + type MinCertForMembership = ConstU32<2>; + type OnSmithDelete = (); type OwnerKeyOf = ConvertInto; + type RuntimeEvent = RuntimeEvent; + type SmithInactivityMaxDuration = ConstU32<5>; type WeightInfo = (); } diff --git a/pallets/smith-members/src/weights.rs b/pallets/smith-members/src/weights.rs index b18e0cef9fe76aa09afbd4b3544cfcd21652ac0d..76a6d6af7afaacfe3221db91195b65504f32305a 100644 --- a/pallets/smith-members/src/weights.rs +++ b/pallets/smith-members/src/weights.rs @@ -29,9 +29,11 @@ impl WeightInfo for () { fn invite_smith() -> Weight { Weight::zero() } + fn accept_invitation() -> Weight { Weight::zero() } + fn certify_smith() -> Weight { Weight::zero() } diff --git a/pallets/universal-dividend/src/lib.rs b/pallets/universal-dividend/src/lib.rs index fcccdd65f77778fbc76c298c598052a599882123..d475f974ca82f1a7d397a019ab3b531fe1078e5c 100644 --- a/pallets/universal-dividend/src/lib.rs +++ b/pallets/universal-dividend/src/lib.rs @@ -402,6 +402,7 @@ pub mod pallet { let who = ensure_signed(origin)?; Self::do_claim_uds(&who) } + /// Transfer some liquid free balance to another account, in milliUD. #[pallet::call_index(1)] #[pallet::weight(<T as pallet::Config>::WeightInfo::transfer_ud())] @@ -431,6 +432,7 @@ pub mod pallet { pub fn init_first_eligible_ud() -> FirstEligibleUd { CurrentUdIndex::<T>::get().into() } + /// function to call when removing a member /// auto-claims UDs pub fn on_removed_member(first_ud_index: UdIndex, who: &T::AccountId) -> Weight { diff --git a/pallets/universal-dividend/src/mock.rs b/pallets/universal-dividend/src/mock.rs index 695aff301909e5226a42a23a4ca5b1c08f726208..ada04634e5c57e11dfdf220e3610c8b3828e9723 100644 --- a/pallets/universal-dividend/src/mock.rs +++ b/pallets/universal-dividend/src/mock.rs @@ -52,30 +52,30 @@ parameter_types! { } impl system::Config for Test { + type AccountData = pallet_balances::AccountData<Balance>; + type AccountId = u32; type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); type Block = Block; + type BlockHashCount = BlockHashCount; + type BlockLength = (); + type BlockWeights = (); type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; - type AccountId = u32; type Lookup = IdentityLookup<Self::AccountId>; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData<Balance>; - type OnNewAccount = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; + type Nonce = u64; type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; + type OnNewAccount = (); type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type PalletInfo = PalletInfo; + type RuntimeCall = RuntimeCall; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type RuntimeTask = (); - type Nonce = u64; + type SS58Prefix = SS58Prefix; + type SystemWeightInfo = (); + type Version = (); } parameter_types! { @@ -83,9 +83,9 @@ parameter_types! { } impl pallet_timestamp::Config for Test { + type MinimumPeriod = MinimumPeriod; type Moment = u64; type OnTimestampSet = UniversalDividend; - type MinimumPeriod = MinimumPeriod; type WeightInfo = (); } @@ -95,20 +95,20 @@ parameter_types! { } impl pallet_balances::Config for Test { + type AccountStore = System; type Balance = Balance; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; + type FreezeIdentifier = (); + type MaxFreezes = ConstU32<0>; + type MaxHolds = ConstU32<0>; type MaxLocks = MaxLocks; type MaxReserves = (); type ReserveIdentifier = [u8; 8]; type RuntimeEvent = RuntimeEvent; - type FreezeIdentifier = (); - type MaxHolds = ConstU32<0>; - type MaxFreezes = ConstU32<0>; - type RuntimeHoldReason = (); type RuntimeFreezeReason = (); + type RuntimeHoldReason = (); + type WeightInfo = pallet_balances::weights::SubstrateWeight<Test>; } parameter_types! { @@ -123,6 +123,7 @@ impl frame_support::traits::StoredMap<u32, FirstEligibleUd> for TestMembersStora fn get(key: &u32) -> FirstEligibleUd { crate::TestMembers::<Test>::get(key) } + fn try_mutate_exists<R, E: From<sp_runtime::DispatchError>>( key: &u32, f: impl FnOnce(&mut Option<FirstEligibleUd>) -> Result<R, E>, @@ -137,19 +138,19 @@ impl frame_support::traits::StoredMap<u32, FirstEligibleUd> for TestMembersStora } impl pallet_universal_dividend::Config for Test { - type MomentIntoBalance = sp_runtime::traits::ConvertInto; + #[cfg(feature = "runtime-benchmarks")] + type AccountIdOf = ConvertInto; type Currency = pallet_balances::Pallet<Test>; type MaxPastReeval = frame_support::traits::ConstU32<2>; type MembersCount = MembersCount; type MembersStorage = TestMembersStorage; + type MomentIntoBalance = sp_runtime::traits::ConvertInto; type RuntimeEvent = RuntimeEvent; type SquareMoneyGrowthRate = SquareMoneyGrowthRate; type UdCreationPeriod = UdCreationPeriod; type UdReevalPeriod = UdReevalPeriod; type UnitsPerUd = frame_support::traits::ConstU64<1_000>; type WeightInfo = (); - #[cfg(feature = "runtime-benchmarks")] - type AccountIdOf = ConvertInto; } // Build genesis storage according to the mock runtime. diff --git a/pallets/universal-dividend/src/weights.rs b/pallets/universal-dividend/src/weights.rs index 75eb80a58898d4252a480c1b6e3a77d7a8cd0629..27d0f739c0d4d73daa71345671dca76f755a4f42 100644 --- a/pallets/universal-dividend/src/weights.rs +++ b/pallets/universal-dividend/src/weights.rs @@ -35,6 +35,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(4)) .saturating_add(RocksDbWeight::get().writes(1)) } + // Storage: UniversalDividend CurrentUd (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Account PendingNewAccounts (r:0 w:1) @@ -43,6 +44,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(2)) } + // Storage: UniversalDividend CurrentUd (r:1 w:0) // Storage: System Account (r:1 w:1) // Storage: Account PendingNewAccounts (r:0 w:1) @@ -51,6 +53,7 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(2)) } + fn on_removed_member(i: u32) -> Weight { Weight::from_parts(32_514_000, 0) // Standard Error: 32_000 diff --git a/pallets/upgrade-origin/src/lib.rs b/pallets/upgrade-origin/src/lib.rs index 2a7f6db0e89cda963d3efda9236088c1f68526cf..15ebd1ae95c4aa18d78e2dd45d24f411646b3625 100644 --- a/pallets/upgrade-origin/src/lib.rs +++ b/pallets/upgrade-origin/src/lib.rs @@ -104,6 +104,7 @@ pub mod pallet { }); Ok(Pays::No.into()) } + /// Dispatches a function call from root origin. /// This function does not check the weight of the call, and instead allows the /// caller to specify the weight of the call. diff --git a/primitives/membership/src/traits.rs b/primitives/membership/src/traits.rs index 9e54c148b7dd06be47a76c9ca114f0e51ab6cc5b..a877fa9fb1643804e47a6c30dc1b565f4961c485 100644 --- a/primitives/membership/src/traits.rs +++ b/primitives/membership/src/traits.rs @@ -25,6 +25,7 @@ impl<IdtyId> CheckMembershipOpAllowed<IdtyId> for () { fn check_add_membership(_: IdtyId) -> Result<(), DispatchError> { Ok(()) } + fn check_renew_membership(_: IdtyId) -> Result<(), DispatchError> { Ok(()) } diff --git a/resources/weight_analyzer/src/lib.rs b/resources/weight_analyzer/src/lib.rs index 5403efab32da26a04b5e74a27b669edad409bf45..14e8bf7ae2b38acc702924d0c85107726085ac9c 100644 --- a/resources/weight_analyzer/src/lib.rs +++ b/resources/weight_analyzer/src/lib.rs @@ -24,6 +24,7 @@ impl Default for MaxBlockWeight { } impl Div<&MaxBlockWeight> for f64 { type Output = Self; + fn div(self, max_block_weight: &MaxBlockWeight) -> Self::Output { self / max_block_weight.0 } diff --git a/runtime/common/src/fees.rs b/runtime/common/src/fees.rs index fb43d4f1fdc641e827ebc9509c6b5ca6f1837ae0..1bea9d5759d1a77d1c1aabf231c082a4bb72922d 100644 --- a/runtime/common/src/fees.rs +++ b/runtime/common/src/fees.rs @@ -47,6 +47,7 @@ where fn weight_to_fee(length_in_bytes: &Weight) -> Self::Balance { Self::Balance::saturated_from(length_in_bytes.ref_time() / 100u64) } + #[cfg(feature = "constant-fees")] fn weight_to_fee(_length_in_bytes: &Weight) -> Self::Balance { 0u32.into() diff --git a/runtime/common/src/providers.rs b/runtime/common/src/providers.rs index 504cf92f8db91313aa780b7e8c5b2f927bc35863..c947ce58856bd7dd997448a57bbfe9be65580f1d 100644 --- a/runtime/common/src/providers.rs +++ b/runtime/common/src/providers.rs @@ -51,6 +51,7 @@ where fn get(key: &T::AccountId) -> FirstEligibleUd { pallet_identity::Pallet::<T>::get(key).first_eligible_ud } + fn try_mutate_exists<R, E: From<sp_runtime::DispatchError>>( key: &T::AccountId, f: impl FnOnce(&mut Option<FirstEligibleUd>) -> Result<R, E>, @@ -98,6 +99,7 @@ macro_rules! impl_benchmark_setup_handler { fn force_valid_distance_status(idty_id: &IdtyIndex) -> () { let _ = pallet_distance::Pallet::<T>::do_valid_distance_status(*idty_id); } + fn add_cert(issuer: &IdtyIndex, receiver: &IdtyIndex) { let _ = pallet_certification::Pallet::<T>::do_add_cert_checked( (*issuer).into(), diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000000000000000000000000000000000000..b7ac0b7277d257f2401ec6ef04d6b8ef88ba6c5c --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +reorder_impl_items = true diff --git a/xtask/src/gen_doc.rs b/xtask/src/gen_doc.rs index c1a5820b797b393d1727a2bd2a04cd12b1ff609e..929361633264451c01a562110242448c48497c80 100644 --- a/xtask/src/gen_doc.rs +++ b/xtask/src/gen_doc.rs @@ -229,12 +229,15 @@ impl CallCategory { _ => Self::User, } } + fn is_root(pallet_name: &str, call_name: &str) -> bool { matches!(Self::is(pallet_name, call_name), Self::Root) } + fn is_user(pallet_name: &str, call_name: &str) -> bool { matches!(Self::is(pallet_name, call_name), Self::User) } + fn is_disabled(pallet_name: &str, call_name: &str) -> bool { matches!(Self::is(pallet_name, call_name), Self::Disabled) }