Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.15.1 #854

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
17dbf5f
fix: update switch pallet read me to change file paths (#756)
ChrisChinchilla Oct 14, 2024
f057961
chore: clippy lints (#737)
ntn-x2 Oct 18, 2024
09b67ae
chore: more lints (#762)
ntn-x2 Oct 25, 2024
37ec4d1
chore: instantiatable names pallet (#779)
ntn-x2 Nov 6, 2024
6f7f587
chore: instantiatable linking pallet (#781)
ntn-x2 Nov 6, 2024
4199b6f
feat: support for unique linking (#782)
ntn-x2 Nov 6, 2024
9ffdc32
feat: new pallets into runtime (#784)
ntn-x2 Nov 6, 2024
bb72504
feat: new runtime API for unique linking (#787)
ntn-x2 Nov 7, 2024
e86f9fb
chore: update cargo-deny file (#795)
ntn-x2 Nov 14, 2024
a27c8b6
chore: test lint (#769)
ntn-x2 Nov 15, 2024
af07f5a
fix: update benchmarks (#790)
ntn-x2 Nov 18, 2024
1a4721f
chore: execute benchmark verification logic
ntn-x2 Nov 18, 2024
9c326f9
chore: udpate bash script (#800)
Ad96el Nov 20, 2024
b1039bb
chore: refactor runtimes code (#797)
ntn-x2 Nov 20, 2024
4f5429d
fix: compilation issue for xcm-emulator tests
ntn-x2 Nov 21, 2024
4148afb
fix: runtime API implementations not exported (#809)
ntn-x2 Nov 27, 2024
fe579d6
bench: add benchmarks for new deployments for Peregrine runtime (#820)
ntn-x2 Nov 29, 2024
f6a0908
feat: support gatekeeping web3names and account linkings (#813)
ntn-x2 Dec 6, 2024
b7ae8d5
ci: publish docker image only to public registry (#829)
ggera Dec 10, 2024
374e792
chore: fix cargo-deny error (#831)
ntn-x2 Dec 11, 2024
37903de
ci: make shell scripts executable (#832)
ggera Dec 11, 2024
e5eb916
feat: implement `MutateHold` for `pallet-deposit-storage` (#823)
ntn-x2 Dec 11, 2024
118ae6f
feat: pallet bonded coins (#764)
Ad96el Dec 12, 2024
9d6bab4
fix: mocks (#834)
Ad96el Dec 12, 2024
3bc40a7
feat: add support for metadata hash checks (#835)
ntn-x2 Jan 6, 2025
e8a8754
Fix env variable for metadata-hash feature enactment
ntn-x2 Jan 6, 2025
ba600bf
feat: add metadata hash check also for standalone node (#837)
ntn-x2 Jan 7, 2025
b5215c3
ci: fix tag (#838)
ggera Jan 7, 2025
628f82f
feat: change gatekeeping logic to avoid complex deployment setups (#840)
ntn-x2 Jan 8, 2025
1bd319e
feat: increase string limit (#836)
Ad96el Jan 9, 2025
34dc53d
feat: switch to WASM-only executor (#841)
ntn-x2 Jan 10, 2025
a611e1f
fix: ensure at least one currency in pool (#844)
Ad96el Jan 11, 2025
03e69c1
feat: add pool id to runtime api (#842)
Ad96el Jan 13, 2025
db4bd2e
feat: prevent DID deletions if there's linked resources (#843)
ntn-x2 Jan 15, 2025
5fa0650
chore: change struct order (#847)
Ad96el Jan 16, 2025
bb75191
1.15.0
Ad96el Jan 16, 2025
a59e8e2
fix: benchmark configuration runtime (#850)
Ad96el Jan 16, 2025
f5f3a08
fix: bonded pallet runtime call rounding is different from module (#848)
rflechtner Jan 16, 2025
1b7012a
benchmarks
Ad96el Jan 17, 2025
403e2b6
fix: benchmarks
Ad96el Jan 17, 2025
bdcc3f9
bump version
Ad96el Jan 20, 2025
6cd24a9
bump version
Ad96el Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: instantiatable names pallet (#779)
Part of KILTprotocol/ticket#3650.

Makes the web3name pallet instantiatable. I did not rename the
pallet/crate itself, and was not sure if I wanted to do it. That could
break more things and I thought we might want to leave everything else
as-is.
ntn-x2 authored Nov 6, 2024
commit 37ec4d1b77432722607c993940b217109517e3de
110 changes: 56 additions & 54 deletions pallets/pallet-web3-names/src/benchmarking.rs
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
// If you feel like getting in touch with us, you can do so at info@botlabs.org
#![cfg(feature = "runtime-benchmarks")]

use frame_benchmarking::{account, benchmarks};
use frame_benchmarking::{account, benchmarks_instance_pallet};
use frame_support::{
pallet_prelude::EnsureOrigin,
sp_runtime::{traits::Zero, SaturatedConversion},
@@ -41,163 +41,165 @@ use crate::{
const CALLER_SEED: u32 = 0;
const OWNER_SEED: u32 = 1;

fn make_free_for_did<T: Config>(account: &AccountIdOf<T>)
fn make_free_for_did<T, I>(account: &AccountIdOf<T>)
where
<T as Config>::Currency: Mutate<T::AccountId>,
T: Config<I>,
I: 'static,
<T as Config<I>>::Currency: Mutate<T::AccountId>,
{
let balance = <CurrencyOf<T> as Inspect<AccountIdOf<T>>>::minimum_balance()
+ <T as Config>::Deposit::get()
+ <T as Config>::Deposit::get();
CurrencyOf::<T>::set_balance(account, balance);
let balance = <CurrencyOf<T, I> as Inspect<AccountIdOf<T>>>::minimum_balance()
+ <T as Config<I>>::Deposit::get()
+ <T as Config<I>>::Deposit::get();
CurrencyOf::<T, I>::set_balance(account, balance);
}

fn generate_web3_name_input(length: usize) -> Vec<u8> {
vec![b'1'; length]
}

benchmarks! {
benchmarks_instance_pallet! {
where_clause {
where
T::AccountId: From<sr25519::Public>,
T::Web3NameOwner: From<T::AccountId>,
T::OwnerOrigin: GenerateBenchmarkOrigin<T::RuntimeOrigin, T::AccountId, T::Web3NameOwner>,
T::BanOrigin: EnsureOrigin<T::RuntimeOrigin>,
<T as Config>::Currency: Mutate<T::AccountId>,
<T as Config<I>>::Currency: Mutate<T::AccountId>,
}

claim {
let n in (T::MinNameLength::get()) .. (T::MaxNameLength::get());
let caller: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(generate_web3_name_input(n.saturated_into())).expect("BoundedVec creation should not fail.");
let web3_name_input_clone = web3_name_input.clone();
let origin = T::OwnerOrigin::generate_origin(caller.clone(), owner.clone());

make_free_for_did::<T>(&caller);
make_free_for_did::<T, I>(&caller);
}: _<T::RuntimeOrigin>(origin, web3_name_input_clone)
verify {
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T>::get(&owner).is_some());
assert!(Owner::<T>::get(&web3_name).is_some());
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T, I>::get(&owner).is_some());
assert!(Owner::<T, I>::get(&web3_name).is_some());
}

release_by_owner {
let caller: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(generate_web3_name_input(T::MaxNameLength::get().saturated_into())).expect("BoundedVec creation should not fail.");
let origin = T::OwnerOrigin::generate_origin(caller.clone(), owner.clone());

make_free_for_did::<T>(&caller);
Pallet::<T>::claim(origin.clone(), web3_name_input.clone()).expect("Should register the claimed web3 name.");
make_free_for_did::<T, I>(&caller);
Pallet::<T, I>::claim(origin.clone(), web3_name_input.clone()).expect("Should register the claimed web3 name.");
}: _<T::RuntimeOrigin>(origin)
verify {
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T>::get(&owner).is_none());
assert!(Owner::<T>::get(&web3_name).is_none());
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T, I>::get(&owner).is_none());
assert!(Owner::<T, I>::get(&web3_name).is_none());
}

reclaim_deposit {
let n in (T::MinNameLength::get()) .. (T::MaxNameLength::get());
let caller: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(generate_web3_name_input(n.saturated_into())).expect("BoundedVec creation should not fail.");
let web3_name_input_clone = web3_name_input.clone();
let did_origin = T::OwnerOrigin::generate_origin(caller.clone(), owner.clone());
let signed_origin = RawOrigin::Signed(caller.clone());

make_free_for_did::<T>(&caller);
Pallet::<T>::claim(did_origin, web3_name_input.clone()).expect("Should register the claimed web3 name.");
make_free_for_did::<T, I>(&caller);
Pallet::<T, I>::claim(did_origin, web3_name_input.clone()).expect("Should register the claimed web3 name.");
}: _(signed_origin, web3_name_input_clone)
verify {
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T>::get(&owner).is_none());
assert!(Owner::<T>::get(&web3_name).is_none());
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T, I>::get(&owner).is_none());
assert!(Owner::<T, I>::get(&web3_name).is_none());
}

ban {
let n in (T::MinNameLength::get()) .. (T::MaxNameLength::get());
let caller: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(generate_web3_name_input(n.saturated_into())).expect("BoundedVec creation should not fail.");
let web3_name_input_clone = web3_name_input.clone();
let did_origin = T::OwnerOrigin::generate_origin(caller.clone(), owner.clone());
let ban_origin = RawOrigin::Root;

make_free_for_did::<T>(&caller);
Pallet::<T>::claim(did_origin, web3_name_input.clone()).expect("Should register the claimed web3 name.");
make_free_for_did::<T, I>(&caller);
Pallet::<T, I>::claim(did_origin, web3_name_input.clone()).expect("Should register the claimed web3 name.");
}: _(ban_origin, web3_name_input_clone)
verify {
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T>::get(&owner).is_none());
assert!(Owner::<T>::get(&web3_name).is_none());
assert!(Banned::<T>::get(&web3_name).is_some());
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T, I>::get(&owner).is_none());
assert!(Owner::<T, I>::get(&web3_name).is_none());
assert!(Banned::<T, I>::get(&web3_name).is_some());
}

unban {
let n in (T::MinNameLength::get()) .. (T::MaxNameLength::get());
let caller: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(generate_web3_name_input(n.saturated_into())).expect("BoundedVec creation should not fail.");
let web3_name_input_clone = web3_name_input.clone();
let ban_origin = RawOrigin::Root;

make_free_for_did::<T>(&caller);
Pallet::<T>::ban(ban_origin.clone().into(), web3_name_input.clone()).expect("Should ban the web3 name.");
make_free_for_did::<T, I>(&caller);
Pallet::<T, I>::ban(ban_origin.clone().into(), web3_name_input.clone()).expect("Should ban the web3 name.");
}: _(ban_origin, web3_name_input_clone)
verify {
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T>::get(&owner).is_none());
assert!(Owner::<T>::get(&web3_name).is_none());
assert!(Banned::<T>::get(&web3_name).is_none());
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();
assert!(Names::<T, I>::get(&owner).is_none());
assert!(Owner::<T, I>::get(&web3_name).is_none());
assert!(Banned::<T, I>::get(&web3_name).is_none());
}

change_deposit_owner {
let deposit_owner_old: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let deposit_owner_new: AccountIdOf<T> = account("caller", 1, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(
generate_web3_name_input(T::MaxNameLength::get().saturated_into())
).expect("BoundedVec creation should not fail.");
let web3_name_input_clone = web3_name_input.clone();
let origin_create = T::OwnerOrigin::generate_origin(deposit_owner_old.clone(), owner.clone());

make_free_for_did::<T>(&deposit_owner_old);
make_free_for_did::<T>(&deposit_owner_new);
Pallet::<T>::claim(origin_create, web3_name_input.clone()).expect("Should register the claimed web3 name.");
make_free_for_did::<T, I>(&deposit_owner_old);
make_free_for_did::<T, I>(&deposit_owner_new);
Pallet::<T, I>::claim(origin_create, web3_name_input.clone()).expect("Should register the claimed web3 name.");

let origin = T::OwnerOrigin::generate_origin(deposit_owner_new.clone(), owner);
}: _<T::RuntimeOrigin>(origin)
verify {
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
assert_eq!(Owner::<T>::get(&web3_name).expect("w3n should exists").deposit, Deposit {
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();
assert_eq!(Owner::<T, I>::get(&web3_name).expect("w3n should exists").deposit, Deposit {
owner: deposit_owner_new,
amount: <T as Config>::Deposit::get(),
amount: <T as Config<I>>::Deposit::get(),
});
}

update_deposit {
let deposit_owner: AccountIdOf<T> = account("caller", 0, CALLER_SEED);
let owner: Web3NameOwnerOf<T> = account("owner", 0, OWNER_SEED);
let owner: Web3NameOwnerOf<T, I> = account("owner", 0, OWNER_SEED);
let web3_name_input: BoundedVec<u8, T::MaxNameLength> = BoundedVec::try_from(
generate_web3_name_input(T::MaxNameLength::get().saturated_into())
).expect("BoundedVec creation should not fail.");
let web3_name = Web3NameOf::<T>::try_from(web3_name_input.to_vec()).unwrap();
let web3_name = Web3NameOf::<T, I>::try_from(web3_name_input.to_vec()).unwrap();

make_free_for_did::<T>(&deposit_owner);
insert_raw_w3n::<T>(
make_free_for_did::<T, I>(&deposit_owner);
insert_raw_w3n::<T, I>(
deposit_owner.clone(),
owner,
web3_name.clone(),
BlockNumberFor::<T>::zero(),
<T as Config>::Deposit::get() + <T as Config>::Deposit::get()
<T as Config<I>>::Deposit::get() + <T as Config<I>>::Deposit::get()
);

let origin = RawOrigin::Signed(deposit_owner.clone());
}: _(origin, web3_name_input)
verify {
assert_eq!(Owner::<T>::get(&web3_name).expect("w3n should exists").deposit, Deposit {
assert_eq!(Owner::<T, I>::get(&web3_name).expect("w3n should exists").deposit, Deposit {
owner: deposit_owner,
amount: <T as Config>::Deposit::get(),
amount: <T as Config<I>>::Deposit::get(),
});
}

Loading