diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b66878f7e9..391863b1f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,7 @@ clippy: stage: test timeout: 1 hours script: - - rustup component add clippy --toolchain nightly - - cargo +nightly clippy --all-features --all-targets --locked -- -D warnings + - cargo clippy --all-features --all-targets --locked -- -D warnings fmt: # Corresponds to paritytech/ci-linux:production at the time of this PR @@ -19,8 +18,7 @@ fmt: stage: test timeout: 1 hours script: - - rustup component add rustfmt --toolchain nightly - - cargo +nightly fmt -- --check + - cargo fmt -- --check test: # Corresponds to paritytech/ci-linux:production at the time of this PR diff --git a/.maintain/srtool.Dockerfile b/.maintain/srtool.Dockerfile index 65dda3ce07..717c6fd4c2 100644 --- a/.maintain/srtool.Dockerfile +++ b/.maintain/srtool.Dockerfile @@ -3,7 +3,7 @@ FROM docker.io/library/ubuntu:22.04 LABEL maintainer "chevdor@gmail.com" LABEL description="This image contains tools for Substrate blockchains runtimes." -ARG RUSTC_VERSION="1.62.0" +ARG RUSTC_VERSION="1.64.0" ENV RUSTC_VERSION=$RUSTC_VERSION ENV DOCKER_IMAGE="paritytech/srtool" ENV PROFILE=release diff --git a/crates/assets/Cargo.toml b/crates/assets/Cargo.toml index b1646a7819..a233d94eea 100644 --- a/crates/assets/Cargo.toml +++ b/crates/assets/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/nodes/parachain/Cargo.toml b/nodes/parachain/Cargo.toml index 2ba531a9f1..06cfc79be9 100644 --- a/nodes/parachain/Cargo.toml +++ b/nodes/parachain/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/nodes/parachain/src/command.rs b/nodes/parachain/src/command.rs index 9fd2e263eb..d012ed6d7a 100644 --- a/nodes/parachain/src/command.rs +++ b/nodes/parachain/src/command.rs @@ -406,7 +406,7 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = if !cli.no_hardware_benchmarks { config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) }) } else { diff --git a/nodes/standalone/Cargo.toml b/nodes/standalone/Cargo.toml index 5328bd1891..6efa52a15b 100644 --- a/nodes/standalone/Cargo.toml +++ b/nodes/standalone/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/nodes/standalone/src/benchmarking.rs b/nodes/standalone/src/benchmarking.rs index 08a52335e7..0206c3d586 100644 --- a/nodes/standalone/src/benchmarking.rs +++ b/nodes/standalone/src/benchmarking.rs @@ -130,7 +130,7 @@ pub fn create_benchmark_extrinsic( let period = runtime::BlockHashCount::get() .checked_next_power_of_two() .map(|c| c / 2) - .unwrap_or(2) as u64; + .unwrap_or(2); let extra: runtime::SignedExtra = ( frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), diff --git a/pallets/attestation/Cargo.toml b/pallets/attestation/Cargo.toml index 2be22eecce..6c66c902c9 100644 --- a/pallets/attestation/Cargo.toml +++ b/pallets/attestation/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/attestation/src/benchmarking.rs b/pallets/attestation/src/benchmarking.rs index 59edb493d5..479e0a65dd 100644 --- a/pallets/attestation/src/benchmarking.rs +++ b/pallets/attestation/src/benchmarking.rs @@ -41,7 +41,7 @@ benchmarks! { let claim_hash: T::Hash = T::Hashing::hash(b"claim"); let ctype_hash: T::Hash = T::Hash::default(); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester.clone()); @@ -66,7 +66,7 @@ benchmarks! { let claim_hash: T::Hash = T::Hashing::hash(b"claim"); let ctype_hash: T::Hash = T::Hash::default(); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester.clone()); @@ -92,7 +92,7 @@ benchmarks! { let claim_hash: T::Hash = T::Hashing::hash(b"claim"); let ctype_hash: T::Hash = T::Hash::default(); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester.clone()); @@ -109,7 +109,7 @@ benchmarks! { let claim_hash: T::Hash = T::Hashing::hash(b"claim"); let ctype_hash: T::Hash = T::Hash::default(); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); ::Currency::make_free_balance_be(&sender, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(sender.clone(), attester); @@ -127,7 +127,7 @@ benchmarks! { let claim_hash: T::Hash = T::Hashing::hash(b"claim"); let ctype_hash: T::Hash = T::Hash::default(); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); ::Currency::make_free_balance_be(&deposit_owner_old, ::Deposit::get() + ::Deposit::get()); ::Currency::make_free_balance_be(&deposit_owner_new, ::Deposit::get() + ::Deposit::get()); @@ -154,7 +154,7 @@ benchmarks! { let claim_hash: T::Hash = T::Hashing::hash(b"claim"); let ctype_hash: T::Hash = T::Hash::default(); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); ::Currency::make_free_balance_be(&deposit_owner, ::Deposit::get() + ::Deposit::get()); let origin = ::EnsureOrigin::generate_origin(deposit_owner.clone(), attester.clone()); diff --git a/pallets/attestation/src/lib.rs b/pallets/attestation/src/lib.rs index 6782a8d68f..e01e25f868 100644 --- a/pallets/attestation/src/lib.rs +++ b/pallets/attestation/src/lib.rs @@ -246,11 +246,11 @@ pub mod pallet { let deposit_amount = ::Deposit::get(); ensure!( - ctype::Ctypes::::contains_key(&ctype_hash), + ctype::Ctypes::::contains_key(ctype_hash), ctype::Error::::CTypeNotFound ); ensure!( - !Attestations::::contains_key(&claim_hash), + !Attestations::::contains_key(claim_hash), Error::::AlreadyAttested ); @@ -268,7 +268,7 @@ pub mod pallet { log::debug!("insert Attestation"); Attestations::::insert( - &claim_hash, + claim_hash, AttestationDetails { ctype_hash, attester: who.clone(), @@ -315,7 +315,7 @@ pub mod pallet { let source = ::EnsureOrigin::ensure_origin(origin)?; let who = source.subject(); - let attestation = Attestations::::get(&claim_hash).ok_or(Error::::AttestationNotFound)?; + let attestation = Attestations::::get(claim_hash).ok_or(Error::::AttestationNotFound)?; ensure!(!attestation.revoked, Error::::AlreadyRevoked); @@ -333,7 +333,7 @@ pub mod pallet { log::debug!("revoking Attestation"); Attestations::::insert( - &claim_hash, + claim_hash, AttestationDetails { revoked: true, ..attestation @@ -374,7 +374,7 @@ pub mod pallet { let source = ::EnsureOrigin::ensure_origin(origin)?; let who = source.subject(); - let attestation = Attestations::::get(&claim_hash).ok_or(Error::::AttestationNotFound)?; + let attestation = Attestations::::get(claim_hash).ok_or(Error::::AttestationNotFound)?; if attestation.attester != who { let attestation_auth_id = attestation.authorization_id.as_ref().ok_or(Error::::Unauthorized)?; @@ -408,7 +408,7 @@ pub mod pallet { #[pallet::weight(::WeightInfo::reclaim_deposit())] pub fn reclaim_deposit(origin: OriginFor, claim_hash: ClaimHashOf) -> DispatchResult { let who = ensure_signed(origin)?; - let attestation = Attestations::::get(&claim_hash).ok_or(Error::::AttestationNotFound)?; + let attestation = Attestations::::get(claim_hash).ok_or(Error::::AttestationNotFound)?; ensure!(attestation.deposit.owner == who, Error::::Unauthorized); @@ -435,7 +435,7 @@ pub mod pallet { let subject = source.subject(); let sender = source.sender(); - let attestation = Attestations::::get(&claim_hash).ok_or(Error::::AttestationNotFound)?; + let attestation = Attestations::::get(claim_hash).ok_or(Error::::AttestationNotFound)?; ensure!(attestation.attester == subject, Error::::Unauthorized); AttestationStorageDepositCollector::::change_deposit_owner(&claim_hash, sender)?; @@ -450,7 +450,7 @@ pub mod pallet { pub fn update_deposit(origin: OriginFor, claim_hash: ClaimHashOf) -> DispatchResult { let sender = ensure_signed(origin)?; - let attestation = Attestations::::get(&claim_hash).ok_or(Error::::AttestationNotFound)?; + let attestation = Attestations::::get(claim_hash).ok_or(Error::::AttestationNotFound)?; ensure!(attestation.deposit.owner == sender, Error::::Unauthorized); AttestationStorageDepositCollector::::update_deposit(&claim_hash)?; @@ -462,7 +462,7 @@ pub mod pallet { impl Pallet { fn remove_attestation(attestation: AttestationDetails, claim_hash: ClaimHashOf) { kilt_support::free_deposit::, CurrencyOf>(&attestation.deposit); - Attestations::::remove(&claim_hash); + Attestations::::remove(claim_hash); if let Some(authorization_id) = &attestation.authorization_id { ExternalAttestations::::remove(authorization_id, claim_hash); } diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 98d7099eff..489d7b08ac 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -159,7 +159,7 @@ pub fn insert_attestation(claim_hash: ClaimHashOf, details: Attest ) .expect("Should have balance"); - crate::Attestations::::insert(&claim_hash, details.clone()); + crate::Attestations::::insert(claim_hash, details.clone()); if let Some(delegation_id) = details.authorization_id.as_ref() { crate::ExternalAttestations::::insert(delegation_id, claim_hash, true) } diff --git a/pallets/ctype/Cargo.toml b/pallets/ctype/Cargo.toml index 7f074f402b..86086fa2fd 100644 --- a/pallets/ctype/Cargo.toml +++ b/pallets/ctype/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/ctype/src/benchmarking.rs b/pallets/ctype/src/benchmarking.rs index 1f18daf7b5..95726055c9 100644 --- a/pallets/ctype/src/benchmarking.rs +++ b/pallets/ctype/src/benchmarking.rs @@ -57,7 +57,7 @@ benchmarks! { }: _(origin, ctype) verify { - let stored_ctype_creator: T::CtypeCreatorId = Ctypes::::get(&ctype_hash).expect("CType hash should be present on chain."); + let stored_ctype_creator: T::CtypeCreatorId = Ctypes::::get(ctype_hash).expect("CType hash should be present on chain."); // Verify the CType has the right owner assert_eq!(stored_ctype_creator, did); diff --git a/pallets/ctype/src/lib.rs b/pallets/ctype/src/lib.rs index 787a45f706..73f84d5308 100644 --- a/pallets/ctype/src/lib.rs +++ b/pallets/ctype/src/lib.rs @@ -160,7 +160,7 @@ pub mod pallet { let hash = ::Hashing::hash(&ctype[..]); - ensure!(!Ctypes::::contains_key(&hash), Error::::CTypeAlreadyExists); + ensure!(!Ctypes::::contains_key(hash), Error::::CTypeAlreadyExists); // *** No Fail except during withdraw beyond this point *** @@ -176,7 +176,7 @@ pub mod pallet { T::FeeCollector::on_unbalanced(imbalance); log::debug!("Creating CType with hash {:?} and creator {:?}", hash, creator); - Ctypes::::insert(&hash, creator.clone()); + Ctypes::::insert(hash, creator.clone()); Self::deposit_event(Event::CTypeCreated(creator, hash)); diff --git a/pallets/delegation/Cargo.toml b/pallets/delegation/Cargo.toml index 23ecef4a65..691e6138da 100644 --- a/pallets/delegation/Cargo.toml +++ b/pallets/delegation/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/delegation/src/benchmarking.rs b/pallets/delegation/src/benchmarking.rs index 3b29743558..73dd553b73 100644 --- a/pallets/delegation/src/benchmarking.rs +++ b/pallets/delegation/src/benchmarking.rs @@ -74,7 +74,7 @@ where ::Currency::minimum_balance() + ::Deposit::get() + ::Deposit::get(), ); - ctype::Ctypes::::insert(&ctype_hash, T::CtypeCreatorId::from(root_acc.clone())); + ctype::Ctypes::::insert(ctype_hash, T::CtypeCreatorId::from(root_acc.clone())); Pallet::::create_hierarchy( ::EnsureOrigin::generate_origin(sender, root_acc.clone()), @@ -148,7 +148,7 @@ where )?; // only return first leaf - first_leaf = first_leaf.or(Some((delegation_acc_public, delegation_acc_id, delegation_id))); + first_leaf = first_leaf.or_else(|| Some((delegation_acc_public, delegation_acc_id, delegation_id))); } let (leaf_acc_public, leaf_acc_id, leaf_id) = @@ -234,7 +234,7 @@ benchmarks! { let creator: T::DelegationEntityId = account("creator", 0, SEED); let ctype = ::default(); let delegation = generate_delegation_id::(0); - ctype::Ctypes::::insert(&ctype, ::CtypeCreatorId::from(creator.clone())); + ctype::Ctypes::::insert(ctype, ::CtypeCreatorId::from(creator.clone())); ::Currency::make_free_balance_be( &sender, ::Currency::minimum_balance() + ::Deposit::get(), diff --git a/pallets/delegation/src/lib.rs b/pallets/delegation/src/lib.rs index d2bfa76332..c6975ed07a 100644 --- a/pallets/delegation/src/lib.rs +++ b/pallets/delegation/src/lib.rs @@ -324,12 +324,12 @@ pub mod pallet { let creator = source.subject(); ensure!( - !>::contains_key(&root_node_id), + !>::contains_key(root_node_id), Error::::HierarchyAlreadyExists ); ensure!( - >::contains_key(&ctype_hash), + >::contains_key(ctype_hash), >::CTypeNotFound ); @@ -397,11 +397,11 @@ pub mod pallet { let delegator = source.subject(); ensure!( - !>::contains_key(&delegation_id), + !>::contains_key(delegation_id), Error::::DelegationAlreadyExists ); - let parent_node = >::get(&parent_id).ok_or(Error::::ParentDelegationNotFound)?; + let parent_node = >::get(parent_id).ok_or(Error::::ParentDelegationNotFound)?; let hierarchy_root_id = parent_node.hierarchy_root_id; // Calculate the hash root @@ -501,7 +501,7 @@ pub mod pallet { let invoker = ::EnsureOrigin::ensure_origin(origin)?.subject(); ensure!( - >::contains_key(&delegation_id), + >::contains_key(delegation_id), Error::::DelegationNotFound ); @@ -525,7 +525,7 @@ pub mod pallet { let (revocation_checks, _) = Self::revoke(&delegation_id, &invoker, max_revocations.saturating_add(1))?; // If the revoked node is a root node, emit also a HierarchyRevoked event. - if DelegationHierarchies::::contains_key(&delegation_id) { + if DelegationHierarchies::::contains_key(delegation_id) { Self::deposit_event(Event::HierarchyRevoked(invoker, delegation_id)); } @@ -574,7 +574,7 @@ pub mod pallet { let source = ::EnsureOrigin::ensure_origin(origin)?; let invoker = source.subject(); - let delegation = DelegationNodes::::get(&delegation_id).ok_or(Error::::DelegationNotFound)?; + let delegation = DelegationNodes::::get(delegation_id).ok_or(Error::::DelegationNotFound)?; // Node can only be removed by owner of the node, not the parent or another // ancestor @@ -589,7 +589,7 @@ pub mod pallet { let (removal_checks, _) = Self::remove(&delegation_id, max_removals.saturating_add(1))?; // If the removed node is a root node, emit also a HierarchyRemoved event. - if DelegationHierarchies::::take(&delegation_id).is_some() { + if DelegationHierarchies::::take(delegation_id).is_some() { Self::deposit_event(Event::HierarchyRemoved(invoker, delegation_id)); } @@ -628,7 +628,7 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - let delegation = DelegationNodes::::get(&delegation_id).ok_or(Error::::DelegationNotFound)?; + let delegation = DelegationNodes::::get(delegation_id).ok_or(Error::::DelegationNotFound)?; // Deposit can only be removed by the owner of the deposit, not the // parent or another ancestor. @@ -646,7 +646,7 @@ pub mod pallet { // Delete the delegation hierarchy details, if the provided ID was for a root // node. No event generated as we don't have information about the owner DID // here. - DelegationHierarchies::::remove(&delegation_id); + DelegationHierarchies::::remove(delegation_id); Ok(Some(::WeightInfo::remove_delegation(removal_checks)).into()) } @@ -662,7 +662,7 @@ pub mod pallet { pub fn change_deposit_owner(origin: OriginFor, delegation_id: DelegationNodeIdOf) -> DispatchResult { let source = ::EnsureOrigin::ensure_origin(origin)?; - let delegation = DelegationNodes::::get(&delegation_id).ok_or(Error::::DelegationNotFound)?; + let delegation = DelegationNodes::::get(delegation_id).ok_or(Error::::DelegationNotFound)?; // Deposit can only be swapped by the owner of the delegation node, not the // parent or another ancestor. @@ -678,7 +678,7 @@ pub mod pallet { pub fn update_deposit(origin: OriginFor, delegation_id: DelegationNodeIdOf) -> DispatchResult { let sender = ensure_signed(origin)?; - let delegation = DelegationNodes::::get(&delegation_id).ok_or(Error::::DelegationNotFound)?; + let delegation = DelegationNodes::::get(delegation_id).ok_or(Error::::DelegationNotFound)?; // Deposit can only be swapped by the owner of the delegation node, not the // parent or another ancestor. diff --git a/pallets/did/Cargo.toml b/pallets/did/Cargo.toml index b801840d38..5aaaef86e0 100644 --- a/pallets/did/Cargo.toml +++ b/pallets/did/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/did/src/benchmarking.rs b/pallets/did/src/benchmarking.rs index f9db408cd9..8992a56250 100644 --- a/pallets/did/src/benchmarking.rs +++ b/pallets/did/src/benchmarking.rs @@ -115,9 +115,9 @@ fn generate_base_did_call_operation( fn save_service_endpoints(did_subject: &DidIdentifierOf, endpoints: &[DidEndpoint]) { for endpoint in endpoints.iter() { - ServiceEndpoints::::insert(&did_subject, &endpoint.id, endpoint.clone()); + ServiceEndpoints::::insert(did_subject, &endpoint.id, endpoint.clone()); } - DidEndpointsCount::::insert(&did_subject, endpoints.len().saturated_into::()); + DidEndpointsCount::::insert(did_subject, endpoints.len().saturated_into::()); } benchmarks! { diff --git a/pallets/did/src/lib.rs b/pallets/did/src/lib.rs index cfa7e0dc51..ba27ddcc49 100644 --- a/pallets/did/src/lib.rs +++ b/pallets/did/src/lib.rs @@ -1244,7 +1244,7 @@ pub mod pallet { fn deposit( key: &DidIdentifierOf, ) -> Result, >>::Balance>, DispatchError> { - let did_entry = Did::::get(&key).ok_or(Error::::DidNotPresent)?; + let did_entry = Did::::get(key).ok_or(Error::::DidNotPresent)?; Ok(did_entry.deposit) } @@ -1256,8 +1256,8 @@ pub mod pallet { key: &DidIdentifierOf, deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { - let did_entry = Did::::get(&key).ok_or(Error::::DidNotPresent)?; - Did::::insert(&key, DidDetails { deposit, ..did_entry }); + let did_entry = Did::::get(key).ok_or(Error::::DidNotPresent)?; + Did::::insert(key, DidDetails { deposit, ..did_entry }); Ok(()) } diff --git a/pallets/did/src/mock.rs b/pallets/did/src/mock.rs index 537911a72f..e9f906f684 100644 --- a/pallets/did/src/mock.rs +++ b/pallets/did/src/mock.rs @@ -481,13 +481,13 @@ impl ExtBuilder { .expect("Deposit owner should have enough balance"); } for did in self.deleted_dids.iter() { - DidBlacklist::::insert(&did, ()); + DidBlacklist::::insert(did, ()); } for (did, endpoints) in self.service_endpoints.iter() { for endpoint in endpoints.iter() { - ServiceEndpoints::::insert(&did, &endpoint.id, endpoint) + ServiceEndpoints::::insert(did, &endpoint.id, endpoint) } - DidEndpointsCount::::insert(&did, endpoints.len().saturated_into::()); + DidEndpointsCount::::insert(did, endpoints.len().saturated_into::()); } }); diff --git a/pallets/pallet-did-lookup/Cargo.toml b/pallets/pallet-did-lookup/Cargo.toml index 37350f4581..a44b2cc925 100644 --- a/pallets/pallet-did-lookup/Cargo.toml +++ b/pallets/pallet-did-lookup/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/pallet-did-lookup/src/account.rs b/pallets/pallet-did-lookup/src/account.rs index b6eb29a938..057bc7f1c8 100644 --- a/pallets/pallet-did-lookup/src/account.rs +++ b/pallets/pallet-did-lookup/src/account.rs @@ -111,7 +111,7 @@ impl From for EthereumSigner { fn from(x: libsecp256k1::PublicKey) -> Self { let mut m = [0u8; 64]; m.copy_from_slice(&x.serialize()[1..65]); - let account = H160::from(H256::from_slice(Keccak256::digest(&m).as_slice())); + let account = H160::from(H256::from_slice(Keccak256::digest(m).as_slice())); EthereumSigner(account.into()) } } @@ -141,7 +141,7 @@ impl sp_runtime::traits::Verify for EthereumSignature { Ok(pubkey) => { // TODO This conversion could use a comment. Why H256 first, then H160? // TODO actually, there is probably just a better way to go from Keccak digest. - AccountId20(H160::from(H256::from_slice(Keccak256::digest(&pubkey).as_slice())).0) == *signer + AccountId20(H160::from(H256::from_slice(Keccak256::digest(pubkey).as_slice())).0) == *signer } Err(_) => { log::trace!("Error verifying signature"); diff --git a/pallets/pallet-did-lookup/src/benchmarking.rs b/pallets/pallet-did-lookup/src/benchmarking.rs index e24c0ec290..e3d85c963d 100644 --- a/pallets/pallet-did-lookup/src/benchmarking.rs +++ b/pallets/pallet-did-lookup/src/benchmarking.rs @@ -176,7 +176,7 @@ benchmarks! { let sig = sp_io::crypto::ecdsa_sign_prehashed( KeyTypeId(*b"aura"), ð_public_key, - &Keccak256::digest(&wrapped_payload).try_into().unwrap(), + &Keccak256::digest(wrapped_payload).try_into().unwrap(), ).ok_or("Error while building signature.")?; make_free_for_did::(&caller); diff --git a/pallets/pallet-did-lookup/src/lib.rs b/pallets/pallet-did-lookup/src/lib.rs index 5c14302e75..a660322a4e 100644 --- a/pallets/pallet-did-lookup/src/lib.rs +++ b/pallets/pallet-did-lookup/src/lib.rs @@ -380,7 +380,7 @@ pub mod pallet { fn deposit( key: &LinkableAccountId, ) -> Result, >>::Balance>, DispatchError> { - let record = ConnectedDids::::get(&key).ok_or(Error::::AssociationNotFound)?; + let record = ConnectedDids::::get(key).ok_or(Error::::AssociationNotFound)?; Ok(record.deposit) } @@ -392,8 +392,8 @@ pub mod pallet { key: &LinkableAccountId, deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { - let record = ConnectedDids::::get(&key).ok_or(Error::::AssociationNotFound)?; - ConnectedDids::::insert(&key, ConnectionRecord { deposit, ..record }); + let record = ConnectedDids::::get(key).ok_or(Error::::AssociationNotFound)?; + ConnectedDids::::insert(key, ConnectionRecord { deposit, ..record }); Ok(()) } diff --git a/pallets/pallet-did-lookup/src/tests.rs b/pallets/pallet-did-lookup/src/tests.rs index 27864d4f1b..9b2b77073a 100644 --- a/pallets/pallet-did-lookup/src/tests.rs +++ b/pallets/pallet-did-lookup/src/tests.rs @@ -109,7 +109,7 @@ fn test_add_association_account() { ) .is_ok()); assert_eq!( - ConnectedDids::::get(&LinkableAccountId::from(account_hash_alice.clone())), + ConnectedDids::::get(LinkableAccountId::from(account_hash_alice.clone())), Some(ConnectionRecord { did: DID_00, deposit: Deposit { @@ -119,7 +119,7 @@ fn test_add_association_account() { }) ); assert!( - ConnectedAccounts::::get(DID_00, &LinkableAccountId::from(account_hash_alice.clone())).is_some() + ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( Balances::reserved_balance(ACCOUNT_00), @@ -137,7 +137,7 @@ fn test_add_association_account() { } assert!(res.is_ok()); assert_eq!( - ConnectedDids::::get(&LinkableAccountId::from(account_hash_alice.clone())), + ConnectedDids::::get(LinkableAccountId::from(account_hash_alice.clone())), Some(ConnectionRecord { did: DID_01, deposit: Deposit { @@ -147,10 +147,10 @@ fn test_add_association_account() { }) ); assert!( - ConnectedAccounts::::get(DID_00, &LinkableAccountId::from(account_hash_alice.clone())).is_none() + ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_none() ); assert!( - ConnectedAccounts::::get(DID_01, &LinkableAccountId::from(account_hash_alice.clone())).is_some() + ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice.clone())).is_some() ); assert_eq!( Balances::reserved_balance(ACCOUNT_00), @@ -165,7 +165,7 @@ fn test_add_association_account() { ) .is_ok()); assert_eq!( - ConnectedDids::::get(&LinkableAccountId::from(account_hash_alice.clone())), + ConnectedDids::::get(LinkableAccountId::from(account_hash_alice.clone())), Some(ConnectionRecord { did: DID_01, deposit: Deposit { @@ -175,9 +175,9 @@ fn test_add_association_account() { }) ); assert!( - ConnectedAccounts::::get(DID_00, &LinkableAccountId::from(account_hash_alice.clone())).is_none() + ConnectedAccounts::::get(DID_00, LinkableAccountId::from(account_hash_alice.clone())).is_none() ); - assert!(ConnectedAccounts::::get(DID_01, &LinkableAccountId::from(account_hash_alice)).is_some()); + assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(account_hash_alice)).is_some()); assert_eq!(Balances::reserved_balance(ACCOUNT_00), 0); assert_eq!( Balances::reserved_balance(ACCOUNT_01), @@ -204,7 +204,7 @@ fn test_add_eth_association() { crate::signature::WrapType::Ethereum, ); - let sig = eth_pair.sign_prehashed(&Keccak256::digest(&wrapped_payload).try_into().unwrap()); + let sig = eth_pair.sign_prehashed(&Keccak256::digest(wrapped_payload).try_into().unwrap()); // new association. No overwrite let res = DidLookup::associate_account( @@ -214,7 +214,7 @@ fn test_add_eth_association() { ); assert!(res.is_ok()); assert_eq!( - ConnectedDids::::get(&LinkableAccountId::from(eth_account)), + ConnectedDids::::get(LinkableAccountId::from(eth_account)), Some(ConnectionRecord { did: DID_00, deposit: Deposit { @@ -223,7 +223,7 @@ fn test_add_eth_association() { } }) ); - assert!(ConnectedAccounts::::get(DID_00, &LinkableAccountId::from(eth_account)).is_some()); + assert!(ConnectedAccounts::::get(DID_00, LinkableAccountId::from(eth_account)).is_some()); assert_eq!( Balances::reserved_balance(ACCOUNT_00), ::Deposit::get() @@ -297,8 +297,8 @@ fn test_remove_association_sender() { .execute_with(|| { // remove association assert!(DidLookup::remove_sender_association(Origin::signed(ACCOUNT_00)).is_ok()); - assert_eq!(ConnectedDids::::get(&LinkableAccountId::from(ACCOUNT_00)), None); - assert!(ConnectedAccounts::::get(DID_01, &LinkableAccountId::from(ACCOUNT_00)).is_none()); + assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); + assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); assert_eq!(Balances::reserved_balance(ACCOUNT_00), 0); }); } @@ -334,8 +334,8 @@ fn test_remove_association_account() { LinkableAccountId::from(ACCOUNT_00.clone()) ) .is_ok()); - assert_eq!(ConnectedDids::::get(&LinkableAccountId::from(ACCOUNT_00)), None); - assert!(ConnectedAccounts::::get(DID_01, &LinkableAccountId::from(ACCOUNT_00)).is_none()); + assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); + assert!(ConnectedAccounts::::get(DID_01, LinkableAccountId::from(ACCOUNT_00)).is_none()); assert_eq!(Balances::reserved_balance(ACCOUNT_01), 0); }); } @@ -349,7 +349,7 @@ fn test_remove_association_account_not_found() { ]) .build() .execute_with(|| { - assert_eq!(ConnectedDids::::get(&LinkableAccountId::from(ACCOUNT_00)), None); + assert_eq!(ConnectedDids::::get(LinkableAccountId::from(ACCOUNT_00)), None); assert_noop!( DidLookup::remove_account_association( diff --git a/pallets/pallet-inflation/Cargo.toml b/pallets/pallet-inflation/Cargo.toml index fd70751574..dc4f5de4b5 100644 --- a/pallets/pallet-inflation/Cargo.toml +++ b/pallets/pallet-inflation/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/pallet-web3-names/Cargo.toml b/pallets/pallet-web3-names/Cargo.toml index 6074fd21d6..6cd3f5da41 100644 --- a/pallets/pallet-web3-names/Cargo.toml +++ b/pallets/pallet-web3-names/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/pallet-web3-names/src/lib.rs b/pallets/pallet-web3-names/src/lib.rs index 41bd784498..f2b36ebb0c 100644 --- a/pallets/pallet-web3-names/src/lib.rs +++ b/pallets/pallet-web3-names/src/lib.rs @@ -383,7 +383,7 @@ pub mod pallet { ) -> Result, DispatchError> { let name = Web3NameOf::::try_from(name_input.into_inner()).map_err(DispatchError::from)?; - ensure!(!Names::::contains_key(&owner), Error::::OwnerAlreadyExists); + ensure!(!Names::::contains_key(owner), Error::::OwnerAlreadyExists); ensure!(!Owner::::contains_key(&name), Error::::Web3NameAlreadyClaimed); ensure!(!Banned::::contains_key(&name), Error::::Web3NameBanned); @@ -423,7 +423,7 @@ pub mod pallet { /// Specifically: /// - The owner has a previously claimed name fn check_releasing_preconditions(owner: &Web3NameOwnerOf) -> Result, DispatchError> { - let name = Names::::get(&owner).ok_or(Error::::OwnerNotFound)?; + let name = Names::::get(owner).ok_or(Error::::OwnerNotFound)?; Ok(name) } @@ -480,7 +480,7 @@ pub mod pallet { /// `check_banning_preconditions` as it does not verify all the /// preconditions again. pub(crate) fn ban_name(name: &Web3NameOf) { - Banned::::insert(&name, ()); + Banned::::insert(name, ()); } /// Verify that the unbanning preconditions are verified. @@ -510,7 +510,7 @@ pub mod pallet { fn deposit( key: &T::Web3Name, ) -> Result, >>::Balance>, DispatchError> { - let w3n_entry = Owner::::get(&key).ok_or(Error::::Web3NameNotFound)?; + let w3n_entry = Owner::::get(key).ok_or(Error::::Web3NameNotFound)?; Ok(w3n_entry.deposit) } @@ -523,8 +523,8 @@ pub mod pallet { key: &T::Web3Name, deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { - let w3n_entry = Owner::::get(&key).ok_or(Error::::Web3NameNotFound)?; - Owner::::insert(&key, Web3OwnershipOf:: { deposit, ..w3n_entry }); + let w3n_entry = Owner::::get(key).ok_or(Error::::Web3NameNotFound)?; + Owner::::insert(key, Web3OwnershipOf:: { deposit, ..w3n_entry }); Ok(()) } diff --git a/pallets/parachain-staking/Cargo.toml b/pallets/parachain-staking/Cargo.toml index 3e6a8e08e6..85933c6738 100644 --- a/pallets/parachain-staking/Cargo.toml +++ b/pallets/parachain-staking/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/parachain-staking/src/benchmarking.rs b/pallets/parachain-staking/src/benchmarking.rs index 1a6c10f763..d271363b71 100644 --- a/pallets/parachain-staking/src/benchmarking.rs +++ b/pallets/parachain-staking/src/benchmarking.rs @@ -177,7 +177,7 @@ benchmarks! { let candidates = setup_collator_candidates::(n, None); for (i, c) in candidates.iter().enumerate() { fill_delegators::(m, c.clone(), i.saturated_into::()); - Rewards::::insert(&c, T::CurrencyBalance::one()); + Rewards::::insert(c, T::CurrencyBalance::one()); } let inflation = InflationInfo::new( @@ -296,7 +296,7 @@ benchmarks! { let n in (T::MinCollators::get() + 1) .. T::MaxTopCandidates::get() - 1; let m in 0 .. T::MaxDelegatorsPerCollator::get(); - let u = T::MaxUnstakeRequests::get() as u32 - 1; + let u = T::MaxUnstakeRequests::get() - 1; let candidates = setup_collator_candidates::(n, None); for (i, c) in candidates.iter().enumerate() { fill_delegators::(m, c.clone(), i.saturated_into::()); @@ -519,7 +519,7 @@ benchmarks! { } unlock_unstaked { - let u in 1 .. (T::MaxUnstakeRequests::get() as u32 - 1); + let u in 1 .. (T::MaxUnstakeRequests::get() - 1); let candidate = account("collator", 0u32, COLLATOR_ACCOUNT_SEED); let free_balance = T::CurrencyBalance::from(u128::MAX); diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index cc85b1dc9b..163540ea80 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -1980,7 +1980,7 @@ pub mod pallet { // Snapshot exposure for round for weighting reward distribution for account in collators.iter() { let state = - CandidatePool::::get(&account).expect("all members of TopCandidates must be candidates q.e.d"); + CandidatePool::::get(account).expect("all members of TopCandidates must be candidates q.e.d"); num_of_delegators = num_of_delegators.max(state.delegators.len().saturated_into::()); // sum up total stake and amount of collators, delegators @@ -2270,8 +2270,8 @@ pub mod pallet { .map(pallet_session::Pallet::::disable_index); // Kill storage - BlocksAuthored::::remove(&collator); - BlocksRewarded::::remove(&collator); + BlocksAuthored::::remove(collator); + BlocksRewarded::::remove(collator); CandidatePool::::remove(&collator); Ok(()) } diff --git a/pallets/public-credentials/Cargo.toml b/pallets/public-credentials/Cargo.toml index 52899c2060..8fc5f7dc78 100644 --- a/pallets/public-credentials/Cargo.toml +++ b/pallets/public-credentials/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/pallets/public-credentials/src/benchmarking.rs b/pallets/public-credentials/src/benchmarking.rs index ee452732bc..0434da3f8c 100644 --- a/pallets/public-credentials/src/benchmarking.rs +++ b/pallets/public-credentials/src/benchmarking.rs @@ -70,7 +70,7 @@ benchmarks! { )); let credential_id = generate_credential_id::(&creation_op, &attester); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); reserve_balance::(&sender); let origin = ::EnsureOrigin::generate_origin(sender, attester); }: _(origin, creation_op) @@ -97,7 +97,7 @@ benchmarks! { reserve_balance::(&sender); - ctype::Ctypes::::insert(&ctype_hash, attester); + ctype::Ctypes::::insert(ctype_hash, attester); Pallet::::add(origin.clone(), creation_op).expect("Pallet::add should not fail"); let credential_id_clone = credential_id.clone(); }: _(origin, credential_id_clone, None) @@ -123,7 +123,7 @@ benchmarks! { reserve_balance::(&sender); - ctype::Ctypes::::insert(&ctype_hash, attester); + ctype::Ctypes::::insert(ctype_hash, attester); Pallet::::add(origin.clone(), creation_op).expect("Pallet::add should not fail"); Pallet::::revoke(origin.clone(), credential_id.clone(), None).expect("Pallet::revoke should not fail"); let credential_id_clone = credential_id.clone(); @@ -149,7 +149,7 @@ benchmarks! { reserve_balance::(&sender); - ctype::Ctypes::::insert(&ctype_hash, attester); + ctype::Ctypes::::insert(ctype_hash, attester); Pallet::::add(origin.clone(), creation_op).expect("Pallet::add should not fail"); let credential_id_clone = credential_id.clone(); }: _(origin, credential_id_clone, None) @@ -175,7 +175,7 @@ benchmarks! { reserve_balance::(&sender); - ctype::Ctypes::::insert(&ctype_hash, attester); + ctype::Ctypes::::insert(ctype_hash, attester); Pallet::::add(origin, creation_op).expect("Pallet::add should not fail"); let origin = RawOrigin::Signed(sender); let credential_id_clone = credential_id.clone(); @@ -204,7 +204,7 @@ benchmarks! { reserve_balance::(&deposit_owner_old); reserve_balance::(&deposit_owner_new); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); Pallet::::add(origin, creation_op).expect("Pallet::add should not fail"); let credential_id_clone = credential_id.clone(); let origin = ::EnsureOrigin::generate_origin(deposit_owner_new.clone(), attester); @@ -227,7 +227,7 @@ benchmarks! { let origin = ::EnsureOrigin::generate_origin(deposit_owner.clone(), attester.clone()); reserve_balance::(&deposit_owner); - ctype::Ctypes::::insert(&ctype_hash, attester.clone()); + ctype::Ctypes::::insert(ctype_hash, attester.clone()); let credential_entry = generate_base_credential_entry::( deposit_owner.clone(), diff --git a/pallets/public-credentials/src/lib.rs b/pallets/public-credentials/src/lib.rs index 8a2c47484b..78d5d0505d 100644 --- a/pallets/public-credentials/src/lib.rs +++ b/pallets/public-credentials/src/lib.rs @@ -259,7 +259,7 @@ pub mod pallet { } = *credential.clone(); ensure!( - ctype::Ctypes::::contains_key(&ctype_hash), + ctype::Ctypes::::contains_key(ctype_hash), ctype::Error::::CTypeNotFound ); @@ -542,10 +542,10 @@ pub mod pallet { ) -> Result<(T::SubjectId, CredentialEntryOf), Error> { // Verify that the credential exists let credential_subject = - CredentialSubjects::::get(&credential_id).ok_or(Error::::CredentialNotFound)?; + CredentialSubjects::::get(credential_id).ok_or(Error::::CredentialNotFound)?; // Should never happen if the line above succeeds - Credentials::::get(&credential_subject, &credential_id) + Credentials::::get(&credential_subject, credential_id) .map(|entry| (credential_subject, entry)) .ok_or(Error::::InternalError) } @@ -560,7 +560,7 @@ pub mod pallet { // Fails if the credential does not exist OR the caller is different than the // original attester. If successful, saves the additional weight used for access // control and returns it at the end of the function. - Credentials::::try_mutate(&credential_subject, &credential_id, |credential_entry| { + Credentials::::try_mutate(credential_subject, credential_id, |credential_entry| { if let Some(credential) = credential_entry { // Additional weight is 0 if the caller is the attester, otherwise it's the // value returned by the access control check, if it does not fail. @@ -605,8 +605,8 @@ pub mod pallet { deposit: Deposit, >>::Balance>, ) -> Result<(), DispatchError> { let credential_subject = - CredentialSubjects::::get(&credential_id).ok_or(Error::::CredentialNotFound)?; - Credentials::::try_mutate(&credential_subject, &credential_id, |credential_entry| { + CredentialSubjects::::get(credential_id).ok_or(Error::::CredentialNotFound)?; + Credentials::::try_mutate(&credential_subject, credential_id, |credential_entry| { if let Some(credential) = credential_entry { credential.deposit = deposit; Ok(()) diff --git a/pallets/public-credentials/src/tests.rs b/pallets/public-credentials/src/tests.rs index cd3e7faec2..c84029d57b 100644 --- a/pallets/public-credentials/src/tests.rs +++ b/pallets/public-credentials/src/tests.rs @@ -58,7 +58,7 @@ fn add_successful_without_authorization() { DoubleOrigin(ACCOUNT_00, attester.clone()).into(), Box::new(new_credential_1.clone()) )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id_1) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id_1) .expect("Public credential details should be present on chain."); // Test this pallet logic @@ -67,7 +67,7 @@ fn add_successful_without_authorization() { assert_eq!(stored_public_credential_details.block_number, 0); assert_eq!(stored_public_credential_details.ctype_hash, ctype_hash_1); assert_eq!(stored_public_credential_details.authorization_id, None); - assert_eq!(CredentialSubjects::::get(&credential_id_1), Some(subject_id)); + assert_eq!(CredentialSubjects::::get(credential_id_1), Some(subject_id)); // Check deposit reservation logic assert_eq!(Balances::reserved_balance(ACCOUNT_00), deposit); @@ -92,7 +92,7 @@ fn add_successful_without_authorization() { Box::new(new_credential_2.clone()) )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id_2) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id_2) .expect("Public credential #2 details should be present on chain."); // Test this pallet logic @@ -101,7 +101,7 @@ fn add_successful_without_authorization() { assert_eq!(stored_public_credential_details.block_number, 1); assert_eq!(stored_public_credential_details.ctype_hash, ctype_hash_2); assert_eq!(stored_public_credential_details.authorization_id, None); - assert_eq!(CredentialSubjects::::get(&credential_id_2), Some(subject_id)); + assert_eq!(CredentialSubjects::::get(credential_id_2), Some(subject_id)); // Deposit is 2x now assert_eq!(Balances::reserved_balance(ACCOUNT_00), 2 * deposit); @@ -131,7 +131,7 @@ fn add_successful_with_authorization() { DoubleOrigin(ACCOUNT_00, attester.clone()).into(), Box::new(new_credential.clone()) )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); // Test this pallet logic @@ -140,7 +140,7 @@ fn add_successful_with_authorization() { assert_eq!(stored_public_credential_details.block_number, 0); assert_eq!(stored_public_credential_details.ctype_hash, ctype_hash); assert_eq!(stored_public_credential_details.authorization_id, Some(attester)); - assert_eq!(CredentialSubjects::::get(&credential_id), Some(subject_id)); + assert_eq!(CredentialSubjects::::get(credential_id), Some(subject_id)); }); } @@ -275,7 +275,7 @@ fn revoke_successful() { None, )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); // Test this pallet logic @@ -288,7 +288,7 @@ fn revoke_successful() { None, )); - let stored_public_credential_details_2 = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details_2 = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); assert_eq!(stored_public_credential_details, stored_public_credential_details_2); @@ -316,7 +316,7 @@ fn revoke_same_attester_wrong_ac() { Some(MockAccessControl(wrong_submitter)) )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); // Test this pallet logic @@ -415,7 +415,7 @@ fn unrevoke_successful() { None, )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); // Test this pallet logic @@ -428,7 +428,7 @@ fn unrevoke_successful() { None, )); - let stored_public_credential_details_2 = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details_2 = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); assert_eq!(stored_public_credential_details, stored_public_credential_details_2); @@ -457,7 +457,7 @@ fn unrevoke_same_attester_wrong_ac() { Some(MockAccessControl(wrong_submitter)) )); - let stored_public_credential_details = Credentials::::get(&subject_id, &credential_id) + let stored_public_credential_details = Credentials::::get(subject_id, credential_id) .expect("Public credential details should be present on chain."); // Test this pallet logic @@ -558,8 +558,8 @@ fn remove_successful() { )); // Test this pallet logic - assert!(Credentials::::get(&subject_id, &credential_id).is_none()); - assert!(CredentialSubjects::::get(&credential_id).is_none()); + assert!(Credentials::::get(subject_id, credential_id).is_none()); + assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); @@ -594,8 +594,8 @@ fn remove_same_attester_wrong_ac() { )); // Test this pallet logic - assert!(Credentials::::get(&subject_id, &credential_id).is_none()); - assert!(CredentialSubjects::::get(&credential_id).is_none()); + assert!(Credentials::::get(subject_id, credential_id).is_none()); + assert!(CredentialSubjects::::get(credential_id).is_none()); }); } @@ -689,8 +689,8 @@ fn reclaim_deposit_successful() { )); // Test this pallet logic - assert!(Credentials::::get(&subject_id, &credential_id).is_none()); - assert!(CredentialSubjects::::get(&credential_id).is_none()); + assert!(Credentials::::get(subject_id, credential_id).is_none()); + assert!(CredentialSubjects::::get(credential_id).is_none()); // Check deposit release logic assert!(Balances::reserved_balance(ACCOUNT_00).is_zero()); @@ -775,7 +775,7 @@ fn test_change_deposit_owner() { // Check assert_eq!( - Credentials::::get(&subject_id, &credential_id) + Credentials::::get(subject_id, credential_id) .expect("credential should exist") .deposit .owner, @@ -867,7 +867,7 @@ fn test_update_deposit() { // Check assert_eq!( - Credentials::::get(&subject_id, &credential_id) + Credentials::::get(subject_id, credential_id) .expect("credential should exist") .deposit .amount, diff --git a/runtime-api/did/Cargo.toml b/runtime-api/did/Cargo.toml index dd9a182d9a..51a5972ebc 100644 --- a/runtime-api/did/Cargo.toml +++ b/runtime-api/did/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtime-api/public-credentials/Cargo.toml b/runtime-api/public-credentials/Cargo.toml index 03306deb9c..4d983407b0 100644 --- a/runtime-api/public-credentials/Cargo.toml +++ b/runtime-api/public-credentials/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtime-api/staking/Cargo.toml b/runtime-api/staking/Cargo.toml index 4e558ad32e..aad32cd56c 100644 --- a/runtime-api/staking/Cargo.toml +++ b/runtime-api/staking/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtimes/clone/Cargo.toml b/runtimes/clone/Cargo.toml index 0d69ce9022..08d04490e9 100644 --- a/runtimes/clone/Cargo.toml +++ b/runtimes/clone/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtimes/common/Cargo.toml b/runtimes/common/Cargo.toml index d52a090826..9c3aec069f 100644 --- a/runtimes/common/Cargo.toml +++ b/runtimes/common/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtimes/peregrine/Cargo.toml b/runtimes/peregrine/Cargo.toml index 236a78fcd9..30302fdb9c 100644 --- a/runtimes/peregrine/Cargo.toml +++ b/runtimes/peregrine/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtimes/peregrine/src/lib.rs b/runtimes/peregrine/src/lib.rs index 03aea78233..94a4b7eebf 100644 --- a/runtimes/peregrine/src/lib.rs +++ b/runtimes/peregrine/src/lib.rs @@ -1258,13 +1258,13 @@ impl_runtime_apis! { impl kilt_runtime_api_public_credentials::PublicCredentials, Hash, public_credentials::CredentialEntry::DelegationNodeId>>, PublicCredentialsFilter, PublicCredentialsApiError> for Runtime { fn get_by_id(credential_id: Hash) -> Option::DelegationNodeId>>> { - let subject = public_credentials::CredentialSubjects::::get(&credential_id)?; - public_credentials::Credentials::::get(&subject, &credential_id) + let subject = public_credentials::CredentialSubjects::::get(credential_id)?; + public_credentials::Credentials::::get(subject, credential_id) } fn get_by_subject(subject: Vec, filter: Option>) -> Result::DelegationNodeId>>)>, PublicCredentialsApiError> { let asset_did = AssetDid::try_from(subject).map_err(|_| PublicCredentialsApiError::InvalidSubjectId)?; - let credentials_prefix = public_credentials::Credentials::::iter_prefix(&asset_did); + let credentials_prefix = public_credentials::Credentials::::iter_prefix(asset_did); if let Some(filter) = filter { Ok(credentials_prefix.filter(|(_, entry)| filter.should_include(entry)).collect()) } else { diff --git a/runtimes/spiritnet/Cargo.toml b/runtimes/spiritnet/Cargo.toml index 389b1d2bbc..b542690834 100644 --- a/runtimes/spiritnet/Cargo.toml +++ b/runtimes/spiritnet/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtimes/spiritnet/src/lib.rs b/runtimes/spiritnet/src/lib.rs index 5e10aac9f1..95b62454b6 100644 --- a/runtimes/spiritnet/src/lib.rs +++ b/runtimes/spiritnet/src/lib.rs @@ -1254,13 +1254,13 @@ impl_runtime_apis! { impl kilt_runtime_api_public_credentials::PublicCredentials, Hash, public_credentials::CredentialEntry::DelegationNodeId>>, PublicCredentialsFilter, PublicCredentialsApiError> for Runtime { fn get_by_id(credential_id: Hash) -> Option::DelegationNodeId>>> { - let subject = public_credentials::CredentialSubjects::::get(&credential_id)?; - public_credentials::Credentials::::get(&subject, &credential_id) + let subject = public_credentials::CredentialSubjects::::get(credential_id)?; + public_credentials::Credentials::::get(subject, credential_id) } fn get_by_subject(subject: Vec, filter: Option>) -> Result::DelegationNodeId>>)>, PublicCredentialsApiError> { let asset_did = AssetDid::try_from(subject).map_err(|_| PublicCredentialsApiError::InvalidSubjectId)?; - let credentials_prefix = public_credentials::Credentials::::iter_prefix(&asset_did); + let credentials_prefix = public_credentials::Credentials::::iter_prefix(asset_did); if let Some(filter) = filter { Ok(credentials_prefix.filter(|(_, entry)| filter.should_include(entry)).collect()) } else { diff --git a/runtimes/standalone/Cargo.toml b/runtimes/standalone/Cargo.toml index df39ef5828..279a5f8f33 100644 --- a/runtimes/standalone/Cargo.toml +++ b/runtimes/standalone/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true diff --git a/runtimes/standalone/src/lib.rs b/runtimes/standalone/src/lib.rs index faf7fdbb46..8cfc60631f 100644 --- a/runtimes/standalone/src/lib.rs +++ b/runtimes/standalone/src/lib.rs @@ -1003,13 +1003,13 @@ impl_runtime_apis! { impl kilt_runtime_api_public_credentials::PublicCredentials, Hash, public_credentials::CredentialEntry::DelegationNodeId>>, PublicCredentialsFilter, PublicCredentialsApiError> for Runtime { fn get_by_id(credential_id: Hash) -> Option::DelegationNodeId>>> { - let subject = public_credentials::CredentialSubjects::::get(&credential_id)?; - public_credentials::Credentials::::get(&subject, &credential_id) + let subject = public_credentials::CredentialSubjects::::get(credential_id)?; + public_credentials::Credentials::::get(subject, credential_id) } fn get_by_subject(subject: Vec, filter: Option>) -> Result::DelegationNodeId>>)>, PublicCredentialsApiError> { let asset_did = AssetDid::try_from(subject).map_err(|_| PublicCredentialsApiError::InvalidSubjectId)?; - let credentials_prefix = public_credentials::Credentials::::iter_prefix(&asset_did); + let credentials_prefix = public_credentials::Credentials::::iter_prefix(asset_did); if let Some(filter) = filter { Ok(credentials_prefix.filter(|(_, entry)| filter.should_include(entry)).collect()) } else { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 514ced16b0..f5c70e2874 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,4 @@ [toolchain] -channel = "nightly-2022-07-24" +channel = "nightly-2022-10-09" +components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] diff --git a/support/Cargo.toml b/support/Cargo.toml index e0a94fb7d2..37210d0446 100644 --- a/support/Cargo.toml +++ b/support/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [package] authors.workspace = true documentation.workspace = true