Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
865 changes: 437 additions & 428 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ homepage = "https://kilt.io/"
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/KILTprotocol/kilt-node"
version = "1.16.0-dev"
version = "1.16.1"

[workspace.dependencies]
# Build deps
Expand Down Expand Up @@ -246,7 +246,7 @@ substrate-build-script-utils = { git = "https://github.com/paritytech
substrate-frame-rpc-system = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409" }

# ISMP
# ISMP
ismp = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
ismp-parachain = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
ismp-parachain-inherent = { git = "https://github.com/polytope-labs/hyperbridge", branch = "polkadot-stable2409", default-features = false }
Expand Down
17 changes: 9 additions & 8 deletions pallets/attestation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use frame_benchmarking::{account, benchmarks};
use frame_support::traits::{fungible::Mutate, Get};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use sp_runtime::traits::Hash;
use sp_runtime::{traits::Hash, SaturatedConversion};

use ctype::CtypeEntryOf;
use kilt_support::traits::GenerateBenchmarkOrigin;
Expand Down Expand Up @@ -51,7 +51,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, 100_000_000_000_000_000_000u128.saturated_into());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester.clone());
}: _<T::RuntimeOrigin>(origin, claim_hash, ctype_hash, None)
Expand Down Expand Up @@ -79,7 +79,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, 100_000_000_000_000_000_000u128.saturated_into());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester.clone());
Pallet::<T>::add(origin.clone(), claim_hash, ctype_hash, None)?;
Expand Down Expand Up @@ -108,7 +108,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, 100_000_000_000_000_000_000u128.saturated_into());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
Expand All @@ -128,7 +128,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::set_balance(&sender, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&sender, 100_000_000_000_000_000_000u128.saturated_into());

let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), attester);
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
Expand All @@ -149,8 +149,9 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::set_balance(&deposit_owner_old, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&deposit_owner_new, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&deposit_owner_old, 100_000_000_000_000_000_000u128.saturated_into());
<T as Config>::Currency::set_balance(&deposit_owner_new, 100_000_000_000_000_000_000u128.saturated_into());


let origin = <T as Config>::EnsureOrigin::generate_origin(deposit_owner_old, attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None)?;
Expand Down Expand Up @@ -179,7 +180,7 @@ benchmarks! {
creator: attester.clone(),
created_at: 0u64.into()
});
<T as Config>::Currency::set_balance(&deposit_owner, <T as Config>::Deposit::get() + <T as Config>::Deposit::get());
<T as Config>::Currency::set_balance(&deposit_owner, 100_000_000_000_000_000_000u128.saturated_into());

let origin = <T as Config>::EnsureOrigin::generate_origin(deposit_owner.clone(), attester.clone());
Pallet::<T>::add(origin, claim_hash, ctype_hash, None).expect("claim should be added");
Expand Down
27 changes: 9 additions & 18 deletions pallets/delegation/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ use frame_support::{
dispatch::DispatchErrorWithPostInfo,
storage::bounded_btree_set::BoundedBTreeSet,
traits::{
fungible::{Inspect, InspectHold, Mutate},
fungible::{InspectHold, Mutate},
Get,
},
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use parity_scale_codec::Encode;
use sp_core::{offchain::KeyTypeId, sr25519};
use sp_io::crypto::sr25519_generate;
use sp_runtime::traits::Zero;
use sp_runtime::{traits::Zero, SaturatedConversion};
use sp_std::{num::NonZeroU32, vec::Vec};

use attestation::AttestationAccessControl;
Expand Down Expand Up @@ -78,10 +78,7 @@ where
let hierarchy_root_id = generate_delegation_id::<T>(number);

let sender: T::AccountId = account("sender", 0, SEED);
<T as Config>::Currency::set_balance(
&sender,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get() + <T as Config>::Deposit::get(),
);
<T as Config>::Currency::set_balance(&sender, 100_000_000_000_000_000_000u128.saturated_into());

ctype::Ctypes::<T>::insert(
ctype_hash,
Expand Down Expand Up @@ -150,10 +147,7 @@ where
let sig = (delegation_acc_id.clone(), hash.clone());

// add delegation from delegate to parent
<T as Config>::Currency::set_balance(
&sender,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get() + <T as Config>::Deposit::get(),
);
<T as Config>::Currency::set_balance(&sender, 100_000_000_000_000_000_000u128.saturated_into());
Pallet::<T>::add_delegation(
<T as Config>::EnsureOrigin::generate_origin(sender.clone(), parent_acc_id.clone()),
delegation_id,
Expand Down Expand Up @@ -260,7 +254,7 @@ benchmarks! {
});
<T as Config>::Currency::set_balance(
&sender,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get(),
100_000_000_000_000_000_000u128.saturated_into()
);

let origin = <T as Config>::EnsureOrigin::generate_origin(sender, creator);
Expand Down Expand Up @@ -301,7 +295,7 @@ benchmarks! {
let leaf_acc_id: T::DelegationEntityId = root_public.into();
<T as Config>::Currency::set_balance(
&sender,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get(),
100_000_000_000_000_000_000u128.saturated_into()
);
let origin = <T as Config>::EnsureOrigin::generate_origin(sender, leaf_acc_id);
}: _<T::RuntimeOrigin>(origin, delegation_id, hierarchy_id, delegate_acc_id, perm, sig)
Expand All @@ -325,7 +319,7 @@ benchmarks! {
let child_delegation = DelegationNodes::<T>::get(child_id).ok_or("Child of root should have delegation id")?;
<T as Config>::Currency::set_balance(
&child_delegation.deposit.owner,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get(),
100_000_000_000_000_000_000u128.saturated_into()
);
let origin = <T as Config>::EnsureOrigin::generate_origin(sender, child_delegation.details.owner);
}: revoke_delegation<T::RuntimeOrigin>(origin, child_id, c, r)
Expand Down Expand Up @@ -371,7 +365,6 @@ benchmarks! {
let children: BoundedBTreeSet<T::DelegationNodeId, T::MaxChildren> = root_node.children;
let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?;
let child_delegation = DelegationNodes::<T>::get(child_id).ok_or("Child of root should have delegation id")?;
assert!(!<T as Config>::Currency::total_balance_on_hold(&sender).is_zero());
let origin = <T as Config>::EnsureOrigin::generate_origin(sender.clone(), root_acc.into());
}: _<T::RuntimeOrigin>(origin, hierarchy_id, r)
verify {
Expand All @@ -391,7 +384,6 @@ benchmarks! {
let children: BoundedBTreeSet<T::DelegationNodeId, T::MaxChildren> = root_node.children;
let child_id: T::DelegationNodeId = *children.iter().next().ok_or("Root should have children")?;
let child_delegation = DelegationNodes::<T>::get(child_id).ok_or("Child of root should have delegation id")?;
assert!(!<T as Config>::Currency::total_balance_on_hold(&sender).is_zero());

let origin = RawOrigin::Signed(sender.clone());
}: _(origin, hierarchy_id, r)
Expand Down Expand Up @@ -465,10 +457,9 @@ benchmarks! {

<T as Config>::Currency::set_balance(
&deposit_owner_new,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get(),
100_000_000_000_000_000_000u128.saturated_into()
);

assert!(!<T as Config>::Currency::total_balance_on_hold(&deposit_owner_old).is_zero());
let origin = <T as Config>::EnsureOrigin::generate_origin(deposit_owner_new.clone(), root_acc.into());
}: _<T::RuntimeOrigin>(origin, hierarchy_id)
verify {
Expand All @@ -485,7 +476,7 @@ benchmarks! {

<T as Config>::Currency::set_balance(
&deposit_owner,
<T as Config>::Currency::minimum_balance() + <T as Config>::Deposit::get(),
100_000_000_000_000_000_000u128.saturated_into()
);

let origin = RawOrigin::Signed(deposit_owner);
Expand Down
11 changes: 1 addition & 10 deletions pallets/parachain-staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Old benchmarking macros are a mess.
#![allow(clippy::tests_outside_test_module)]

use crate::{types::RoundInfo, *};
use crate::*;
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite};
use frame_support::{
assert_ok,
Expand Down Expand Up @@ -157,8 +157,6 @@ benchmarks! {
let new_issuance = T::Currency::total_issuance();
let max_col_reward = InflationConfig::<T>::get().collator.reward_rate.per_block * MaxCollatorCandidateStake::<T>::get() * MaxSelectedCandidates::<T>::get().into();
let network_block_reward = T::NetworkRewardRate::get() * max_col_reward;
assert!(new_issuance > issuance);
assert_eq!(new_issuance - issuance, network_block_reward)
}

force_new_round {
Expand All @@ -176,13 +174,6 @@ benchmarks! {
let now = now + BlockNumberFor::<T>::one();
System::<T>::set_block_number(now);
Session::<T>::on_initialize(now);
assert_eq!(Session::<T>::current_index(), 1);
assert_eq!(Round::<T>::get(), RoundInfo {
current: 1,
first: now,
length: round.length,
});
assert!(!ForceNewRound::<T>::get());
}

set_inflation {
Expand Down
6 changes: 2 additions & 4 deletions pallets/public-credentials/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use frame_support::{
BoundedVec,
};
use frame_system::pallet_prelude::BlockNumberFor;
use sp_runtime::SaturatedConversion;
use sp_std::{boxed::Box, vec, vec::Vec};

use ctype::CtypeEntryOf;
Expand All @@ -50,10 +51,7 @@ where
<T as Config>::Currency: Mutate<T::AccountId>,
{
// Has to be more than the deposit, we do 3x just to be safe
CurrencyOf::<T>::set_balance(
acc,
<T as Config>::Deposit::get() + <T as Config>::Deposit::get() + <T as Config>::Deposit::get(),
);
CurrencyOf::<T>::set_balance(acc, 1_000_000_000_000_000_000u128.saturated_into());
}

benchmarks! {
Expand Down
2 changes: 1 addition & 1 deletion runtimes/kestrel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl pallet_aura::Config for Runtime {
type DisabledValidators = ();
type MaxAuthorities = MaxAuthorities;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
type SlotDuration = ConstU64<6000>;
type SlotDuration = ConstU64<1000>;
}

impl pallet_grandpa::Config for Runtime {
Expand Down
4 changes: 2 additions & 2 deletions runtimes/peregrine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("mashnet-node"),
impl_name: create_runtime_str!("mashnet-node"),
authoring_version: 4,
spec_version: 11600,
spec_version: 11601,
impl_version: 0,
apis: RUNTIME_API_VERSION,
transaction_version: 8,
transaction_version: 12,
state_version: 0,
};

Expand Down
4 changes: 2 additions & 2 deletions runtimes/spiritnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kilt-spiritnet"),
impl_name: create_runtime_str!("kilt-spiritnet"),
authoring_version: 1,
spec_version: 11600,
spec_version: 11601,
impl_version: 0,
apis: RUNTIME_API_VERSION,
transaction_version: 8,
transaction_version: 12,
state_version: 0,
};

Expand Down
1 change: 0 additions & 1 deletion scripts/run_benches_for_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pallets=(
pallet-balances
pallet-democracy
pallet-indices
pallet-inflation
pallet-preimage
pallet-proxy
pallet-scheduler
Expand Down
Loading