Skip to content

Commit 6baee80

Browse files
committed
Clippy fixes
1 parent 98e1fe5 commit 6baee80

File tree

2 files changed

+23
-21
lines changed
  • dip-template/runtimes

2 files changed

+23
-21
lines changed

dip-template/runtimes/dip-consumer/src/dip.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616

1717
// If you feel like getting in touch with us, you can do so at [email protected]
1818

19-
use did::{
20-
did_details::{DidEncryptionKey, DidPublicKeyDetails, DidVerificationKey},
21-
DidSignature, DidVerificationKeyRelationship, KeyIdOf,
22-
};
19+
use did::{DidVerificationKeyRelationship, KeyIdOf};
2320
use dip_provider_runtime_template::{
24-
AccountId as ProviderAccountId, Runtime as ProviderRuntime, MAX_REVEALABLE_LINKED_ACCOUNTS,
25-
MAX_TOTAL_KEY_AGREEMENT_KEYS,
21+
AccountId as ProviderAccountId, Runtime as ProviderRuntime, MAX_PUBLIC_KEYS_PER_DID, MAX_REVEALABLE_LINKED_ACCOUNTS,
2622
};
27-
use frame_support::{pallet_prelude::ValueQuery, storage_alias, traits::Contains};
23+
use frame_support::traits::Contains;
2824
use frame_system::{pallet_prelude::BlockNumberFor, EnsureSigned};
2925
use kilt_dip_primitives::{
3026
parachain::{
@@ -33,22 +29,17 @@ use kilt_dip_primitives::{
3329
DEFAULT_MAX_PROVIDER_HEAD_PROOF_LEAVE_COUNT, DEFAULT_MAX_PROVIDER_HEAD_PROOF_LEAVE_SIZE,
3430
},
3531
traits::DipCallOriginFilter,
36-
DidKeyRelationship, DidMerkleProof, DipCommitmentStateProof, KiltVersionedParachainVerifier, ParachainDipDidProof,
37-
ProviderHeadStateProof, RelayStateRootsViaRelayStorePallet, RevealedAccountId, RevealedDidKey, RevealedWeb3Name,
38-
TimeBoundDidSignature,
32+
KiltVersionedParachainVerifier, RelayStateRootsViaRelayStorePallet, RevealedDidKey,
3933
};
40-
use pallet_dip_consumer::{benchmarking::WorstCaseOf, traits::IdentityProofVerifier};
41-
use pallet_relay_store::RelayParentInfo;
34+
use pallet_dip_consumer::traits::IdentityProofVerifier;
4235
use rococo_runtime::Runtime as RelaychainRuntime;
4336
use sp_core::ConstU32;
44-
use sp_runtime::AccountId32;
4537
use sp_std::{marker::PhantomData, vec::Vec};
4638

4739
use crate::{weights, AccountId, DidIdentifier, Runtime, RuntimeCall, RuntimeOrigin};
4840

49-
// 3 is the attestation, delegation, and authentication key.
50-
// 1 is the web3name.
51-
const MAX_PROVIDER_REVEALABLE_KEYS_COUNT: u32 = MAX_TOTAL_KEY_AGREEMENT_KEYS + 3 + 1 + MAX_REVEALABLE_LINKED_ACCOUNTS;
41+
// +1 for the web3name.
42+
const MAX_PROVIDER_REVEALABLE_KEYS_COUNT: u32 = MAX_PUBLIC_KEYS_PER_DID + MAX_REVEALABLE_LINKED_ACCOUNTS + 1;
5243

5344
/// The verifier logic is tied to the provider template runtime definition.
5445
pub type ProviderTemplateProofVerifier = KiltVersionedParachainVerifier<
@@ -99,12 +90,23 @@ impl IdentityProofVerifier<Runtime> for ProviderTemplateProofVerifierWrapper {
9990
// Implement worst-case logic for this specific verifier.
10091
#[cfg(feature = "runtime-benchmarks")]
10192
impl kilt_support::traits::GetWorstCase for ProviderTemplateProofVerifierWrapper {
102-
type Output = WorstCaseOf<Runtime>;
93+
type Output = pallet_dip_consumer::benchmarking::WorstCaseOf<Runtime>;
10394

10495
fn worst_case(_context: ()) -> Self::Output {
105-
use frame_support::Twox64Concat;
96+
use did::{
97+
did_details::{DidEncryptionKey, DidPublicKeyDetails, DidVerificationKey},
98+
DidSignature,
99+
};
100+
use frame_support::{pallet_prelude::ValueQuery, storage_alias, Twox64Concat};
106101
use hex_literal::hex;
102+
use kilt_dip_primitives::{
103+
DidKeyRelationship, DidMerkleProof, DipCommitmentStateProof, ParachainDipDidProof, ProviderHeadStateProof,
104+
RevealedAccountId, RevealedWeb3Name, TimeBoundDidSignature,
105+
};
106+
use pallet_dip_consumer::benchmarking::WorstCaseOf;
107+
use pallet_relay_store::RelayParentInfo;
107108
use sp_core::{ed25519, sr25519, H256};
109+
use sp_runtime::AccountId32;
108110
use sp_std::vec;
109111

110112
#[storage_alias]

dip-template/runtimes/dip-provider/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,10 @@ impl did::DeriveDidCallAuthorizationVerificationKeyRelationship for RuntimeCall
376376
}
377377
}
378378

379-
pub const MAX_TOTAL_KEY_AGREEMENT_KEYS: u32 = 50;
379+
pub const MAX_PUBLIC_KEYS_PER_DID: u32 = 53;
380380
parameter_types! {
381381
#[derive(Debug, Clone, Eq, PartialEq)]
382-
pub const MaxTotalKeyAgreementKeys: u32 = MAX_TOTAL_KEY_AGREEMENT_KEYS;
382+
pub const MaxTotalKeyAgreementKeys: u32 = 50;
383383
#[derive(Debug, Clone, Eq, PartialEq, TypeInfo, Encode, Decode)]
384384
pub const MaxNewKeyAgreementKeys: u32 = 50;
385385
}
@@ -398,7 +398,7 @@ impl did::Config for Runtime {
398398
type MaxNumberOfServicesPerDid = ConstU32<1>;
399399
type MaxNumberOfTypesPerService = ConstU32<1>;
400400
type MaxNumberOfUrlsPerService = ConstU32<1>;
401-
type MaxPublicKeysPerDid = ConstU32<53>;
401+
type MaxPublicKeysPerDid = ConstU32<MAX_PUBLIC_KEYS_PER_DID>;
402402
type MaxServiceIdLength = ConstU32<100>;
403403
type MaxServiceTypeLength = ConstU32<100>;
404404
type MaxServiceUrlLength = ConstU32<100>;

0 commit comments

Comments
 (0)