Compare commits

..

No commits in common. "main" and "main-test" have entirely different histories.

47 changed files with 1675 additions and 4087 deletions

22
Cargo.lock generated
View File

@ -1186,7 +1186,7 @@ dependencies = [
[[package]]
name = "casper-runtime"
version = "3.5.41"
version = "3.5.35"
dependencies = [
"casper-runtime-constants",
"frame-benchmarking",
@ -3530,7 +3530,7 @@ dependencies = [
[[package]]
name = "ghost-cli"
version = "0.8.5"
version = "0.8.4"
dependencies = [
"cfg-if",
"clap 4.5.4",
@ -3586,7 +3586,7 @@ dependencies = [
[[package]]
name = "ghost-machine-primitives"
version = "0.8.5"
version = "0.8.4"
dependencies = [
"lazy_static",
"sc-sysinfo",
@ -3595,7 +3595,7 @@ dependencies = [
[[package]]
name = "ghost-metrics"
version = "0.8.5"
version = "0.8.4"
dependencies = [
"assert_cmd",
"bs58 0.5.1",
@ -3650,14 +3650,13 @@ dependencies = [
[[package]]
name = "ghost-networks"
version = "0.1.26"
version = "0.1.20"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"ghost-core-primitives",
"ghost-traits",
"log",
"num-traits",
"pallet-balances",
"pallet-staking",
@ -3671,7 +3670,7 @@ dependencies = [
[[package]]
name = "ghost-node"
version = "0.8.5"
version = "0.8.4"
dependencies = [
"assert_cmd",
"color-eyre",
@ -3702,7 +3701,7 @@ dependencies = [
[[package]]
name = "ghost-rpc"
version = "0.8.5"
version = "0.8.4"
dependencies = [
"ghost-core-primitives",
"jsonrpsee",
@ -3754,7 +3753,7 @@ dependencies = [
[[package]]
name = "ghost-service"
version = "0.8.5"
version = "0.8.4"
dependencies = [
"assert_matches",
"async-trait",
@ -3838,7 +3837,7 @@ dependencies = [
[[package]]
name = "ghost-slow-clap"
version = "0.4.28"
version = "0.4.5"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -3890,11 +3889,10 @@ dependencies = [
[[package]]
name = "ghost-traits"
version = "0.3.32"
version = "0.3.26"
dependencies = [
"frame-support",
"sp-runtime 31.0.1",
"sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)",
]
[[package]]

View File

@ -17,7 +17,7 @@ homepage.workspace = true
[workspace.package]
license = "GPL-3.0-only"
authors = ["571nky", "57r37ch", "f4750"]
version = "0.8.5"
version = "0.8.4"
edition = "2021"
homepage = "https://ghostchain.io"
repository = "https://git.ghostchain.io/ghostchain/ghost-node"

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-networks"
version = "0.1.26"
version = "0.1.20"
license.workspace = true
authors.workspace = true
edition.workspace = true
@ -11,7 +11,6 @@ repository.workspace = true
scale-info = { workspace = true, features = ["derive"] }
codec = { workspace = true, features = ["max-encoded-len"] }
num-traits = { workspace = true }
log = { workspace = true }
frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
@ -32,7 +31,6 @@ default = ["std"]
std = [
"scale-info/std",
"codec/std",
"log/std",
"num-traits/std",
"frame-support/std",
"frame-system/std",

View File

@ -85,15 +85,13 @@ benchmarks! {
let (chain_id, network) = prepare_network::<T>(i, j, k);
let authority = T::RegisterOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), None);
assert!(GhostNetworks::<T>::network_indexes().is_empty());
let prev_network = GhostNetworks::<T>::networks(chain_id.clone());
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), network.clone())
verify {
assert_last_event::<T>(Event::NetworkRegistered {
chain_id: chain_id.clone(), network: network.clone(),
chain_id: chain_id.clone(), network,
}.into());
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), Some(network));
assert_eq!(GhostNetworks::<T>::network_indexes(), vec![chain_id]);
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_network_name {
@ -253,23 +251,20 @@ benchmarks! {
assert_last_event::<T>(Event::NetworkAvgBlockSpeedUpdated {
chain_id: chain_id.clone(), avg_block_speed,
}.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), None);
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
remove_network {
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let authority = T::RemoveOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let _ = create_network::<T>(chain_id.clone(), network.clone())?;
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), Some(network));
assert_eq!(GhostNetworks::<T>::network_indexes(), vec![chain_id.clone()]);
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone())
verify {
assert_last_event::<T>(Event::NetworkRemoved {
chain_id: chain_id.clone(),
}.into());
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), None);
assert!(GhostNetworks::<T>::network_indexes().is_empty());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
impl_benchmark_test_suite!(GhostNetworks, crate::mock::ExtBuilder::build(), crate::mock::Test);

View File

@ -12,7 +12,7 @@ use scale_info::TypeInfo;
use sp_runtime::{
curve::PiecewiseLinear,
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Member, UniqueSaturatedInto},
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Member},
DispatchResult,
};
use sp_std::{convert::TryInto, prelude::*};
@ -21,10 +21,11 @@ pub use ghost_traits::networks::{
NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataMutateHandler,
};
pub mod migrations;
mod math;
mod weights;
pub use crate::weights::WeightInfo;
use math::MulDiv;
pub use module::*;
#[cfg(any(feature = "runtime-benchmarks", test))]
@ -34,8 +35,6 @@ mod mock;
#[cfg(all(feature = "std", test))]
mod tests;
const LOG_TARGET: &str = "runtime::ghost-networks";
pub type BalanceOf<T> =
<<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;
@ -97,26 +96,23 @@ where
_era_duration_in_millis: u64,
) -> (Balance, Balance) {
let reward_curve = RewardCurve::get();
let bridged_imbalance = BridgedImbalance::<T>::take();
let accumulated_commission = AccumulatedCommission::<T>::take();
let bridged_imbalance = BridgedImbalance::<T>::get();
let accumulated_commission = AccumulatedCommission::<T>::get();
let accumulated_commission: Balance = accumulated_commission.into();
let adjusted_issuance: Balance = total_issuance
.saturating_add(bridged_imbalance.bridged_out.into())
.saturating_sub(bridged_imbalance.bridged_in.into());
NullifyNeeded::<T>::set(true);
let estimated_reward =
reward_curve.calculate_for_fraction_times_denominator(total_staked, adjusted_issuance);
let payout: Balance = sp_runtime::helpers_128bit::multiply_by_rational_with_rounding(
estimated_reward.unique_saturated_into(),
accumulated_commission.unique_saturated_into(),
adjusted_issuance.unique_saturated_into(),
sp_runtime::Rounding::NearestPrefUp,
)
.map(|result| result.unique_saturated_into())
.unwrap_or_default();
let payout = MulDiv::<Balance>::calculate(
estimated_reward,
accumulated_commission,
adjusted_issuance,
);
let rest_payout = accumulated_commission.saturating_sub(payout);
(payout, rest_payout)
@ -127,8 +123,6 @@ where
pub mod module {
use super::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
#[pallet::config]
pub trait Config: frame_system::Config {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
@ -155,9 +149,6 @@ pub mod module {
/// The origin required to remove network.
type RemoveOrigin: EnsureOrigin<Self::RuntimeOrigin>;
#[pallet::constant]
type MaxNetworks: Get<u32>;
/// Weight information for extrinsics in this module.
type WeightInfo: WeightInfo;
}
@ -172,8 +163,6 @@ pub mod module {
WrongGatekeeperAddress,
/// Topic name length not 66 or prefix `0x` missed.
WrongTopicName,
/// Could not store networks into bounded vector.
TooManyNetworks,
}
#[pallet::event]
@ -241,6 +230,10 @@ pub mod module {
},
}
#[pallet::storage]
#[pallet::getter(fn nullify_needed)]
pub type NullifyNeeded<T: Config> = StorageValue<_, bool, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn bridged_imbalance)]
pub type BridgedImbalance<T: Config> =
@ -250,11 +243,6 @@ pub mod module {
#[pallet::getter(fn accumulated_commission)]
pub type AccumulatedCommission<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn network_indexes)]
pub type NetworkIndexes<T: Config> =
StorageValue<_, BoundedVec<T::NetworkId, T::MaxNetworks>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn networks)]
pub type Networks<T: Config> =
@ -294,10 +282,23 @@ pub mod module {
}
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
#[pallet::without_storage_info]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
T::DbWeight::get().reads_writes(1, 1)
}
fn on_finalize(_: BlockNumberFor<T>) {
if Self::nullify_needed() {
Self::nullify_commission();
NullifyNeeded::<T>::put(false);
}
}
}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
@ -469,19 +470,12 @@ impl<T: Config> Pallet<T> {
Ok(())
})?;
NetworkIndexes::<T>::try_mutate(|ids| -> DispatchResult {
ids.try_push(chain_id)
.map_err(|_| Error::<T>::TooManyNetworks)?;
Ok(())
})?;
Self::deposit_event(Event::<T>::NetworkRegistered { chain_id, network });
Ok(())
}
/// Remove existent network.
pub fn do_remove_network(chain_id: T::NetworkId) -> DispatchResult {
NetworkIndexes::<T>::mutate(|ids| ids.retain(|id| id != &chain_id));
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
*maybe_network = None;
@ -729,39 +723,16 @@ impl<T: Config> NetworkDataBasicHandler for Pallet<T> {
}
impl<T: Config> NetworkDataInspectHandler<NetworkData> for Pallet<T> {
fn count() -> u32 {
NetworkIndexes::<T>::decode_len()
.map(|len| len as u32)
.unwrap_or_default()
}
fn contains_key(n: &Self::NetworkId) -> bool {
Networks::<T>::contains_key(n)
}
fn get(n: &Self::NetworkId) -> Option<NetworkData> {
Networks::<T>::get(n)
}
fn network_for_block(block_number: impl Into<usize>) -> Option<(Self::NetworkId, NetworkData)> {
let network_indexes = NetworkIndexes::<T>::get();
block_number
.into()
.checked_rem(network_indexes.len())
.map(|id| {
network_indexes.get(id).copied().and_then(|network_id| {
Self::get(&network_id).map(|network_data| (network_id, network_data))
})
})
.flatten()
}
fn iter() -> PrefixIterator<(Self::NetworkId, NetworkData)> {
Networks::<T>::iter()
}
fn iter_indexes() -> impl Iterator<Item = Self::NetworkId> {
NetworkIndexes::<T>::get().into_iter()
fn is_nullification_period() -> bool {
NullifyNeeded::<T>::get()
}
}
@ -849,4 +820,18 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T
}
})
}
fn nullify_commission() {
AccumulatedCommission::<T>::set(Default::default());
BridgedImbalance::<T>::set(Default::default());
}
fn trigger_nullification() {
if NullifyNeeded::<T>::get() {
Self::nullify_commission();
NullifyNeeded::<T>::put(false);
} else {
NullifyNeeded::<T>::put(true);
}
}
}

View File

@ -0,0 +1,134 @@
use crate::AtLeast32BitUnsigned;
pub struct MulDiv<Balance>(core::marker::PhantomData<Balance>);
impl<Balance> MulDiv<Balance>
where
Balance: Copy
+ AtLeast32BitUnsigned
+ num_traits::ops::wrapping::WrappingAdd
+ num_traits::ops::overflowing::OverflowingAdd
+ sp_std::ops::AddAssign
+ sp_std::ops::Not<Output = Balance>
+ sp_std::ops::Shl<Output = Balance>
+ sp_std::ops::Shr<Output = Balance>
+ sp_std::ops::BitAnd<Balance, Output = Balance>,
{
fn zero(&self) -> Balance {
0u32.into()
}
fn one(&self) -> Balance {
1u32.into()
}
fn bit_shift(&self) -> Balance {
let u32_shift: u32 = core::mem::size_of::<Balance>()
.saturating_mul(4)
.try_into()
.unwrap_or_default();
u32_shift.into()
}
fn least_significant_bits(&self, a: Balance) -> Balance {
a & ((self.one() << self.bit_shift()) - self.one())
}
fn most_significant_bits(&self, a: Balance) -> Balance {
a >> self.bit_shift()
}
fn two_complement(&self, a: Balance) -> Balance {
(!a).wrapping_add(&self.one())
}
fn adjusted_ratio(&self, a: Balance) -> Balance {
(self.two_complement(a) / a).wrapping_add(&self.one())
}
fn modulo(&self, a: Balance) -> Balance {
self.two_complement(a) % a
}
fn overflow_resistant_addition(
&self,
a0: Balance,
a1: Balance,
b0: Balance,
b1: Balance,
) -> (Balance, Balance) {
let (r0, overflow) = a0.overflowing_add(&b0);
let overflow: Balance = overflow.then(|| 1u32).unwrap_or_default().into();
let r1 = a1.wrapping_add(&b1).wrapping_add(&overflow);
(r0, r1)
}
fn overflow_resistant_multiplication(&self, a: Balance, b: Balance) -> (Balance, Balance) {
let (a0, a1) = (
self.least_significant_bits(a),
self.most_significant_bits(a),
);
let (b0, b1) = (
self.least_significant_bits(b),
self.most_significant_bits(b),
);
let (x, y) = (a1 * b0, b1 * a0);
let (r0, r1) = (a0 * b0, a1 * b1);
let (r0, r1) = self.overflow_resistant_addition(
r0,
r1,
self.least_significant_bits(x) << self.bit_shift(),
self.most_significant_bits(x),
);
let (r0, r1) = self.overflow_resistant_addition(
r0,
r1,
self.least_significant_bits(y) << self.bit_shift(),
self.most_significant_bits(y),
);
(r0, r1)
}
fn overflow_resistant_division(
&self,
mut a0: Balance,
mut a1: Balance,
b: Balance,
) -> (Balance, Balance) {
if b == self.one() {
return (a0, a1);
}
let zero: Balance = 0u32.into();
let (q, r) = (self.adjusted_ratio(b), self.modulo(b));
let (mut x0, mut x1) = (zero, zero);
while a1 != zero {
let (t0, t1) = self.overflow_resistant_multiplication(a1, q);
let (new_x0, new_x1) = self.overflow_resistant_addition(x0, x1, t0, t1);
x0 = new_x0;
x1 = new_x1;
let (t0, t1) = self.overflow_resistant_multiplication(a1, r);
let (new_a0, new_a1) = self.overflow_resistant_addition(t0, t1, a0, zero);
a0 = new_a0;
a1 = new_a1;
}
self.overflow_resistant_addition(x0, x1, a0 / b, zero)
}
fn mul_div(&self, a: Balance, b: Balance, c: Balance) -> Balance {
let (t0, t1) = self.overflow_resistant_multiplication(a, b);
self.overflow_resistant_division(t0, t1, c).0
}
pub fn calculate(a: Balance, b: Balance, c: Balance) -> Balance {
let inner = MulDiv(core::marker::PhantomData);
if c == inner.zero() {
return c;
}
inner.mul_div(a, b, c)
}
}

View File

@ -1,9 +0,0 @@
pub mod v1;
pub type MigrateV0ToV1<T> = frame_support::migrations::VersionedMigration<
0,
1,
v1::StoreNetworkIdsIntoBoundedVec<T>,
crate::Pallet<T>,
<T as frame_system::Config>::DbWeight,
>;

View File

@ -1,59 +0,0 @@
use frame_support::{
migration::clear_storage_prefix,
traits::{Get, PalletInfoAccess, UncheckedOnRuntimeUpgrade},
weights::Weight,
};
use sp_std::marker::PhantomData;
use crate::{BoundedVec, Config, NetworkIndexes, Networks, Pallet, Vec, LOG_TARGET};
pub struct StoreNetworkIdsIntoBoundedVec<T>(PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for StoreNetworkIdsIntoBoundedVec<T> {
fn on_runtime_upgrade() -> Weight {
let mut weight = T::DbWeight::get().reads(1);
let network_ids: Vec<T::NetworkId> = Networks::<T>::iter_keys().collect();
let networks_count = network_ids.len();
weight = weight.saturating_add(T::DbWeight::get().reads(networks_count as u64));
let clear_results = clear_storage_prefix(
Pallet::<T>::name().as_bytes(),
"NullifyNeeded".as_bytes(),
&[],
Some(1),
None,
);
log::info!(
target: LOG_TARGET,
"⛓️ NullifyNeeded storage succesfully removed: Loops (reads): {}, Unique removed (writes): {}",
clear_results.loops,
clear_results.unique,
);
weight = weight.saturating_add(T::DbWeight::get().reads(clear_results.loops as u64));
weight = weight.saturating_add(T::DbWeight::get().writes(clear_results.unique as u64));
let writes = BoundedVec::<T::NetworkId, T::MaxNetworks>::try_from(network_ids)
.inspect_err(|err| {
log::error!(
target: LOG_TARGET,
"⛓️ Network ids to bounded_vec migration failed: {:?}",
err,
)
})
.ok()
.map(|bounded_networks| {
NetworkIndexes::<T>::put(bounded_networks);
log::info!(
target: LOG_TARGET,
"⛓️ Network ids to bounded_vec migration success: {} networks moved",
networks_count,
);
1u64
})
.unwrap_or_default();
weight.saturating_add(T::DbWeight::get().writes(writes))
}
}

View File

@ -82,7 +82,6 @@ pallet_staking_reward_curve::build! {
parameter_types! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNetworks: u32 = 3;
}
ord_parameter_types! {
@ -99,7 +98,6 @@ impl ghost_networks::Config for Test {
type RegisterOrigin = EnsureSignedBy<RegistererAccount, AccountId>;
type UpdateOrigin = EnsureSignedBy<UpdaterAccount, AccountId>;
type RemoveOrigin = EnsureSignedBy<RemoverAccount, AccountId>;
type MaxNetworks = MaxNetworks;
type WeightInfo = ();
}

View File

@ -1,8 +1,8 @@
use super::*;
use frame_support::{assert_err, assert_ok};
use mock::{
ExtBuilder, GhostNetworks, MaxNetworks, RandomAccount, RegistererAccount, RemoverAccount,
RewardCurve, RuntimeEvent, RuntimeOrigin, System, Test, UpdaterAccount,
ExtBuilder, GhostNetworks, RandomAccount, RegistererAccount, RemoverAccount, RewardCurve,
RuntimeEvent, RuntimeOrigin, System, Test, UpdaterAccount,
};
use pallet_staking::EraPayout;
use sp_runtime::DispatchError;
@ -36,8 +36,7 @@ fn register_and_check_network(chain_id: u32, network: NetworkData) {
chain_id,
network.clone()
));
assert_eq!(Networks::<Test>::get(chain_id), Some(network));
assert_eq!(NetworkIndexes::<Test>::get(), vec![chain_id]);
assert_eq!(Networks::<Test>::get(chain_id), Some(network.clone()));
}
#[test]
@ -45,7 +44,6 @@ fn could_add_network_from_authority() {
ExtBuilder::build().execute_with(|| {
let (chain_id, network) = prepare_network_data();
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
assert_ok!(GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
chain_id,
@ -58,7 +56,6 @@ fn could_add_network_from_authority() {
},
));
assert_eq!(Networks::<Test>::get(chain_id), Some(network));
assert_eq!(NetworkIndexes::<Test>::get(), vec![chain_id]);
});
}
@ -67,7 +64,6 @@ fn could_not_add_network_from_random_account() {
ExtBuilder::build().execute_with(|| {
let (chain_id, network) = prepare_network_data();
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
assert_err!(
GhostNetworks::register_network(
RuntimeOrigin::signed(RandomAccount::get()),
@ -93,7 +89,6 @@ fn could_not_add_network_from_random_account() {
DispatchError::BadOrigin
);
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
});
}
@ -1060,7 +1055,6 @@ fn could_remove_network_from_authority_account() {
chain_id,
));
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
});
}
@ -1085,7 +1079,6 @@ fn could_not_remove_network_from_random_account() {
DispatchError::BadOrigin
);
assert_eq!(Networks::<Test>::get(chain_id), Some(network));
assert_eq!(NetworkIndexes::<Test>::get(), vec![chain_id]);
});
}
@ -1099,7 +1092,6 @@ fn could_not_remove_non_existent_network() {
crate::Error::<Test>::NetworkDoesNotExist
);
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
});
}
@ -1278,7 +1270,7 @@ fn bridged_amount_overflow_and_underflow_emits_error() {
}
#[test]
fn accumulated_commission_nullified_after_era_payout() {
fn accumulated_commission_could_be_nullified() {
ExtBuilder::build().execute_with(|| {
let commission_first: u128 = 420;
let commission_second: u128 = 69;
@ -1292,20 +1284,12 @@ fn accumulated_commission_nullified_after_era_payout() {
GhostNetworks::accumulate_commission(&commission_second,),
commission_first + commission_second
);
assert_eq!(
AccumulatedCommission::<Test>::get(),
commission_first + commission_second
);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(1, 1, 1),
(0, commission_first + commission_second)
);
GhostNetworks::nullify_commission();
assert_eq!(AccumulatedCommission::<Test>::get(), 0);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(1, 1, 1),
(0, 0)
);
});
}
@ -1393,6 +1377,7 @@ fn bridged_inlation_reward_works() {
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_ideal * 1_000,
@ -1401,9 +1386,6 @@ fn bridged_inlation_reward_works() {
),
(commission, 0)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_ideal * 1_000_000_000_000,
@ -1412,9 +1394,6 @@ fn bridged_inlation_reward_works() {
),
(commission, 0)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_ideal * 1_000_000_000_000_000_000_000_000,
@ -1424,8 +1403,6 @@ fn bridged_inlation_reward_works() {
(commission, 0)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_not_ideal * 1_000,
@ -1434,9 +1411,6 @@ fn bridged_inlation_reward_works() {
),
(13177472000, 192528000)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(13177472000 + 192528000, commission);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
@ -1446,9 +1420,6 @@ fn bridged_inlation_reward_works() {
),
(13177568884, 192431116)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(13177568884 + 192431116, commission);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
@ -1458,10 +1429,8 @@ fn bridged_inlation_reward_works() {
),
(13177568884, 192431116)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(13177568884 + 192431116, commission);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
1,
@ -1470,9 +1439,6 @@ fn bridged_inlation_reward_works() {
),
(92386700, 13277613300)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(92386700 + 13277613300, commission);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
@ -1482,9 +1448,6 @@ fn bridged_inlation_reward_works() {
),
(92253000, 13277747000)
);
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_eq!(92253000 + 13277747000, commission);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
@ -1494,8 +1457,10 @@ fn bridged_inlation_reward_works() {
),
(92253000, 13277747000)
);
assert_eq!(92253000 + 13277747000, commission);
GhostNetworks::nullify_commission();
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_ideal * 1_000,
@ -1574,7 +1539,7 @@ fn bridged_inlation_reward_works() {
}
#[test]
fn bridged_inflation_era_payout_clears_storage() {
fn bridged_inflation_era_payout_triggers_need_of_nullification() {
ExtBuilder::build().execute_with(|| {
let amount_full: u128 = 1337 * 1_000_000_000;
let commission: u128 = amount_full / 100; // 1% commission
@ -1585,13 +1550,7 @@ fn bridged_inflation_era_payout_clears_storage() {
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
let bridged_adjustment = BridgeAdjustment {
bridged_in: amount,
bridged_out: 0,
};
assert_eq!(BridgedImbalance::<Test>::get(), bridged_adjustment);
assert_eq!(AccumulatedCommission::<Test>::get(), commission);
assert_eq!(NullifyNeeded::<Test>::get(), false);
assert_eq!(
BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_ideal * 1_000,
@ -1600,8 +1559,37 @@ fn bridged_inflation_era_payout_clears_storage() {
),
(commission, 0)
);
assert_eq!(BridgedImbalance::<Test>::get(), Default::default());
assert_eq!(AccumulatedCommission::<Test>::get(), Default::default());
assert_eq!(NullifyNeeded::<Test>::get(), true);
GhostNetworks::on_finalize(69);
assert_eq!(NullifyNeeded::<Test>::get(), false);
});
}
#[test]
fn trigger_nullification_works_as_expected() {
ExtBuilder::build().execute_with(|| {
let commission: u128 = 69;
let imbalance = BridgeAdjustment {
bridged_in: 1337u128,
bridged_out: 420u128,
};
assert_eq!(AccumulatedCommission::<Test>::get(), 0);
assert_eq!(BridgedImbalance::<Test>::get(), BridgeAdjustment::default());
AccumulatedCommission::<Test>::set(commission);
BridgedImbalance::<Test>::set(imbalance.clone());
assert_eq!(AccumulatedCommission::<Test>::get(), commission);
assert_eq!(BridgedImbalance::<Test>::get(), imbalance);
assert_eq!(NullifyNeeded::<Test>::get(), false);
GhostNetworks::trigger_nullification();
assert_eq!(NullifyNeeded::<Test>::get(), true);
GhostNetworks::trigger_nullification();
assert_eq!(NullifyNeeded::<Test>::get(), false);
assert_eq!(AccumulatedCommission::<Test>::get(), 0);
assert_eq!(BridgedImbalance::<Test>::get(), BridgeAdjustment::default());
});
}
@ -1677,6 +1665,123 @@ fn check_substrate_guarantees_not_to_overflow_u32() {
});
}
#[test]
fn check_muldiv_guarantees_not_to_overflow_for_u128() {
ExtBuilder::build().execute_with(|| {
let mut a: u128 = 2;
let mut b: u128 = 3;
let mut c: u128 = 6;
let mut result: u128 = 1;
loop {
a = match a.checked_mul(1_000) {
Some(value) => value,
None => break,
};
b = match b.checked_mul(1_000) {
Some(value) => value,
None => break,
};
c = match c.checked_mul(1_000) {
Some(value) => value,
None => break,
};
result = match result.checked_mul(1_000) {
Some(value) => value,
None => break,
};
assert_eq!(MulDiv::<u128>::calculate(a, b, c), result);
}
assert_eq!(
MulDiv::<u128>::calculate(u128::MAX, u128::MAX, u128::MAX),
u128::MAX
);
assert_eq!(MulDiv::<u128>::calculate(u128::MAX, 0, 0), 0);
assert_eq!(MulDiv::<u128>::calculate(0, u128::MAX, 0), 0);
assert_eq!(MulDiv::<u128>::calculate(0, 0, u128::MAX), 0);
});
}
#[test]
fn check_muldiv_guarantees_not_to_overflow_for_u64() {
ExtBuilder::build().execute_with(|| {
let mut a: u64 = 2;
let mut b: u64 = 3;
let mut c: u64 = 6;
let mut result: u64 = 1;
loop {
a = match a.checked_mul(1_000) {
Some(value) => value,
None => break,
};
b = match b.checked_mul(1_000) {
Some(value) => value,
None => break,
};
c = match c.checked_mul(1_000) {
Some(value) => value,
None => break,
};
result = match result.checked_mul(1_000) {
Some(value) => value,
None => break,
};
assert_eq!(MulDiv::<u64>::calculate(a, b, c), result);
}
assert_eq!(
MulDiv::<u64>::calculate(u64::MAX, u64::MAX, u64::MAX),
u64::MAX
);
assert_eq!(MulDiv::<u64>::calculate(u64::MAX, 0, 0), 0);
assert_eq!(MulDiv::<u64>::calculate(0, u64::MAX, 0), 0);
assert_eq!(MulDiv::<u64>::calculate(0, 0, u64::MAX), 0);
});
}
#[test]
fn check_muldiv_guarantees_not_to_overflow_for_u32() {
ExtBuilder::build().execute_with(|| {
let mut a: u32 = 2;
let mut b: u32 = 3;
let mut c: u32 = 6;
let mut result: u32 = 1;
loop {
a = match a.checked_mul(1_000) {
Some(value) => value,
None => break,
};
b = match b.checked_mul(1_000) {
Some(value) => value,
None => break,
};
c = match c.checked_mul(1_000) {
Some(value) => value,
None => break,
};
result = match result.checked_mul(1_000) {
Some(value) => value,
None => break,
};
assert_eq!(MulDiv::<u32>::calculate(a, b, c), result);
}
assert_eq!(
MulDiv::<u32>::calculate(u32::MAX, u32::MAX, u32::MAX),
u32::MAX
);
assert_eq!(MulDiv::<u32>::calculate(u32::MAX, 0, 0), 0);
assert_eq!(MulDiv::<u32>::calculate(0, u32::MAX, 0), 0);
assert_eq!(MulDiv::<u32>::calculate(0, 0, u32::MAX), 0);
});
}
#[test]
fn check_bridged_inflation_curve_for_overflow() {
ExtBuilder::build().execute_with(|| {
@ -1684,6 +1789,7 @@ fn check_bridged_inflation_curve_for_overflow() {
let commission: u128 = amount_full / 100; // 1% commission
let amount: u128 = amount_full - commission;
let tollerance: u128 = commission / 100; // 1% tollerance
let precomputed_payout: u128 = 13177568884;
let precomputed_rest: u128 = 192431116;
assert_eq!(precomputed_payout + precomputed_rest, commission);
@ -1692,10 +1798,10 @@ fn check_bridged_inflation_curve_for_overflow() {
let mut total_staked_not_ideal: u128 = 68_000;
let mut total_issuance: u128 = 100_000;
loop {
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
assert_ok!(GhostNetworks::accumulate_commission(&commission));
assert_ok!(GhostNetworks::accumulate_incoming_imbalance(&amount));
loop {
total_staked_ideal = match total_staked_ideal.checked_mul(1_000) {
Some(value) => value,
None => break,
@ -1716,6 +1822,27 @@ fn check_bridged_inflation_curve_for_overflow() {
),
(commission, 0)
);
let (payout, rest) = BridgedInflationCurve::<RewardCurve, Test>::era_payout(
total_staked_not_ideal,
total_issuance + amount,
0,
);
let payout_deviation = if precomputed_payout > payout {
precomputed_payout - payout
} else {
payout - precomputed_payout
};
let rest_deviation = if precomputed_rest > rest {
precomputed_rest - rest
} else {
rest - precomputed_rest
};
assert!(payout_deviation < tollerance);
assert!(rest_deviation < tollerance);
}
});
}
@ -1771,106 +1898,3 @@ fn check_bridged_inflation_curve_for_big_commissions() {
}
});
}
#[test]
fn migration_from_v0_to_v1_works() {
ExtBuilder::build().execute_with(|| {
let (chain_id, network) = prepare_network_data();
let other_chain_id = chain_id.saturating_add(1);
let removed_pallet_name = <Pallet<Test> as PalletInfoAccess>::name();
let removed_storage = "NullifyNeeded";
let key = [
sp_io::hashing::twox_128(removed_pallet_name.as_bytes()).to_vec(),
sp_io::hashing::twox_128(removed_storage.as_bytes()).to_vec(),
]
.concat();
frame_support::storage::unhashed::put_raw(&key, &true.encode());
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_ok!(GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
chain_id,
network.clone(),
));
assert_ok!(GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
other_chain_id,
network.clone(),
));
NetworkIndexes::<Test>::kill();
assert!(frame_support::storage::unhashed::exists(&key));
assert_eq!(Networks::<Test>::get(chain_id), Some(network.clone()));
assert_eq!(Networks::<Test>::get(other_chain_id), Some(network));
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
type Migrate = crate::migrations::MigrateV0ToV1<Test>;
<Migrate as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
assert!(!frame_support::storage::unhashed::exists(&key));
assert_eq!(
NetworkIndexes::<Test>::get(),
vec![chain_id, other_chain_id]
);
});
}
#[test]
fn error_on_max_networks_overflow() {
ExtBuilder::build().execute_with(|| {
let (chain_id, network) = prepare_network_data();
let max_networks = MaxNetworks::get();
for index in 0..max_networks {
let other_chain_id = chain_id.saturating_add(index);
assert_ok!(GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
other_chain_id,
network.clone(),
));
}
assert_err!(
GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
chain_id.saturating_add(max_networks),
network.clone(),
),
crate::Error::<Test>::TooManyNetworks,
);
});
}
#[test]
fn migration_from_v0_to_v1_does_not_run_twice() {
ExtBuilder::build().execute_with(|| {
StorageVersion::new(1).put::<GhostNetworks>();
let (chain_id, network) = prepare_network_data();
let other_chain_id = chain_id.saturating_add(1);
assert_eq!(Networks::<Test>::get(chain_id), None);
assert_ok!(GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
chain_id,
network.clone(),
));
assert_ok!(GhostNetworks::register_network(
RuntimeOrigin::signed(RegistererAccount::get()),
other_chain_id,
network.clone(),
));
NetworkIndexes::<Test>::kill();
assert_eq!(Networks::<Test>::get(chain_id), Some(network.clone()));
assert_eq!(Networks::<Test>::get(other_chain_id), Some(network));
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
type Migrate = crate::migrations::MigrateV0ToV1<Test>;
<Migrate as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
assert_eq!(NetworkIndexes::<Test>::get(), vec![]);
});
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_networks`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-06-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -30,6 +30,7 @@
// --repeat=20
// --pallet=ghost_networks
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_networks.rs
@ -66,35 +67,33 @@ pub trait WeightInfo {
impl WeightInfo for () {
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `i` is `[1, 20]`.
/// The range of component `j` is `[1, 150]`.
/// The range of component `k` is `[1, 20]`.
fn register_network(_i: u32, j: u32, k: u32, ) -> Weight {
fn register_network(_i: u32, _j: u32, k: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 48_419_000 picoseconds.
Weight::from_parts(35_655_823, 0)
// Minimum execution time: 46_023_000 picoseconds.
Weight::from_parts(97_871_287, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 1_212
.saturating_add(Weight::from_parts(96_762, 0).saturating_mul(j.into()))
// Standard Error: 9_235
.saturating_add(Weight::from_parts(1_460_410, 0).saturating_mul(k.into()))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(2))
// Standard Error: 94_524
.saturating_add(Weight::from_parts(940_486, 0).saturating_mul(k.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight {
fn update_network_name(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_422_000 picoseconds.
Weight::from_parts(49_987_541, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 49_906_000 picoseconds.
Weight::from_parts(55_537_587, 0)
.saturating_add(Weight::from_parts(0, 3767))
// Standard Error: 87_704
.saturating_add(Weight::from_parts(92_366, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -103,13 +102,13 @@ impl WeightInfo for () {
/// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_651_000 picoseconds.
Weight::from_parts(50_776_912, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Standard Error: 1_062
.saturating_add(Weight::from_parts(838, 0).saturating_mul(n.into()))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 50_556_000 picoseconds.
Weight::from_parts(57_726_674, 0)
.saturating_add(Weight::from_parts(0, 3767))
// Standard Error: 12_261
.saturating_add(Weight::from_parts(274, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -117,11 +116,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_080_000 picoseconds.
Weight::from_parts(51_781_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 49_406_000 picoseconds.
Weight::from_parts(51_256_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -129,11 +128,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_rate_limit_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_950_000 picoseconds.
Weight::from_parts(48_925_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 49_572_000 picoseconds.
Weight::from_parts(52_584_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -141,11 +140,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_324_000 picoseconds.
Weight::from_parts(50_801_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 48_880_000 picoseconds.
Weight::from_parts(50_596_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -153,11 +152,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 46_962_000 picoseconds.
Weight::from_parts(47_729_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 48_282_000 picoseconds.
Weight::from_parts(49_137_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -165,11 +164,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_728_000 picoseconds.
Weight::from_parts(53_054_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 50_853_000 picoseconds.
Weight::from_parts(51_982_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -177,11 +176,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_632_000 picoseconds.
Weight::from_parts(49_954_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 50_343_000 picoseconds.
Weight::from_parts(52_380_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -189,11 +188,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_660_000 picoseconds.
Weight::from_parts(53_763_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 49_393_000 picoseconds.
Weight::from_parts(80_966_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -201,11 +200,11 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_164_000 picoseconds.
Weight::from_parts(48_953_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 49_579_000 picoseconds.
Weight::from_parts(51_126_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
@ -213,26 +212,24 @@ impl WeightInfo for () {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_avg_block_speed() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_789_000 picoseconds.
Weight::from_parts(52_131_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 49_579_000 picoseconds.
Weight::from_parts(51_126_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 49_720_000 picoseconds.
Weight::from_parts(50_526_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(2))
// Measured: `302`
// Estimated: `3767`
// Minimum execution time: 44_634_000 picoseconds.
Weight::from_parts(45_815_000, 0)
.saturating_add(Weight::from_parts(0, 3767))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
}

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-slow-clap"
version = "0.4.28"
version = "0.4.5"
description = "Applause protocol for the EVM bridge"
license.workspace = true
authors.workspace = true

View File

@ -90,7 +90,11 @@ benchmarks! {
session_index,
authority_index,
network_id,
last_stored_block: 69,
commitment: CommitmentDetails {
last_stored_block: 69,
commits: 420,
last_updated: 1337,
}
};
let authority_id = authorities
@ -98,47 +102,16 @@ benchmarks! {
.expect("first authority should exist");
let signature = authority_id.sign(&block_commitment.encode())
.ok_or("couldn't make signature")?;
}: _(RawOrigin::None, block_commitment, signature)
verify {
let current_block_number = <Pallet<T> as BlockNumberProvider>::current_block_number();
let stored_commitment = BlockCommitments::<T>::get(&network_id)
.get(&authority_index)
.cloned()
.unwrap_or_default();
assert_eq!(stored_commitment.last_stored_block, 69);
assert_eq!(stored_commitment.commits, 1);
assert_eq!(stored_commitment.last_updated, current_block_number);
}
try_offend_validators {
let n in 1 .. T::MaxAuthorities::get();
let d in 0 .. T::MaxAuthorities::get();
let session_index = T::ValidatorSet::session_index();
let mut validators_vec = Vec::new();
for i in 0..T::MaxAuthorities::get() {
let v = account("validator", i, 0);
validators_vec.push(v);
}
let validators = WeakBoundedVec::<ValidatorId<T>, T::MaxAuthorities>::try_from(validators_vec)
.expect("weak bounded vec should be constructed; qed");
let offence_type = OffenceType::CommitmentOffence;
let disabled_bitmap = BitMap::new(T::MaxAuthorities::get());
let mut offence_bitmap = BitMap::new(T::MaxAuthorities::get());
for i in 0..d {
offence_bitmap.set(i);
}
}: {
let _ = Pallet::<T>::try_offend_validators(
&session_index,
&validators,
offence_bitmap,
disabled_bitmap,
offence_type
);
assert_eq!(stored_commitment.last_updated, 1337);
}
impl_benchmark_test_suite!(

View File

@ -8,7 +8,7 @@ where
Ok(Some(s.as_bytes().to_vec()))
}
pub fn de_string_to_block_number<'de, D>(de: D) -> Result<Option<u64>, D::Error>
pub fn de_string_to_u64<'de, D>(de: D) -> Result<Option<u64>, D::Error>
where
D: Deserializer<'de>,
{
@ -17,7 +17,7 @@ where
Ok(u64::from_str_radix(s, 16).ok())
}
pub fn de_string_to_block_number_pure<'de, D>(de: D) -> Result<u64, D::Error>
pub fn de_string_to_u64_pure<'de, D>(de: D) -> Result<u64, D::Error>
where
D: Deserializer<'de>,
{

View File

@ -1,14 +1,14 @@
use sp_runtime::{traits::UniqueSaturatedInto, SaturatedConversion, Saturating};
use sp_runtime::SaturatedConversion;
use sp_staking::SessionIndex;
use crate::{
deserialisations::{
de_string_to_block_number, de_string_to_block_number_pure, de_string_to_bytes,
de_string_to_h256, de_string_to_vec_of_bytes,
de_string_to_bytes, de_string_to_h256, de_string_to_u64, de_string_to_u64_pure,
de_string_to_vec_of_bytes,
},
AuthIndex, BalanceOf, BlockCommitment, BlockCommitments, BlockNumberFor, Call, Clap, Config,
Decode, Deserialize, Encode, ExternalBlockNumber, NetworkIdOf, RuntimeAppPublic, RuntimeDebug,
SubmitTransaction, Vec, BLOCK_COMMITMENT_DELAY, H256, LOG_TARGET,
AuthIndex, BalanceOf, BlockCommitment, BlockCommitments, Call, Clap, CommitmentDetails, Config,
Decode, Deserialize, Encode, NetworkIdOf, RuntimeAppPublic, RuntimeDebug, SubmitTransaction,
Vec, COMMITMENT_DELAY_MILLIS, H256, LOG_TARGET,
};
const NUMBER_OF_TOPICS: usize = 3;
@ -28,8 +28,8 @@ pub struct EvmResponse {
#[derive(RuntimeDebug, Clone, PartialEq, Deserialize, Encode, Decode)]
#[serde(untagged)]
pub enum EvmResponseType {
#[serde(deserialize_with = "de_string_to_block_number_pure")]
BlockNumber(ExternalBlockNumber),
#[serde(deserialize_with = "de_string_to_u64_pure")]
BlockNumber(u64),
TransactionLogs(Vec<Log>),
}
@ -38,14 +38,34 @@ pub enum EvmResponseType {
pub struct Log {
#[serde(default, deserialize_with = "de_string_to_h256")]
pub transaction_hash: Option<H256>,
#[serde(default, deserialize_with = "de_string_to_block_number")]
pub block_number: Option<ExternalBlockNumber>,
#[serde(default, deserialize_with = "de_string_to_u64")]
pub block_number: Option<u64>,
#[serde(default, deserialize_with = "de_string_to_vec_of_bytes")]
pub topics: Vec<Vec<u8>>,
pub removed: bool,
}
impl EvmResponseType {
fn prepare_block_commitment<T: Config>(
&self,
from_block: u64,
authority_index: AuthIndex,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
) -> BlockCommitment<NetworkIdOf<T>> {
let last_updated = sp_io::offchain::timestamp().unix_millis();
BlockCommitment {
session_index,
authority_index,
network_id,
commitment: CommitmentDetails {
last_stored_block: from_block,
last_updated,
commits: 420,
},
}
}
fn prepare_clap<T: Config>(
&self,
authority_index: AuthIndex,
@ -144,30 +164,30 @@ impl EvmResponseType {
fn sign_and_submit_block_commitment<T: Config>(
&self,
block_now: BlockNumberFor<T>,
from_block: ExternalBlockNumber,
from_block: u64,
authority_index: AuthIndex,
authority_key: T::AuthorityId,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
) {
let block_commitment = BlockCommitment {
session_index,
let block_commitment = self.prepare_block_commitment::<T>(
from_block,
authority_index,
session_index,
network_id,
last_stored_block: from_block,
};
);
let stored_last_updated = BlockCommitments::<T>::get(&network_id)
.get(&authority_index)
.map(|details| {
details
.last_updated
.saturating_add(BLOCK_COMMITMENT_DELAY.unique_saturated_into())
})
.map(|details| details.last_updated)
.unwrap_or_default();
if block_now < stored_last_updated {
let current_last_updated = block_commitment
.commitment
.last_updated
.saturating_sub(COMMITMENT_DELAY_MILLIS);
if current_last_updated < stored_last_updated {
return;
}
@ -209,8 +229,7 @@ impl EvmResponseType {
pub fn sign_and_submit<T: Config>(
&self,
block_now: BlockNumberFor<T>,
from_block: ExternalBlockNumber,
from_block: u64,
authority_index: AuthIndex,
authority_key: T::AuthorityId,
session_index: SessionIndex,
@ -224,7 +243,6 @@ impl EvmResponseType {
network_id,
),
EvmResponseType::BlockNumber(_) => self.sign_and_submit_block_commitment::<T>(
block_now,
from_block,
authority_index,
authority_key,

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
pub mod v3;
pub type MigrateV2ToV3<T> = frame_support::migrations::VersionedMigration<
2,
3,
v3::CommitmentDetailsTypesChanged<T>,
crate::Pallet<T>,
<T as frame_system::Config>::DbWeight,
>;

View File

@ -1,71 +0,0 @@
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
storage,
traits::{Get, UncheckedOnRuntimeUpgrade},
weights::Weight,
};
use ghost_networks::NetworkDataInspectHandler;
use scale_info::TypeInfo;
use sp_runtime::traits::{BlockNumberProvider, UniqueSaturatedInto};
use sp_runtime::RuntimeDebug;
use sp_std::marker::PhantomData;
use crate::{AuthIndex, BTreeMap, BlockCommitments, CommitmentDetails, Config, Pallet, LOG_TARGET};
#[derive(
RuntimeDebug,
Default,
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
TypeInfo,
MaxEncodedLen,
)]
pub struct OldCommitmentDetails {
pub last_stored_block: u64,
pub last_updated: u64,
pub commits: u64,
}
pub struct CommitmentDetailsTypesChanged<T>(PhantomData<T>);
impl<T: Config> UncheckedOnRuntimeUpgrade for CommitmentDetailsTypesChanged<T> {
fn on_runtime_upgrade() -> Weight {
let mut weight = T::DbWeight::get().reads(3);
let current_block_number = <Pallet<T> as BlockNumberProvider>::current_block_number();
for network_id in T::NetworkDataHandler::iter_indexes() {
let mut new_btree_map = BTreeMap::new();
let key_hash = BlockCommitments::<T>::hashed_key_for(&network_id);
let old_commitments = storage::unhashed::take_or_default::<
BTreeMap<AuthIndex, OldCommitmentDetails>,
>(&key_hash);
for (authority_index, details) in old_commitments.iter() {
new_btree_map.insert(
authority_index,
CommitmentDetails {
last_stored_block: details.last_stored_block,
last_updated: current_block_number,
commits: details.commits.unique_saturated_into(),
},
);
}
BlockCommitments::<T>::insert(&network_id, new_btree_map);
weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1));
log::info!(
target: LOG_TARGET,
"👻 Block commitments migrated from unix timestamp to internal block for network {:?}",
network_id,
);
}
weight
}
}

View File

@ -130,7 +130,6 @@ parameter_types! {
parameter_types! {
pub static MockAverageSessionLength: Option<u64> = None;
pub const MaxNetworks: u32 = 5;
}
impl ghost_networks::Config for Runtime {
@ -140,7 +139,6 @@ impl ghost_networks::Config for Runtime {
type RegisterOrigin = EnsureRoot<Self::AccountId>;
type UpdateOrigin = EnsureRoot<Self::AccountId>;
type RemoveOrigin = EnsureRoot<Self::AccountId>;
type MaxNetworks = MaxNetworks;
type WeightInfo = ();
}
@ -159,7 +157,6 @@ parameter_types! {
pub static ExistentialDeposit: u64 = 2;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const HistoryDepth: u32 = 10;
pub const EpochDuration: u64 = 80;
}
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
@ -177,15 +174,6 @@ impl ExposureListener<Balance, u64> for TestExposureListener
where
Balance: AtLeast32BitUnsigned + From<u64>,
{
fn get_accounts_by_indexes(
indexes_iterator: impl Iterator<Item = usize>,
) -> sp_std::prelude::Vec<u64> {
let all_validators = FixedValidators::get();
indexes_iterator
.filter_map(|i| all_validators.get(i).copied())
.collect()
}
fn get_account_by_index(index: usize) -> Option<u64> {
FixedValidators::get().get(index).copied()
}
@ -223,7 +211,6 @@ impl Config for Runtime {
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type HistoryDepth = HistoryDepth;
type MinAuthoritiesNumber = ConstU32<1>;
type EpochDuration = EpochDuration;
type WeightInfo = ();
}

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_slow_clap`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-11-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -49,28 +49,21 @@ use core::marker::PhantomData;
pub trait WeightInfo {
fn slow_clap() -> Weight;
fn commit_block()-> Weight;
fn try_offend_validators(validators_len: u32, offenders_len: u32) -> Weight;
}
impl WeightInfo for () {
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:1)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplauseDetails` (r:1 w:1)
/// Proof: `GhostSlowClaps::ApplauseDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
/// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::DisabledAuthorityIndexes` (r:1 w:0)
/// Proof: `GhostSlowClaps::DisabledAuthorityIndexes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::TotalExposure` (r:1 w:0)
/// Proof: `GhostSlowClaps::TotalExposure` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:1 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:1)
/// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ClapsInSession` (r:1 w:1)
/// Proof: `GhostSlowClaps::ClapsInSession` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:1)
/// Proof: `GhostSlowClaps::ApplausesForTransaction` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NullifyNeeded` (r:1 w:0)
/// Proof: `GhostNetworks::NullifyNeeded` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::GatekeeperAmount` (r:1 w:1)
/// Proof: `GhostNetworks::GatekeeperAmount` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::BridgedImbalance` (r:1 w:1)
@ -81,70 +74,16 @@ impl WeightInfo for () {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn slow_clap() -> Weight {
// Proof Size summary in bytes:
// Measured: `1417`
// Estimated: `4882`
// Minimum execution time: 305_397_000 picoseconds.
Weight::from_parts(310_207_000, 0)
.saturating_add(Weight::from_parts(0, 4882))
.saturating_add(RocksDbWeight::get().reads(13))
.saturating_add(RocksDbWeight::get().writes(6))
// Measured: `355`
// Estimated: `3820`
// Minimum execution time: 213_817_000 picoseconds.
Weight::from_parts(216_977_000, 0)
.saturating_add(Weight::from_parts(0, 3820))
.saturating_add(RocksDbWeight::get().reads(10))
.saturating_add(RocksDbWeight::get().writes(7))
}
/// Storage: `Session::CurrentIndex` (r:1 w:0)
/// Proof: `Session::CurrentIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:0)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::BlockCommitments` (r:1 w:1)
/// Proof: `GhostSlowClaps::BlockCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn commit_block() -> Weight {
// Proof Size summary in bytes:
// Measured: `701`
// Estimated: `4166`
// Minimum execution time: 88_007_000 picoseconds.
Weight::from_parts(89_662_000, 0)
.saturating_add(Weight::from_parts(0, 4166))
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `Staking::ActiveEra` (r:1 w:0)
/// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:100000 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakers` (r:100000 w:0)
/// Proof: `Staking::ErasStakers` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Offences::ConcurrentReportsIndex` (r:1 w:1)
/// Proof: `Offences::ConcurrentReportsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Offences::Reports` (r:97959 w:97959)
/// Proof: `Offences::Reports` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashRewardFraction` (r:1 w:0)
/// Proof: `Staking::SlashRewardFraction` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `Staking::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `Staking::Invulnerables` (r:1 w:0)
/// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashingSpans` (r:97959 w:97959)
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::DisabledValidators` (r:1 w:1)
/// Proof: `Staking::DisabledValidators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 100000]`.
/// The range of component `d` is `[0, 100000]`.
fn try_offend_validators(n: u32, d: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `674`
// Estimated: `1886 + d * (2567 ±0)`
// Minimum execution time: 13_294_008_000 picoseconds.
Weight::from_parts(13_307_595_000, 0)
.saturating_add(Weight::from_parts(0, 1886))
// Standard Error: 1_146_439
.saturating_add(Weight::from_parts(29_632_292, 0).saturating_mul(n.into()))
// Standard Error: 1_146_441
.saturating_add(Weight::from_parts(14_654_685, 0).saturating_mul(d.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(d.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2567).saturating_mul(d.into()))
fn commit_block()-> Weight {
Default::default()
}
}

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-traits"
version = "0.3.32"
version = "0.3.26"
license.workspace = true
authors.workspace = true
edition.workspace = true
@ -10,12 +10,10 @@ repository.workspace = true
[dependencies]
frame-support = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
[features]
default = ["std"]
std = [
"frame-support/std",
"sp-runtime/std",
"sp-std/std",
]

View File

@ -1,9 +1,6 @@
use sp_runtime::traits::AtLeast32BitUnsigned;
pub trait ExposureListener<Balance: AtLeast32BitUnsigned, AccountId> {
fn get_accounts_by_indexes(
indexes: impl Iterator<Item = usize>,
) -> sp_std::prelude::Vec<AccountId>;
fn get_account_by_index(index: usize) -> Option<AccountId>;
fn get_total_exposure() -> Balance;
fn get_validator_exposure(index: &AccountId) -> Balance;

View File

@ -16,12 +16,9 @@ pub trait NetworkDataBasicHandler {
}
pub trait NetworkDataInspectHandler<Network>: NetworkDataBasicHandler {
fn count() -> u32;
fn contains_key(n: &Self::NetworkId) -> bool;
fn network_for_block(b: impl Into<usize>) -> Option<(Self::NetworkId, Network)>;
fn get(n: &Self::NetworkId) -> Option<Network>;
fn iter() -> PrefixIterator<(Self::NetworkId, Network)>;
fn iter_indexes() -> impl Iterator<Item = Self::NetworkId>;
fn is_nullification_period() -> bool;
}
pub trait NetworkDataMutateHandler<Network, Balance>: NetworkDataInspectHandler<Network> {
@ -39,5 +36,8 @@ pub trait NetworkDataMutateHandler<Network, Balance>: NetworkDataInspectHandler<
fn accumulate_outgoing_imbalance(amount: &Balance) -> Result<Balance, ()>;
fn accumulate_incoming_imbalance(amount: &Balance) -> Result<Balance, ()>;
fn accumulate_commission(commission: &Balance) -> Result<Balance, ()>;
fn nullify_commission();
fn trigger_nullification();
}

View File

@ -1,6 +1,6 @@
[package]
name = "casper-runtime"
version = "3.5.41"
version = "3.5.35"
build = "build.rs"
description = "Runtime of the Casper Network"
edition.workspace = true

View File

@ -86,20 +86,6 @@ where
u128: From<T::CurrencyBalance>,
AccountIdOf<T>: From<<T as pallet_session::Config>::ValidatorId>,
{
fn get_accounts_by_indexes(
indexes_iterator: impl Iterator<Item = usize>,
) -> sp_std::prelude::Vec<AccountIdOf<T>> {
let all_validators = pallet_session::Pallet::<T>::validators();
indexes_iterator
.filter_map(|index| {
all_validators.get(index).map(|validator| {
let account_id: AccountIdOf<T> = validator.clone().into();
account_id
})
})
.collect()
}
fn get_account_by_index(index: usize) -> Option<AccountIdOf<T>> {
pallet_session::Pallet::<T>::validators()
.get(index)

View File

@ -25,10 +25,9 @@ use runtime_common::{
CurrencyToVote, SlowAdjustingFeeUpdate,
};
#[cfg(not(feature = "runtime-benchmarks"))]
use frame_support::traits::tokens::pay::PayFromAccount;
#[cfg(feature = "runtime-benchmarks")]
use runtime_common::benchmarking::{BenchmarkTreasuryHelper, BenchmarkTreasuryPaymaster};
use runtime_common::benchmarking::BenchmarkTreasuryHelper;
use codec::{Decode, Encode, MaxEncodedLen};
use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
@ -83,10 +82,9 @@ pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, StakingExposur
// Governance configuration.
pub mod cult;
#[cfg(not(feature = "runtime-benchmarks"))]
use cult::CultTreasurySpender;
use cult::{
pallet_cult_origins, CultCollectiveInstance, Degens, Geniuses, Ghosts, Skeletons, Zombies,
pallet_cult_origins, CultCollectiveInstance, CultTreasurySpender, Degens, Geniuses, Ghosts,
Skeletons, Zombies,
};
pub const LOG_TARGET: &str = "runtime::casper";
@ -119,8 +117,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("casper"),
impl_name: create_runtime_str!("casper-svengali"),
authoring_version: 0,
spec_version: 6,
impl_version: 4,
spec_version: 3,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
@ -172,7 +170,7 @@ impl frame_system::Config for Runtime {
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
type SS58Prefix = SS58Prefix;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
@ -220,7 +218,10 @@ impl pallet_preimage::Config for Runtime {
}
parameter_types! {
pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64;
pub const EpochDuration: u64 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS as u64,
2 * MINUTES as u64
);
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
pub const ReportLongevity: u64 =
BondingDuration::get() as u64 *
@ -236,7 +237,7 @@ impl pallet_babe::Config for Runtime {
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type WeightInfo = weights::pallet_babe::WeightInfo<Runtime>;
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxNominators;
@ -331,8 +332,14 @@ impl pallet_session::historical::Config for Runtime {
}
parameter_types! {
pub SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
pub UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
pub SignedPhase: u32 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS / 4,
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
);
pub UnsignedPhase: u32 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS / 4,
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
);
// signed config
pub const SignedMaxSubmissions: u32 = 16;
@ -560,30 +567,19 @@ impl pallet_identity::Config for Runtime {
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 10 * CSPR;
pub const ProposalBondMaximum: Balance = 50 * CSPR;
pub const SpendPeriod: BlockNumber = 24 * DAYS;
pub const Burn: Permill = Permill::from_percent(0);
pub const MaxBalance: Balance = Balance::MAX;
pub const PayoutPeriod: BlockNumber = 30 * DAYS;
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const DataDepositPerByte: Balance = 1 * STRH;
pub const MaxApprovals: u32 = 1000;
pub const MaxApprovals: u32 = 100;
pub const MaxAuthorities: u32 = 100_000;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const ProposalBondMinimum: Balance = 10 * CSPR;
pub const ProposalBondMaximum: Balance = 50 * CSPR;
pub const SpendPeriod: BlockNumber = 6 * DAYS;
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const ProposalBondMinimum: Balance = ExistentialDeposit::get() * 100;
pub const ProposalBondMaximum: Balance = ExistentialDeposit::get() * 500;
pub const SpendPeriod: BlockNumber = 1;
}
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
@ -598,29 +594,30 @@ impl pallet_treasury::Config for Runtime {
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ProposalBondMaximum;
type SpendPeriod = SpendPeriod;
#[cfg(feature = "runtime-benchmarks")]
type ProposalBondMinimum = ConstU128<{ ExistentialDeposit::get() * 100 }>;
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBondMaximum = ProposalBondMaximum;
#[cfg(feature = "runtime-benchmarks")]
type ProposalBondMaximum = ConstU128<{ ExistentialDeposit::get() * 500 }>;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = ();
type SpendFunds = Bounties;
type MaxApprovals = MaxApprovals;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type WeightInfo = ();
#[cfg(not(feature = "runtime-benchmarks"))]
type SpendOrigin = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, CultTreasurySpender>;
#[cfg(feature = "runtime-benchmarks")]
type SpendOrigin = EnsureRootWithSuccess<AccountId, MaxBalance>;
type AssetKind = ();
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
#[cfg(not(feature = "runtime-benchmarks"))]
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
#[cfg(feature = "runtime-benchmarks")]
type Paymaster = BenchmarkTreasuryPaymaster;
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = PayoutPeriod;
@ -628,43 +625,30 @@ impl pallet_treasury::Config for Runtime {
type BenchmarkHelper = BenchmarkTreasuryHelper;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const BountyValueMinimum: Balance = 1 * STRH;
pub const CuratorDepositMin: Balance = 10 * CSPR;
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const BountyValueMinimum: Balance = ExistentialDeposit::get() * 10;
pub const CuratorDepositMin: Balance = ExistentialDeposit::get();
}
parameter_types! {
pub const BountyDepositBase: Balance = 10 * CSPR;
pub const BountyDepositPayoutDelay: BlockNumber = DAYS;
pub const BountyUpdatePeriod: BlockNumber = 2 * WEEKS;
pub const MaximumReasonLength: u32 = 16_384;
pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50);
pub const CuratorDepositMin: Balance = 10 * CSPR;
pub const CuratorDepositMax: Balance = 200 * CSPR;
pub const BountyValueMinimum: Balance = 10 * CSPR;
}
impl pallet_bounties::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = BountyDepositBase;
type CuratorDepositMin = CuratorDepositMin;
type DataDepositPerByte = DataDepositPerByte;
type BountyValueMinimum = BountyValueMinimum;
type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
type BountyUpdatePeriod = BountyUpdatePeriod;
type CuratorDepositMultiplier = CuratorDepositMultiplier;
type CuratorDepositMin = CuratorDepositMin;
type CuratorDepositMax = CuratorDepositMax;
type BountyValueMinimum = BountyValueMinimum;
type ChildBountyManager = ChildBounties;
type DataDepositPerByte = DataDepositPerByte;
type MaximumReasonLength = MaximumReasonLength;
type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>;
type WeightInfo = ();
}
parameter_types! {
@ -676,7 +660,7 @@ impl pallet_child_bounties::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = MaxActiveChildBountyCount;
type ChildBountyValueMinimum = ChildBountyValueMinimum;
type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>;
type WeightInfo = ();
}
impl pallet_offences::Config for Runtime {
@ -701,7 +685,7 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_grandpa::WeightInfo<Runtime>;
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxNominators;
@ -994,7 +978,7 @@ impl pallet_collective::Config<AllianceCollective> for Runtime {
type MaxProposals = ConstU32<ALLIANCE_MAX_PROPOSALS>;
type MaxMembers = ConstU32<ALLIANCE_MAX_MEMBERS>;
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}
@ -1045,7 +1029,6 @@ impl ghost_networks::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type NetworkId = u64;
type Currency = Balances;
type MaxNetworks = ConstU32<30>;
type RegisterOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Ghosts>;
type UpdateOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
@ -1075,22 +1058,14 @@ impl ghost_claims::Config<CultCollectiveInstance> for Runtime {
}
parameter_types! {
// will be used in `Perbill::from_parts()`
pub const ApplauseThreshold: u32 = 500_000_000;
pub const MinAuthoritiesNumber: u32 = 5;
pub const SlowClapUnsignedPriority: TransactionPriority = TransactionPriority::MAX;
pub const SlowClapHistoryDepth: sp_staking::SessionIndex =
StakingHistoryDepth::get() * SessionsPerEra::get();
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const ApplauseThreshold: u32 = 0;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const ApplauseThreshold: u32 = 500_000_000;
}
impl ghost_slow_clap::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = SlowClapId;
@ -1103,13 +1078,11 @@ impl ghost_slow_clap::Config for Runtime {
type DisabledValidators = Session;
type ExposureListener = StakingExposureListener<Runtime>;
type ApplauseThreshold = ApplauseThreshold;
type MaxAuthorities = MaxAuthorities;
type ApplauseThreshold = ApplauseThreshold;
type UnsignedPriority = SlowClapUnsignedPriority;
type HistoryDepth = SlowClapHistoryDepth;
type MinAuthoritiesNumber = MinAuthoritiesNumber;
type EpochDuration = EpochDuration;
type WeightInfo = weights::ghost_slow_clap::WeightInfo<Runtime>;
}
@ -1212,10 +1185,7 @@ pub type SignedExtra = (
/// All migrations that will run on the next runtime upgrade.
/// Should be cleared after release.
pub type Migrations = (
ghost_networks::migrations::MigrateV0ToV1<Runtime>,
ghost_slow_clap::migrations::MigrateV2ToV3<Runtime>,
);
pub type Migrations = ();
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_networks`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -30,6 +30,7 @@
// --repeat=20
// --pallet=ghost_networks
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_networks.rs
@ -47,35 +48,35 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `i` is `[1, 20]`.
/// The range of component `j` is `[1, 150]`.
/// The range of component `k` is `[1, 20]`.
fn register_network(_i: u32, j: u32, k: u32, ) -> Weight {
fn register_network(i: u32, j: u32, k: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 48_419_000 picoseconds.
Weight::from_parts(35_655_823, 0)
// Minimum execution time: 47_308_000 picoseconds.
Weight::from_parts(32_768_615, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 1_212
.saturating_add(Weight::from_parts(96_762, 0).saturating_mul(j.into()))
// Standard Error: 9_235
.saturating_add(Weight::from_parts(1_460_410, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
// Standard Error: 5_701
.saturating_add(Weight::from_parts(31_258, 0).saturating_mul(i.into()))
// Standard Error: 748
.saturating_add(Weight::from_parts(102_765, 0).saturating_mul(j.into()))
// Standard Error: 5_701
.saturating_add(Weight::from_parts(1_500_633, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_422_000 picoseconds.
Weight::from_parts(49_987_541, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 51_079_000 picoseconds.
Weight::from_parts(52_557_946, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -84,13 +85,13 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_651_000 picoseconds.
Weight::from_parts(50_776_912, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Standard Error: 1_062
.saturating_add(Weight::from_parts(838, 0).saturating_mul(n.into()))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 51_709_000 picoseconds.
Weight::from_parts(53_451_989, 0)
.saturating_add(Weight::from_parts(0, 3775))
// Standard Error: 605
.saturating_add(Weight::from_parts(6_984, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -98,11 +99,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_080_000 picoseconds.
Weight::from_parts(51_781_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 50_475_000 picoseconds.
Weight::from_parts(51_344_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -110,11 +111,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_rate_limit_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_950_000 picoseconds.
Weight::from_parts(48_925_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 50_467_000 picoseconds.
Weight::from_parts(51_264_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -122,11 +123,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_324_000 picoseconds.
Weight::from_parts(50_801_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 50_473_000 picoseconds.
Weight::from_parts(51_107_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -134,11 +135,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 46_962_000 picoseconds.
Weight::from_parts(47_729_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 49_597_000 picoseconds.
Weight::from_parts(50_283_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -146,11 +147,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_728_000 picoseconds.
Weight::from_parts(53_054_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 51_083_000 picoseconds.
Weight::from_parts(52_464_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -158,11 +159,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_632_000 picoseconds.
Weight::from_parts(49_954_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 51_270_000 picoseconds.
Weight::from_parts(52_099_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -170,11 +171,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_660_000 picoseconds.
Weight::from_parts(53_763_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 50_289_000 picoseconds.
Weight::from_parts(50_924_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -182,11 +183,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_164_000 picoseconds.
Weight::from_parts(48_953_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 49_880_000 picoseconds.
Weight::from_parts(51_277_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -194,26 +195,24 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_avg_block_speed() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_789_000 picoseconds.
Weight::from_parts(52_131_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 50_612_000 picoseconds.
Weight::from_parts(51_546_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 49_720_000 picoseconds.
Weight::from_parts(50_526_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
// Measured: `310`
// Estimated: `3775`
// Minimum execution time: 45_819_000 picoseconds.
Weight::from_parts(46_590_000, 0)
.saturating_add(Weight::from_parts(0, 3775))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_slow_clap`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -48,8 +48,6 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> {
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:1)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplauseDetails` (r:1 w:1)
/// Proof: `GhostSlowClaps::ApplauseDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
@ -64,6 +62,10 @@ impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> {
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:1 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:1)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NullifyNeeded` (r:1 w:0)
/// Proof: `GhostNetworks::NullifyNeeded` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::GatekeeperAmount` (r:1 w:1)
/// Proof: `GhostNetworks::GatekeeperAmount` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::BridgedImbalance` (r:1 w:1)
@ -74,70 +76,32 @@ impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn slow_clap() -> Weight {
// Proof Size summary in bytes:
// Measured: `1417`
// Estimated: `4882`
// Minimum execution time: 305_397_000 picoseconds.
Weight::from_parts(310_207_000, 0)
.saturating_add(Weight::from_parts(0, 4882))
.saturating_add(T::DbWeight::get().reads(13))
// Measured: `1388`
// Estimated: `4853`
// Minimum execution time: 261_978_000 picoseconds.
Weight::from_parts(266_289_000, 0)
.saturating_add(Weight::from_parts(0, 4853))
.saturating_add(T::DbWeight::get().reads(14))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Session::CurrentIndex` (r:1 w:0)
/// Proof: `Session::CurrentIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:0)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::BlockCommitments` (r:1 w:1)
/// Proof: `GhostSlowClaps::BlockCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::CurrentIndex` (r:1 w:0)
/// Proof: `Session::CurrentIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Validators` (r:1 w:0)
/// Proof: `GhostSlowClaps::Validators` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::DisabledAuthorityIndexes` (r:1 w:0)
/// Proof: `GhostSlowClaps::DisabledAuthorityIndexes` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn commit_block() -> Weight {
// Proof Size summary in bytes:
// Measured: `701`
// Estimated: `4166`
// Minimum execution time: 88_007_000 picoseconds.
Weight::from_parts(89_662_000, 0)
.saturating_add(Weight::from_parts(0, 4166))
.saturating_add(T::DbWeight::get().reads(4))
// Measured: `859`
// Estimated: `4324`
// Minimum execution time: 108_966_000 picoseconds.
Weight::from_parts(110_454_000, 0)
.saturating_add(Weight::from_parts(0, 4324))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Staking::ActiveEra` (r:1 w:0)
/// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:100000 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakers` (r:100000 w:0)
/// Proof: `Staking::ErasStakers` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Offences::ConcurrentReportsIndex` (r:1 w:1)
/// Proof: `Offences::ConcurrentReportsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Offences::Reports` (r:97959 w:97959)
/// Proof: `Offences::Reports` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashRewardFraction` (r:1 w:0)
/// Proof: `Staking::SlashRewardFraction` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `Staking::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `Staking::Invulnerables` (r:1 w:0)
/// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashingSpans` (r:97959 w:97959)
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::DisabledValidators` (r:1 w:1)
/// Proof: `Staking::DisabledValidators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 100000]`.
/// The range of component `d` is `[0, 100000]`.
fn try_offend_validators(n: u32, d: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `674`
// Estimated: `1886 + d * (2567 ±0)`
// Minimum execution time: 13_294_008_000 picoseconds.
Weight::from_parts(13_307_595_000, 0)
.saturating_add(Weight::from_parts(0, 1886))
// Standard Error: 1_146_439
.saturating_add(Weight::from_parts(29_632_292, 0).saturating_mul(n.into()))
// Standard Error: 1_146_441
.saturating_add(Weight::from_parts(14_654_685, 0).saturating_mul(d.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(d.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2567).saturating_mul(d.into()))
}
}

View File

@ -5,16 +5,12 @@ pub mod ghost_networks;
pub mod ghost_slow_clap;
pub mod ghost_sudo;
pub mod pallet_alliance;
pub mod pallet_babe;
pub mod pallet_bags_list;
pub mod pallet_balances;
pub mod pallet_bounties;
pub mod pallet_child_bounties;
pub mod pallet_collective;
pub mod pallet_core_fellowship;
pub mod pallet_election_provider_multi_phase;
pub mod pallet_fast_unstake;
pub mod pallet_grandpa;
pub mod pallet_identity;
pub mod pallet_indices;
pub mod pallet_multisig;
@ -28,7 +24,6 @@ pub mod pallet_scheduler;
pub mod pallet_session;
pub mod pallet_staking;
pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_whitelist;

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_babe`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -40,52 +40,19 @@
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
use frame_support::{
traits::Get,
weights::{
constants::{RocksDbWeight as DbWeight, WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_NANOS},
Weight,
},
};
/// Weight functions for `pallet_babe`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_babe::WeightInfo for WeightInfo<T> {
fn plan_config_change() -> Weight {
DbWeight::get().writes(1)
}
fn report_equivocation(validator_count: u32, max_nominators_per_validator: u32) -> Weight {
// we take the validator set count from the membership proof to
// calculate the weight but we set a floor of 100 validators.
let validator_count = validator_count.max(100) as u64;
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 305_618_000 picoseconds.
let equivocation_check_weight = Weight::from_parts(308_237_602, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 899_088
.saturating_add(Weight::from_parts(7_097, 0).saturating_mul(validator_count.into()));
// checking membership proof
Weight::from_parts(88u64 * WEIGHT_REF_TIME_PER_MICROS, 0)
.saturating_add(
Weight::from_parts(438u64 * WEIGHT_REF_TIME_PER_NANOS, 0)
.saturating_mul(validator_count),
)
.saturating_add(DbWeight::get().reads(5))
// check equivocation proof
.saturating_add(equivocation_check_weight)
// report offence
.saturating_add(equivocation_check_weight)
.saturating_add(Weight::from_parts(
63u64 * WEIGHT_REF_TIME_PER_MICROS * max_nominators_per_validator as u64,
0,
))
.saturating_add(DbWeight::get().reads(14 + 3 * max_nominators_per_validator as u64))
.saturating_add(DbWeight::get().writes(10 + 3 * max_nominators_per_validator as u64))
}
/// The range of component `x` is `[0, 1]`.
fn check_equivocation_proof(_x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 295_038_000 picoseconds.
Weight::from_parts(298_100_475, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}

View File

@ -7,7 +7,7 @@
// Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_bounties`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -29,7 +29,7 @@
// --steps=50
// --repeat=20
// --pallet=pallet_bounties
// --extrinsic=*
// --extrinsic=approve_bounty
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
@ -46,181 +46,18 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_bounties`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bounties::WeightInfo for WeightInfo<T> {
/// Storage: `Bounties::BountyCount` (r:1 w:1)
/// Proof: `Bounties::BountyCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Bounties::BountyDescriptions` (r:0 w:1)
/// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
/// Storage: `Bounties::Bounties` (r:0 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// The range of component `d` is `[0, 16384]`.
fn propose_bounty(d: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `210`
// Estimated: `3593`
// Minimum execution time: 125_598_000 picoseconds.
Weight::from_parts(127_962_305, 0)
.saturating_add(Weight::from_parts(0, 3593))
// Standard Error: 21
.saturating_add(Weight::from_parts(1_868, 0).saturating_mul(d.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `Bounties::BountyApprovals` (r:1 w:1)
/// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
/// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(402), added: 897, mode: `MaxEncodedLen`)
fn approve_bounty() -> Weight {
// Proof Size summary in bytes:
// Measured: `302`
// Estimated: `5487`
// Minimum execution time: 57_515_000 picoseconds.
Weight::from_parts(58_519_000, 0)
.saturating_add(Weight::from_parts(0, 5487))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
fn propose_curator() -> Weight {
// Proof Size summary in bytes:
// Measured: `322`
// Estimated: `3642`
// Minimum execution time: 51_036_000 picoseconds.
Weight::from_parts(51_462_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn unassign_curator() -> Weight {
// Proof Size summary in bytes:
// Measured: `498`
// Estimated: `3642`
// Minimum execution time: 169_646_000 picoseconds.
Weight::from_parts(172_576_000, 0)
// Minimum execution time: 52_739_000 picoseconds.
Weight::from_parts(53_443_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn accept_curator() -> Weight {
// Proof Size summary in bytes:
// Measured: `494`
// Estimated: `3642`
// Minimum execution time: 125_617_000 picoseconds.
Weight::from_parts(127_448_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:0)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
fn award_bounty() -> Weight {
// Proof Size summary in bytes:
// Measured: `401`
// Estimated: `3642`
// Minimum execution time: 65_865_000 picoseconds.
Weight::from_parts(66_641_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:3 w:3)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1)
/// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`)
/// Storage: `Bounties::BountyDescriptions` (r:0 w:1)
/// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
fn claim_bounty() -> Weight {
// Proof Size summary in bytes:
// Measured: `713`
// Estimated: `8799`
// Minimum execution time: 516_549_000 picoseconds.
Weight::from_parts(520_792_000, 0)
.saturating_add(Weight::from_parts(0, 8799))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:0)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Bounties::BountyDescriptions` (r:0 w:1)
/// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
fn close_bounty_proposed() -> Weight {
// Proof Size summary in bytes:
// Measured: `445`
// Estimated: `3642`
// Minimum execution time: 185_684_000 picoseconds.
Weight::from_parts(187_810_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:0)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Bounties::BountyDescriptions` (r:0 w:1)
/// Proof: `Bounties::BountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
fn close_bounty_active() -> Weight {
// Proof Size summary in bytes:
// Measured: `681`
// Estimated: `6196`
// Minimum execution time: 342_424_000 picoseconds.
Weight::from_parts(349_225_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
/// Storage: `Bounties::Bounties` (r:1 w:1)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
fn extend_bounty_expiry() -> Weight {
// Proof Size summary in bytes:
// Measured: `358`
// Estimated: `3642`
// Minimum execution time: 52_301_000 picoseconds.
Weight::from_parts(53_018_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Bounties::BountyApprovals` (r:1 w:1)
/// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
/// Storage: `Bounties::Bounties` (r:100 w:100)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:200 w:200)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `b` is `[0, 100]`.
fn spend_funds(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + b * (297 ±0)`
// Estimated: `5487 + b * (5206 ±0)`
// Minimum execution time: 14_296_000 picoseconds.
Weight::from_parts(14_433_000, 0)
.saturating_add(Weight::from_parts(0, 5487))
// Standard Error: 25_068
.saturating_add(Weight::from_parts(160_411_223, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))
.saturating_add(Weight::from_parts(0, 5206).saturating_mul(b.into()))
}
}

View File

@ -1,198 +0,0 @@
// This file is part of Ghost Network.
// Ghost Network is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Ghost Network. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `pallet_child_bounties`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/release/ghost
// benchmark
// pallet
// --chain=casper-dev
// --steps=50
// --repeat=20
// --pallet=pallet_child_bounties
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/pallet_child_bounties.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `pallet_child_bounties`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_child_bounties::WeightInfo for WeightInfo<T> {
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBountyCount` (r:1 w:1)
/// Proof: `ChildBounties::ChildBountyCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1)
/// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBounties` (r:0 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// The range of component `d` is `[0, 16384]`.
fn add_child_bounty(d: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `541`
// Estimated: `6196`
// Minimum execution time: 291_192_000 picoseconds.
Weight::from_parts(296_557_773, 0)
.saturating_add(Weight::from_parts(0, 6196))
// Standard Error: 42
.saturating_add(Weight::from_parts(2_090, 0).saturating_mul(d.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1)
/// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`)
fn propose_curator() -> Weight {
// Proof Size summary in bytes:
// Measured: `595`
// Estimated: `3642`
// Minimum execution time: 69_659_000 picoseconds.
Weight::from_parts(70_289_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn accept_curator() -> Weight {
// Proof Size summary in bytes:
// Measured: `741`
// Estimated: `3642`
// Minimum execution time: 135_004_000 picoseconds.
Weight::from_parts(135_738_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn unassign_curator() -> Weight {
// Proof Size summary in bytes:
// Measured: `741`
// Estimated: `3642`
// Minimum execution time: 184_496_000 picoseconds.
Weight::from_parts(186_401_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
fn award_child_bounty() -> Weight {
// Proof Size summary in bytes:
// Measured: `638`
// Estimated: `3642`
// Minimum execution time: 72_603_000 picoseconds.
Weight::from_parts(73_411_000, 0)
.saturating_add(Weight::from_parts(0, 3642))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:3 w:3)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1)
/// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
fn claim_child_bounty() -> Weight {
// Proof Size summary in bytes:
// Measured: `525`
// Estimated: `8799`
// Minimum execution time: 515_024_000 picoseconds.
Weight::from_parts(527_108_000, 0)
.saturating_add(Weight::from_parts(0, 8799))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1)
/// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1)
/// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
fn close_child_bounty_added() -> Weight {
// Proof Size summary in bytes:
// Measured: `841`
// Estimated: `6196`
// Minimum execution time: 330_763_000 picoseconds.
Weight::from_parts(334_197_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Bounties::Bounties` (r:1 w:0)
/// Proof: `Bounties::Bounties` (`max_values`: None, `max_size`: Some(177), added: 2652, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ChildBounties` (`max_values`: None, `max_size`: Some(145), added: 2620, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:3 w:3)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildrenCuratorFees` (r:1 w:1)
/// Proof: `ChildBounties::ChildrenCuratorFees` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ParentChildBounties` (r:1 w:1)
/// Proof: `ChildBounties::ParentChildBounties` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `ChildBounties::ChildBountyDescriptions` (r:0 w:1)
/// Proof: `ChildBounties::ChildBountyDescriptions` (`max_values`: None, `max_size`: Some(16400), added: 18875, mode: `MaxEncodedLen`)
fn close_child_bounty_active() -> Weight {
// Proof Size summary in bytes:
// Measured: `1028`
// Estimated: `8799`
// Minimum execution time: 405_094_000 picoseconds.
Weight::from_parts(416_868_000, 0)
.saturating_add(Weight::from_parts(0, 8799))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(7))
}
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -40,51 +40,20 @@
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
use frame_support::{
traits::Get,
weights::{
constants::{RocksDbWeight as DbWeight, WEIGHT_REF_TIME_PER_MICROS, WEIGHT_REF_TIME_PER_NANOS},
Weight,
},
};
/// Weight functions for `pallet_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
fn report_equivocation(validator_count: u32, max_nominators_per_validator: u32) -> Weight {
// we take the validator set count from the membership proof to
// calculate the weight but we set a floor of 100 validators.
let validator_count = validator_count.max(100) as u64;
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 272_018_000 picoseconds.
let check_equivocation_proof = Weight::from_parts(275_944_195, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 1_232_802
.saturating_add(Weight::from_parts(1_472_404, 0).saturating_mul(validator_count.into()));
// checking membership proof
Weight::from_parts(88u64 * WEIGHT_REF_TIME_PER_MICROS, 0)
.saturating_add(
Weight::from_parts(438u64 * WEIGHT_REF_TIME_PER_NANOS, 0)
.saturating_mul(validator_count),
)
.saturating_add(DbWeight::get().reads(5))
// check equivocation proof
.saturating_add(check_equivocation_proof)
// report offence
.saturating_add(check_equivocation_proof)
.saturating_add(Weight::from_parts(
63u64 * WEIGHT_REF_TIME_PER_MICROS * max_nominators_per_validator as u64,
0,
))
.saturating_add(DbWeight::get().reads(14 + 3 * max_nominators_per_validator as u64))
.saturating_add(DbWeight::get().writes(10 + 3 * max_nominators_per_validator as u64))
// fetching set id -> session index mappings
.saturating_add(DbWeight::get().reads(2))
/// The range of component `x` is `[0, 1]`.
fn check_equivocation_proof(_x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 271_935_000 picoseconds.
Weight::from_parts(273_848_983, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `Grandpa::Stalled` (r:0 w:1)
/// Proof: `Grandpa::Stalled` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
@ -92,8 +61,8 @@ impl<T: frame_system::Config> pallet_grandpa::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 12_930_000 picoseconds.
Weight::from_parts(13_281_000, 0)
// Minimum execution time: 11_027_000 picoseconds.
Weight::from_parts(11_341_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}

View File

@ -7,7 +7,7 @@
// Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_treasury`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -29,7 +29,7 @@
// --steps=50
// --repeat=20
// --pallet=pallet_treasury
// --extrinsic=*
// --extrinsic=void_spend
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
@ -46,151 +46,14 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_treasury`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_treasury::WeightInfo for WeightInfo<T> {
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:0 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
fn spend_local() -> Weight {
// Proof Size summary in bytes:
// Measured: `6`
// Estimated: `5487`
// Minimum execution time: 52_840_000 picoseconds.
Weight::from_parts(54_220_000, 0)
.saturating_add(Weight::from_parts(0, 5487))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `Treasury::ProposalCount` (r:1 w:1)
/// Proof: `Treasury::ProposalCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:0 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
fn propose_spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `107`
// Estimated: `1489`
// Minimum execution time: 119_927_000 picoseconds.
Weight::from_parts(120_611_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Treasury::Proposals` (r:1 w:1)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn reject_proposal() -> Weight {
// Proof Size summary in bytes:
// Measured: `265`
// Estimated: `3593`
// Minimum execution time: 164_605_000 picoseconds.
Weight::from_parts(165_648_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Treasury::Proposals` (r:1 w:0)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
/// The range of component `p` is `[0, 999]`.
fn approve_proposal(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `800 + p * (4 ±0)`
// Estimated: `5487`
// Minimum execution time: 38_600_000 picoseconds.
Weight::from_parts(54_379_372, 0)
.saturating_add(Weight::from_parts(0, 5487))
// Standard Error: 669
.saturating_add(Weight::from_parts(34_439, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
fn remove_approval() -> Weight {
// Proof Size summary in bytes:
// Measured: `90`
// Estimated: `5487`
// Minimum execution time: 28_269_000 picoseconds.
Weight::from_parts(28_811_000, 0)
.saturating_add(Weight::from_parts(0, 5487))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Treasury::Deactivated` (r:1 w:1)
/// Proof: `Treasury::Deactivated` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Approvals` (r:1 w:1)
/// Proof: `Treasury::Approvals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Proposals` (r:998 w:998)
/// Proof: `Treasury::Proposals` (`max_values`: None, `max_size`: Some(108), added: 2583, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1996 w:1996)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Bounties::BountyApprovals` (r:1 w:1)
/// Proof: `Bounties::BountyApprovals` (`max_values`: Some(1), `max_size`: Some(4002), added: 4497, mode: `MaxEncodedLen`)
/// The range of component `p` is `[0, 999]`.
fn on_initialize_proposals(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + p * (255 ±0)`
// Estimated: `5487 + p * (5206 ±0)`
// Minimum execution time: 93_001_000 picoseconds.
Weight::from_parts(93_875_000, 0)
.saturating_add(Weight::from_parts(0, 5487))
// Standard Error: 106_483
.saturating_add(Weight::from_parts(173_774_586, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_parts(0, 5206).saturating_mul(p.into()))
}
/// Storage: `Treasury::SpendCount` (r:1 w:1)
/// Proof: `Treasury::SpendCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Treasury::Spends` (r:0 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
fn spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `6`
// Estimated: `1489`
// Minimum execution time: 47_856_000 picoseconds.
Weight::from_parts(49_457_000, 0)
.saturating_add(Weight::from_parts(0, 1489))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
fn payout() -> Weight {
// Proof Size summary in bytes:
// Measured: `124`
// Estimated: `3534`
// Minimum execution time: 54_017_000 picoseconds.
Weight::from_parts(54_712_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
fn check_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `124`
// Estimated: `3534`
// Minimum execution time: 53_415_000 picoseconds.
Weight::from_parts(57_185_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `Treasury::Spends` (r:1 w:1)
/// Proof: `Treasury::Spends` (`max_values`: None, `max_size`: Some(69), added: 2544, mode: `MaxEncodedLen`)
fn void_spend() -> Weight {
// Proof Size summary in bytes:
// Measured: `124`
// Estimated: `3534`
// Minimum execution time: 50_317_000 picoseconds.
Weight::from_parts(51_617_000, 0)
// Minimum execution time: 77_449_000 picoseconds.
Weight::from_parts(88_782_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))

View File

@ -1,21 +1,2 @@
#!/bin/bash
EXIT_CODE=0
SCRIPT_DIR=$(dirname "$0")
PATCHES_DIR="$SCRIPT_DIR/patches"
if [[ ! -d "$PATCHES_DIR" ]]; then
echo "[-] Error: directory with patches not found: $PATCHES_DIR"
exit 1
fi
for patch_file in "$PATCHES_DIR"/*.sh; do
if [ -f "$patch_file" ] && [ -x "$patch_file" ]; then
"$patch_file" "$1"
if [ $? -eq 2 ]; then
EXIT_CODE=2
fi
fi
done
exit $EXIT_CODE
bash "$SCRIPT_DIR/patches/patch-1.sh"

View File

@ -1,26 +1,32 @@
#!/bin/bash
DEFAULT_SERVICE_NAME="ghost-node.service"
SERVICE_NAME="${2:-ghost-node.service}"
check_unit_file_validity() {
SERVICE_NAME=$1
if [[ "$SERVICE_NAME" != *.service ]]; then
SERVICE_NAME="${SERVICE_NAME}.service"
fi
if [[ "$SERVICE_NAME" != *.service ]]; then
SERVICE_NAME="${SERVICE_NAME}.service"
fi
SERVICE_FULL_PATH="/etc/systemd/system/$SERVICE_NAME"
if [[ -e "$SERVICE_FULL_PATH" ]]; then
NETWORK_ONLINE_EXISTS=$(grep -Fx "After=network-online.target" "$SERVICE_FULL_PATH")
NETWORK_EXISTS=$(grep -Fx "After=network.target" "$SERVICE_FULL_PATH")
SERVICE_FULL_PATH="/etc/systemd/system/$SERVICE_NAME"
SKIPPED_NO_SERVICE="[-] patch-1 skipped: no serivce found at $SERVICE_FULL_PATH"
[[ ! -e "$SERVICE_FULL_PATH" ]] && { echo $SKIPPED_NO_SERVICE; exit 1; }
if [[ -z "$NETWORK_ONLINE_EXISTS" && -n "$NETWORK_EXISTS" ]]
then
echo "[-] WARNING: missing network-online.target dependency in $SERVICE_FULL_PATH, trying to replace"
sudo sed -i "s/After=network.target/After=network-online.target\nRequires=network-online.target/g" "$SERVICE_FULL_PATH"
else
echo "[+] INFO: network-online.target is set correctly for $SERVICE_FULL_PATH"
fi
else
echo "[-] No serivce found at $SERVICE_FULL_PATH"
fi
NETWORK_ONLINE_EXISTS=$(grep -Fx "After=network-online.target" "$SERVICE_FULL_PATH")
NETWORK_EXISTS=$(grep -Fx "After=network.target" "$SERVICE_FULL_PATH")
}
SKIPPED_SERVICE_OK="[+] patch-1 already applied: network-online.target is set correctly for $SERVICE_FULL_PATH"
[[ ! (-z "$NETWORK_ONLINE_EXISTS" && -n "$NETWORK_EXISTS") ]] && { echo $SKIPPED_SERVICE_OK; exit 0; }
PATCH_MESSAGE="missing network-online.target dependency in $SERVICE_FULL_PATH"
[[ -z "$1" ]] && { echo "[!] patch-1 could be applied: $PATCH_MESSAGE"; exit 2; }
echo "[+] patch-1 will be applied: $PATCH_MESSAGE"
sudo sed -i "s/After=network.target/After=network-online.target\nRequires=network-online.target/g" "$SERVICE_FULL_PATH"
echo "sudo systemctl daemon-reload"
echo "sudo systemctl restart $SERVICE_NAME"
exit 0
check_unit_file_validity $DEFAULT_SERVICE_NAME
read -p "[?] Enter names for the node service, separated by commas (default: ghost-node): " -a SERVICE_NAMES
for NAME in "${SERVICE_NAMES[@]}"; do
check_unit_file_validity $NAME
done
sudo systemctl daemon-reload

View File

@ -1,26 +0,0 @@
#!/bin/bash
LATEST_TESTED_VERSION=83
MANIFEST_PATH=$(cargo metadata --format-version 1 | python3 -c "
import sys,json
data = json.load(sys.stdin)
for pkg in data['packages']:
if pkg['name'] == 'sp-io':
print(pkg['manifest_path'])
break
")
DEPENDENCY_PATH="${MANIFEST_PATH%Cargo.toml}src/lib.rs"
SKIPPED_PATCH_OK="[+] patch-2 not needed: rustc compiler version is compatible"
cargo_version=$(cargo --version | cut -d'.' -f2)
[[ "$cargo_version" -le "$LATEST_TESTED_VERSION" ]] && { echo $SKIPPED_PATCH_OK; exit 0; }
SKIPPED_PATCH_OK="[+] patch-2 already applied: #[no_mangle] already removed from source code of sp-io"
! grep -q '#\[no_mangle\]' "$DEPENDENCY_PATH" && { echo $SKIPPED_PATCH_OK; exit 0; }
PATCH_MESSAGE="remove unnecessary #[no_mangle] from the source code for sp-io"
[[ -z "$1" ]] && { echo "[!] patch-2 could be applied: $PATCH_MESSAGE"; exit 2; }
echo "[+] patch-2 will be applied: $PATCH_MESSAGE"
sed -i '/#\[no_mangle\]/d' "$DEPENDENCY_PATH"
exit 0

View File

@ -1,19 +0,0 @@
#!/bin/bash
LATEST_GCC_WORKING_VERSION=14
PATH_TO_BUILD_CONFIG=~/.local/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/librocksdb-sys-0.11.0+8.1.1/build.rs
GCC_MAJOR=$(gcc -dumpversion | cut -d. -f1)
SKIPPED_PATCH_OK="[+] patch-3 not needed: gcc version is good to compile without patch"
[[ "$GCC_MAJOR" -le "$LATEST_GCC_WORKING_VERSION" ]] && { echo $SKIPPED_PATCH_OK; exit 0; }
SKIPPED_PATCH_OK="[+] patch-3 already applied: no need to change build config of librocksdb"
grep -q "config.flag(\"-include\").flag(\"cstdint\");" "$PATH_TO_BUILD_CONFIG" && { echo $SKIPPED_PATCH_OK; exit 0; }
PATCH_MESSAGE="include cstdint for build config of librocksdb"
[[ -z "$1" ]] && { echo "[!] patch-3 could be applied: $PATCH_MESSAGE"; exit 2; }
sed -i "/$(printf '%s' "config.compile(\"librocksdb.a\");" | sed 's/[].[*^$\/]/\\&/g')/i \
if !target.contains(\"windows\") {\n config.flag(\"-include\").flag(\"cstdint\");\n }" "$PATH_TO_BUILD_CONFIG"
echo "[+] patch-3 will be applied: $PATCH_MESSAGE"
exit 0

View File

@ -1,136 +0,0 @@
#!/bin/bash
SEPOLIA_RPC=(
"https://sepolia.drpc.org"
"https://sepolia.gateway.tenderly.co"
"https://api.zan.top/eth-sepolia"
"https://rpc.sepolia.ethpandaops.io"
"https://ethereum-sepolia-rpc.publicnode.com"
"https://1rpc.io/sepolia"
"https://0xrpc.io/sep"
"https://eth-sepolia.api.onfinality.io/public"
)
MORDOR_RPC=(
"https://0xrpc.io/mordor"
"https://geth-mordor.etc-network.info"
"https://rpc.mordor.etccooperative.org"
)
show_help() {
cat << EOF
Usage: $(basename "$0") [OPTIONS]
Options:
--chain <name> Specify network: 'sepolia' or 'mordor'. If omitted, checks both.
--output <dir> Base directory to save results. Creates a subfolder with Unix Timestamp.
--rpcs <urls> Comma-separated list of custom RPC endpoints.
Disables default Sepolia/Mordor lists.
--help Show this help message.
Example:
$0 --chain sepolia --output ./logs
EOF
exit 0
}
spinner() {
local pid=$1
local net_name=$2
local delay=0.1
local spinstr='|/-\'
tput civis
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf "\r [%c] Checking %s... " "$spinstr" "$net_name"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
done
printf " \r"
tput cnorm
}
check_network() {
local name=$1
shift
local rpcs=("$@")
local target_dir="${OUT_DIR:-/tmp}"
local tmp_file="${target_dir}/$(date +%s)_${name,,}"
local max_len=0
for e in "${rpcs[@]}"; do (( ${#e} > max_len )) && max_len=${#e}; done
[[ $max_len -lt 20 ]] && max_len=20
local total_width=$(( max_len + 32 ))
local line=$(printf "%.0s-" $(seq 1 $total_width))
local header_fmt="| %-${max_len}s | %-12s | %-10s |\n"
(
for endpoint in "${rpcs[@]}"; do
res_b=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' "$endpoint")
hex=$(echo "$res_b" | grep -o '"result":"[^"]*' | cut -d'"' -f4)
[[ -n "$hex" && "$hex" != "null" ]] && blk=$(printf "%d" "$hex") || blk="ERROR"
res_l=$(curl -s -X POST -H "Content-Type: application/json" --max-time 10 \
--data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x1","toBlock":"0x2"}],"id":1}' "$endpoint")
echo "$res_l" | grep -q '"result"' && ev="YES" || ev="NO"
echo "$endpoint|$blk|$ev"
done
) > "$tmp_file" &
local worker_pid=$!
if [[ -z "$OUT_DIR" ]]; then
spinner $worker_pid "$name"
local table_output="$line\n"
table_output+=$(printf "$header_fmt" "Endpoint" "Block" "Events")"\n"
table_output+="$line\n"
while IFS="|" read -r url blk ev; do
table_output+=$(printf "$header_fmt" "$url" "$blk" "$ev")"\n"
done < "$tmp_file"
table_output+="$line"
echo -e "$table_output"
rm "$tmp_file"
else
wait $worker_pid
fi
}
CHOSEN_CHAIN=""
BASE_OUT_DIR=""
CUSTOM_RPCS=""
while [[ $# -gt 0 ]]; do
case "$1" in
--help) show_help ;;
--chain) CHOSEN_CHAIN="$2"; shift 2 ;;
--output) BASE_OUT_DIR="$2"; shift 2 ;;
--rpcs) CUSTOM_RPCS="$2"; shift 2 ;;
*) echo "Unknown option: $1. Use --help for usage."; exit 1 ;;
esac
done
if [[ -n "$BASE_OUT_DIR" ]]; then
OUT_DIR="${BASE_OUT_DIR}"
mkdir -p "$OUT_DIR"
fi
if [[ -n "$CUSTOM_RPCS" ]]; then
IFS=',' read -r -a USER_RPC_ARRAY <<< "$CUSTOM_RPCS"
check_network "Custom" "${USER_RPC_ARRAY[@]}"
else
if [ "$CHOSEN_CHAIN" == "sepolia" ]; then
check_network "Sepolia" "${SEPOLIA_RPC[@]}"
elif [ "$CHOSEN_CHAIN" == "mordor" ]; then
check_network "Mordor" "${MORDOR_RPC[@]}"
else
check_network "Sepolia" "${SEPOLIA_RPC[@]}"
check_network "Mordor" "${MORDOR_RPC[@]}"
fi
fi

View File

@ -80,35 +80,27 @@ extract_seed() {
echo $seed
}
upgrade_compiler_if_needed() {
UPDATE_STATUS=$(rustup check 2>&1)
"$SCRIPT_FOLDER"/patch.sh || PATCH_STATUS=$?
if echo "$UPDATE_STATUS" | grep -q "Update available" || [ $PATCH_STATUS -eq 2 ]; then
echo "[+] clean all cache on the current system"
cargo install cargo-cache
cargo clean
cargo cache --remove-dir all
echo "[+] upgrading rustc compiler version to latest"
rustup update
downgrade_compiler_if_needed() {
echo "[+] fetching the latest ghost-node source code"
git switch main
git pull origin main
# 1.86.0 works fine, tested with:
# 1.87.0 throws errors during compilation
# 1.88.0 throws errors during compilation
LATEST_TESTED_VERSION=86
cargo_version=$(cargo --version | cut -d'.' -f2)
if [ "$cargo_version" -gt "$LATEST_TESTED_VERSION" ]; then
echo "[+] downgrading rustc compiler version to 1.86.0"
rustup default 1.86.0
toolchain_name=$(rustup show | grep default | head -n 1 | cut -d' ' -f1)
if ! rustup target list --installed | grep -q "wasm32-unknown-unknown"; then
echo "[+] installing wasm32-unknown-unknown target"
rustup target add wasm32-unknown-unknown
fi
if ! rustup component list --installed | grep -q "rust-src"; then
echo "[+] installing rust-src component"
rustup component add rust-src
fi
echo "[+] fetching all dependencies"
cargo fetch
echo "[+] trying to apply all patches"
"$SCRIPT_FOLDER"/patch.sh apply
rustup target add wasm32-unknown-unknown --toolchain $toolchain_name
rustup component add rust-src --toolchain $toolchain_name
cd $PROJECT_FOLDER
echo "[+] clean build cache..."
cargo clean
else
echo "[+] rustc compiler version is compatible"
fi
}
@ -217,13 +209,9 @@ if [[ $HARD_RESET = true ]]; then
echo "WARNING!!! THIS ACTION WILL COMPLETELY PURGE THE LEDGER AND REBUILD THE NODE USING THE LATEST"
echo "REPOSITORY VERSION. NOTE THAT THE VALIDATION PROCESS WILL BE LOST BECAUSE SESSION OF KEYS."
echo "THERE ARE TWO SCENARIOS IN WHICH YOU MIGHT NEED TO PROCEED:"
echo -e "\t- A new version of the network has been released, and a restart is neccessary"
echo -e "\t- A new version of the network hsa been released, and a restart is neccessary"
echo -e "\t- There is a critical issue, and you require a hard reset of the node in a single command"
echo -e "\n"
echo "IMPORTANT!!! Your validator's session keys will be also removed. Consequently, your validator node"
echo "will be slashed indefinitely and will become inactive. After hard reset, you'll need to manage the"
echo "keys manually to reactivate the validator."
echo -e "\n"
if prompt "[?] do you understand all risks?"; then
echo "[+] you were warned, I hope you know what you're doing"
else
@ -231,7 +219,7 @@ if [[ $HARD_RESET = true ]]; then
exit 1
fi
upgrade_compiler_if_needed
downgrade_compiler_if_needed
echo "[+] trying to stop current ghost-node"
sudo systemctl stop ghost-node
@ -239,7 +227,6 @@ if [[ $HARD_RESET = true ]]; then
sudo rm -rf "$BASE_PATH/chains/casper_staging_testnet"
cd $PROJECT_FOLDER
git switch main
git pull origin main
echo "[+] starting build in 3 seconds..."
sleep 3
@ -340,12 +327,12 @@ if [[ $SET_ENVIRONMENT = true ]]; then
if prompt "[?] setup the rust environment (e.g. WASM support)?"; then
rustup default stable
upgrade_compiler_if_needed
downgrade_compiler_if_needed
fi
fi
if [[ ! -z $RELEASE ]]; then
upgrade_compiler_if_needed
downgrade_compiler_if_needed
if prompt "[?] 'cargo build $RELEASE $FEATURES' is what you want?"; then
cd $PROJECT_FOLDER
echo "[+] starting build in 3 seconds..."

File diff suppressed because one or more lines are too long

View File

@ -190,59 +190,33 @@ fn casper_testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> {
#[cfg(feature = "casper-native")]
fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>, u128)> {
vec![
(
11155111,
ghost_networks::NetworkData {
chain_name: "sepolia-ethereum-testnet".into(),
default_endpoints: vec![
"https://sepolia.drpc.org".into(),
"https://sepolia.gateway.tenderly.co".into(),
"https://api.zan.top/eth-sepolia".into(),
"https://rpc.sepolia.ethpandaops.io".into(),
"https://ethereum-sepolia-rpc.publicnode.com".into(),
"https://1rpc.io/sepolia".into(),
"https://0xrpc.io/sep".into(),
"https://eth-sepolia.api.onfinality.io/public".into(),
],
finality_delay: 69u64,
rate_limit_delay: 5_000u64,
block_distance: 20u64,
avg_block_speed: 12_000,
network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0xc85129A097773B7F8970a7364c928C05f265E6A1".into(),
topic_name: "0x7ab52ec05c331e6257a3d705d6bea6e4c27277351764ad139209e06b203811a6"
.into(),
incoming_fee: 69_000_000u32,
outgoing_fee: 0u32,
}
.encode(),
2048861035254140036511u128,
),
(
63,
ghost_networks::NetworkData {
chain_name: "mordor-classic-testnet".into(),
default_endpoints: vec![
"https://rpc.mordor.etccooperative.org".into(),
"https://geth-mordor.etc-network.info".into(),
"https://0xrpc.io/mordor".into(),
],
finality_delay: 3_000u64,
rate_limit_delay: 5_000u64,
block_distance: 20u64,
avg_block_speed: 13_000,
network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0xA59cB4ff90bE2206121aE61eEB68d0AeC7BA095f".into(),
topic_name: "0x7ab52ec05c331e6257a3d705d6bea6e4c27277351764ad139209e06b203811a6"
.into(),
incoming_fee: 69_000_000u32,
outgoing_fee: 0u32,
}
.encode(),
5100000000000000000u128,
),
]
vec![(
11155111,
ghost_networks::NetworkData {
chain_name: "sepolia-ethereum-testnet".into(),
default_endpoints: vec![
"https://sepolia.drpc.org".into(),
"https://sepolia.gateway.tenderly.co".into(),
"https://api.zan.top/eth-sepolia".into(),
"https://rpc.sepolia.ethpandaops.io".into(),
"https://ethereum-sepolia-rpc.publicnode.com".into(),
"https://1rpc.io/sepolia".into(),
"https://0xrpc.io/sep".into(),
"https://eth-sepolia.api.onfinality.io/public".into(),
],
finality_delay: 69u64,
rate_limit_delay: 5_000u64,
block_distance: 20u64,
avg_block_speed: 12_000,
network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0xc85129A097773B7F8970a7364c928C05f265E6A1".into(),
topic_name: "0x7ab52ec05c331e6257a3d705d6bea6e4c27277351764ad139209e06b203811a6".into(),
incoming_fee: 69_000_000u32,
outgoing_fee: 0u32,
}
.encode(),
1464619352760244956993u128,
)]
}
/// Helper function to create casper `GenesisConfig` for testing
@ -464,7 +438,7 @@ fn casper_staging_config_genesis() -> serde_json::Value {
.collect::<Vec<_>>(),
},
"staking": {
"validatorCount": 69,
"validatorCount": 500,
"minimumValidatorCount": 3,
"stakers": initial_authorities
.iter()
@ -479,10 +453,8 @@ fn casper_staging_config_genesis() -> serde_json::Value {
.collect::<Vec<_>>(),
"forceEra": Forcing::NotForcing,
"slashRewardFraction": Perbill::from_percent(10),
"minNominatorBond": 690 * STRH,
"minNominatorBond": 6_900 * STRH,
"minValidatorBond": 6_900 * STRH,
"maxNominatorCount": Some(1337),
"maxValidatorCount": Some(420),
},
"babe": {
"epochConfig": Some(casper::BABE_GENESIS_EPOCH_CONFIG),

View File

@ -1,806 +1,187 @@
use hex_literal::hex;
pub fn legacy_endowments() -> Vec<(primitives::AccountId, u128)> {
vec![
(
hex!["fe3cb0119ffaf59434233d0b0d85cd2d16fde46f713dcab39047eb222f3ae666"].into(),
898508876174623538u128,
),
(
hex!["88a74a42ca9a17acc210ae56ff8ace565e246025a2743da967dfde9d6c76277c"].into(),
20734039366660590012u128,
),
(
hex!["94addf7d81d155c9f4d8d0eab3ceb019939db5f3b0081ae3e888a6ed3c845307"].into(),
1000000000000000u128,
),
(
hex!["6e4429a8fa85cfe2a60488af446d57e719207831b2579b937325645e110bb666"].into(),
21042733373739997438u128,
),
(
hex!["7409c6caca65472f77938a143a7ee73a85dd9c1acf60fcc13aade8dc1be38a0a"].into(),
8609732485052672834u128,
),
(
hex!["fa402c6b1c1db2ce9e3e1ba4e559581faa821d20254d8d16e4e18057a3b90672"].into(),
9796698744519740142u128,
),
(
hex!["ac1932d76a47c5819724999aa3626aa85e71bf60c8fccdeac92cf53beab7a85f"].into(),
346508876174623538u128,
),
(
hex!["a6bbe75122ce02a5c0d9ebeda902fb0ae21138a7487e18adef1c3e7d106b3715"].into(),
898508876174623538u128,
),
(
hex!["1225d9453ad3fe1197dfc2410760cea284529e226fef262fb01574ae2a6c5900"].into(),
25679625557282857591u128,
),
(
hex!["ac871e8bab00dd56ba3a1c0bd289357203dcaf10010b0b04ad7472870cd22a3c"].into(),
4495926542421046636u128,
),
(
hex!["6cabf6e32fb8909acae30605bb3e5997d201103d298734851d58022423977655"].into(),
301045085375060900u128,
),
(
hex!["fe0f596b6bf22b5fbad52ebce3429bb6bdeb00996fc8e51aae2e437450f6b578"].into(),
2686488249070628254u128,
),
(
hex!["84e01e431c701383fb0fc204338aca8cff0a2e88bb9397ba7b5ec8b236850e17"].into(),
9488095602980648270u128,
),
(
hex!["507110e1a96c4b781207ad9c790c558f752ca99614f281b6b24a2e467e04e25e"].into(),
446342905026072u128,
),
(
hex!["005dc72f4d842896adf3505695eef833aad9cdee22448751f0500c30cfdda247"].into(),
19922026892862601u128,
),
(
hex!["a64f42e128afa40b848faf5df5e260e58390c6ca2bbcd5e866b5460a4c2dc60c"].into(),
10792504141381628956u128,
),
(
hex!["4a32ed6e36b6dec1ce328c650f5276a6e5ac4e594b7ba71a1cb87a2770f53b33"].into(),
726673904645949199u128,
),
(
hex!["58967ccdc9d4ddab5c32b6605947becba27cca5799a93c9d4d03a0fb3ebc7316"].into(),
453608876174623538u128,
),
(
hex!["323158b7e1cb9b3104fce73ed72095764fe785a1d14b9a8f73e54973f04b9d74"].into(),
531467153727934259u128,
),
(
hex!["3e130ccc1fac5e9d5c2c280341ce8b8dbcafc17ceb75d3722f83404ed2215856"].into(),
16753318413269579418u128,
),
(
hex!["a003dfd6d28a3fabf2b46df20383635c72c5a41d8ee79a5fb75e9d1298b3761f"].into(),
1172036132833830838u128,
),
(
hex!["acbda1ba4cfd81cd430b53a834c0d92085e8efc6948a03c10c2f6a66ba19443a"].into(),
36751232674856508996u128,
),
(
hex!["4cecf92b37e6954f086002cf7b6a61ac7d9ba40c83ef963005e3cacfb5c1e13f"].into(),
14038937501875054342u128,
),
(
hex!["f09c9f7ecdd1be0d07a2d0759efdff5152f23ec742f86e15a9ac03c0995f2365"].into(),
898508876174623538u128,
),
(
hex!["8256b4a52f0277042cacc427cf00b8d668d0e7fe7824f53acf927da985f32410"].into(),
898508876174623538u128,
),
(
hex!["bea3d9a526bfdbd98870bb615dc91d5d9295a6e021e5e9b9193801697a05586e"].into(),
225166041881037450131u128,
),
(
hex!["3a926d7cf3546e58e48f9faf392b02e6d1d43011676378914988eeaea2cbff3a"].into(),
4035504698494152u128,
),
(
hex!["e4dcfdec0dda94b9cb45bf6ff12439392f01fb9d738f806fb115b1d21c99135d"].into(),
3977726628523870614u128,
),
(
hex!["cc88301ef74e085f731220d101dcd14d2b04bc1e59a6c45009c156a9990eab46"].into(),
153582139771143223684u128,
),
(
hex!["46f41aed549dcfa8c094c19787dfbe974fef680eacd209ef88640c82bcb77811"].into(),
13819008291976111251u128,
),
(
hex!["58ed8cee04bcfb70719644a6b9478b8eebfe7ffc8964590e12e1bf36ea245375"].into(),
11624450784910043012u128,
),
(
hex!["9a3e9942c0cb9fe1f1acc97c3bf458e9b7955f44604183e569d5120de3400e10"].into(),
14452183576445203470u128,
),
(
hex!["9aceaa2fa9e3226bbe106cd0150f9807b089281b16942bff471caa1359aa8a22"].into(),
1360508232557032475u128,
),
(
hex!["661fd59a3748d65d66d9612f0c8f5871029e8e74deb3c0e1fbdbcf3c04e84a5e"].into(),
246508876174623538u128,
),
(
hex!["d02a399ba8d6efe950c0c6557606b8b13147b353c11f4495a2cba2a396e7be2f"].into(),
29163375134216277028u128,
),
(
hex!["20fed126411d5d1a1ab3915bffac49297b0eae9dcf4288589c0cad49d925637b"].into(),
5963508876174623538u128,
),
(
hex!["eeaaf5db1b1eb55cc8c1b26c5092868ada9af63c2961bba4d4b5d63e99371c00"].into(),
11725156115646367945u128,
),
(
hex!["ac9e227e30a63ce6eeb55cfbb1fb832aa7e1d3fad2bcb3f663de4a91d744fd50"].into(),
7523053899371678858u128,
),
(
hex!["144a1fa97fdba679efd2a36696a0d40f585b649143bb7da5cbd7458ea4a0f674"].into(),
28761584046403187249u128,
),
(
hex!["a231498b31f698619d80746aa2049ec187c4a103a3c5a8940e14d1b03abe1239"].into(),
1093016078816558319u128,
),
(
hex!["d05b788865ffffdfbb7dfecd937188628a275926ab47742f84b5cda86e5d825d"].into(),
4095526634890427372u128,
),
(
hex!["7673ef8a48eaf9364831735201743d20587e27ff5ff2df42808e4625be6f656b"].into(),
899439876174623538u128,
),
(
hex!["6a92d2e77c6b56428db2129d33c3ba1e71c8a52315a65f03f30dbaf31224153d"].into(),
708444482928862970u128,
),
(
hex!["d8193ef891724c66a6cc58273eadcfb133f9bbc7d777e6456721a70e90ded71f"].into(),
195510000000000000u128,
),
(
hex!["c256b6d62a54c94220ceb1b55f4afae84e59c913b8163d57791463d7ac67555c"].into(),
13111614265582327685u128,
),
(
hex!["723aabc24abe3a04fb79c4a51e5b023e99f5c1afcfeac7d434276496a65ede3e"].into(),
898508876174623538u128,
),
(
hex!["4078ddb1ba1388f768fe6aa40ba9124a72692ecbcc83dc088fa86c735e4dc128"].into(),
1045536628523870614u128,
),
(
hex!["d8a1924995f48a61c0bb79f3fdaeff18573cf1d2164454938c773f6066d81413"].into(),
3296223653083995083u128,
),
(
hex!["b85a4db79fa17d9853f2c4031aa60c8ee09a38bbce5e484ddb4c6b32bfefd401"].into(),
14390589865809310762u128,
),
(
hex!["224f1f3a7534ab5a9a218812d5b6d3587d8b3de89e73310ca8ea74d35c63ee46"].into(),
898508876174623538u128,
),
(
hex!["d84a9b4a2039ac793cb4108990e10e8341039a9c5caee9ed271cd84cc91d2e10"].into(),
136401570550894040265u128,
),
(
hex!["a280b6e97389ed44d9ae9fcb36df39072ab60c7e71088087c4890b8e07f1d97b"].into(),
13104582315236011828u128,
),
(
hex!["0436858543a367154f1a6e9c1f67c4a865a7c92e6adb31d21e7c4312a64d6219"].into(),
2201608876174623538u128,
),
(
hex!["de24e0e98fd99ca8079f9f154293f967731303cf3b862d19d34b98c1db689f41"].into(),
2196169714471969993u128,
),
(
hex!["6255ca0f443e06c0031045d9b6883964f3176526f7243941b48cf89a09adc057"].into(),
14616699999999998u128,
),
(
hex!["f01ce72cc4db3db4eff729f4dab35db89117f40e9f53c7d5cb68d09f2bf28802"].into(),
10583410569668495529u128,
),
(
hex!["3a6626211a2dd35683fd7cb5f2f343d75f2b698d6c48c2d6eb1cdbe116e32315"].into(),
56407584060005963171u128,
),
(
hex!["785b89d27366fcba6ff4dc6a6fa3dfc586d2f5edc15f9416e3a93229f0e7c45d"].into(),
2203940931652105261u128,
),
(
hex!["985562d52d2ce181cdfe12598b40c15ea91adbf74a681ce82029d323f63af45d"].into(),
12374996121419906402u128,
),
(
hex!["fa7728904cfced5998fd559251a9dfb008d2bd838917b9eb6c5332a9ed22b302"].into(),
13266286751478030059u128,
),
(
hex!["80aac52e8482215ae5d022f71c50734b9f5e6d5048bb4d7a198fb77925f97a34"].into(),
21321617482381290055u128,
),
(
hex!["0afa4924d17ab1f9d4aa4197f566ab29f5360a3e03949799f74638cf33d9b852"].into(),
10790907513786741192u128,
),
(
hex!["42c3d5a95c5ba5b9daaa0f68631fa1d0cc744c0dc50476c392167d86d6368b0a"].into(),
12276140304411166019u128,
),
(
hex!["1c65ddadd315f740e7cc162ed79f1d2d743af5c92403615cb078f0da9d78f95d"].into(),
898508876174623538u128,
),
(
hex!["ea1c01ff56725c6fdd62efaa119b704a2f467fd21d20a3c2117668bfeba02e76"].into(),
24674926655816994525u128,
),
(
hex!["ea24c5b5640658f8ad793b40d819dc22c4d55415c666c2e402f6c8412c9c3126"].into(),
13459266313430743241u128,
),
(
hex!["0e05218ac7c6f6c809460d476bc23f660415089854ffe9ad2ddce02704de0049"].into(),
898508876174623538u128,
),
(
hex!["ac0ed11176b0f1cd7539ea734c2a157aadb8b385e43f7731fa3c115174260332"].into(),
921318876174623538u128,
),
(
hex!["f684d118dc9ddfc2f3f6365feae3c258c8ba2c8e5872373c9fa3803ef3d0cf5b"].into(),
21228508876174623538u128,
),
(
hex!["d281d7b41a3e369eef42d15060819df4d9c7d3e43eb5c223244a9bb8c5a2ed44"].into(),
12907092936613202269u128,
),
(
hex!["2224294c8b826c3d35b6105a91923dfcf6c50706a2d57527b971dbc1f4a8c90b"].into(),
529726628523870614u128,
),
(
hex!["3a77a32adecbed35c23e07ed397d22a135542e0d8f265b874f9985792e7bc600"].into(),
86560477751508148u128,
),
(
hex!["20655f7d14fb63c001601c177e513c4e2197253e38638cb034e0ecda9f93db79"].into(),
1005108876174623538u128,
),
(
hex!["7000daf495c30583e255cbf926dcc278427a300c96ef807ddf3f05a38bb3bd6f"].into(),
114705813875568537231u128,
),
(
hex!["fa18d3053a66f26a024bbf0b04571477688542fab309fc4fab6419e7744e023d"].into(),
727997752349247076u128,
),
(
hex!["12ff06ed5c993253837f627ff4ddcee4658ebcea47bb7f13d299bc3b2d520440"].into(),
9660045161058603076u128,
),
(
hex!["d263c987009ee0bc900162e9af9e2f2ed073f2d2af895e4bb8f4fb72840aa457"].into(),
12688435840744280612u128,
),
(
hex!["dca9bba238f216683ea0c43bdce1709578d83e4b41875c76266e84024c34a72b"].into(),
898508876174623538u128,
),
(
hex!["a25b474bb6a2b241ff7f574309240e0ca84aa29f5d04912842e5748af631a740"].into(),
13370440034824674362u128,
),
(
hex!["007143a869c6e707fe03eae20704a81a97eb7beabedef62f8e3cbe5706b6e247"].into(),
14768512833373884464u128,
),
(
hex!["5e1456904c40192cd3a18183df7dffea90d97739830a902cabb702ecdae4f649"].into(),
376017752349247076u128,
),
(
hex!["6d6f646c70792f74727372790000000000000000000000000000000000000000"].into(),
853506701376908793934u128,
),
(
hex!["9607407bc837b24624c7886129755843bd3a149f8bfec76bc8f828876cac3461"].into(),
10929472937167428328u128,
),
(
hex!["20f8135fb600717f8e288e6b9a6dacbeb54677664dcde4998558975e606caf20"].into(),
786017752349247076u128,
),
(
hex!["beadbe750127679102bb60e0493ad501394283b7a9a0001887f320ec8d83af5f"].into(),
13059337743467906765u128,
),
(
hex!["84328018915f262b63a52d947506c9e75878f3bae7454aa197c7624393256609"].into(),
93100000000000000u128,
),
(
hex!["b624cb291f7464773f3b449ee2252165f3934ace08b1e10611a53e174766fc73"].into(),
30936250630249413310u128,
),
(
hex!["1eef351e2c381586366f89bbdf5c690372fa05c7c5a47e6351315f0aa9507029"].into(),
19477108324061651032u128,
),
(
hex!["4a2aa2bccfe5ae7a771fc2ce7732ad2da397ee51f0a45f18c167bb555fa70506"].into(),
1936519460520939399u128,
),
(
hex!["909f0584f25fd044fc4336f966e14e925d77466e8629f4c6888d55cf594b6d76"].into(),
346508876174623538u128,
),
(
hex!["08aae874b34057e02c3f6c28fffe8eaa0f665e9d7cc0d38f878c9ae862d47277"].into(),
499553257047741228u128,
),
(
hex!["749089588c2a57b4cc4adc4541c441332d2fa11acf13f785e470d03cef61d75d"].into(),
15232317322641616299u128,
),
(
hex!["de3d246b0109357114d1ee78ec4598fcff1cf19da4254ced289ac4e534b6084b"].into(),
506451628523870614u128,
),
(
hex!["2a5bc425d9c6b8e29d5ccfe3282560fc8ab079262763aaf4d9269c7c6043f208"].into(),
19879072140569666945u128,
),
(
hex!["347db8f39a1a1efa2ec9daeaaa04e3512238e9a6970fba65878f83366e927f27"].into(),
13250762917778422850u128,
),
(
hex!["4a5596e97c602e7846d54fae81dcdc5a553b7422231e32f9567ac30a6b7c743a"].into(),
41638135068286046818u128,
),
(
hex!["3cae73748956c91dc21f54e2653e0fb76b9c8ffe38c2c3e2ad6483e88c968a02"].into(),
4059791817567310973u128,
),
(
hex!["5688a4d3171b935a3b038729ccb0cca068a4243cd3a6b7e102e7e14ac49d6427"].into(),
14893617583873139066u128,
),
(
hex!["8c7a053eb4ce5a680150650e88533ade4ce08fee5340888ae655df3c37910d04"].into(),
3076517758715803834u128,
),
(
hex!["3a2e10fef720299388eb789aaab0e0bb1b7c10464aa7c442c6a584cf11c01845"].into(),
345017752349247076u128,
),
(
hex!["8e20ae229b297cdb71aaa122c0182c636d9f97f9d38e7dffb24045b00374a060"].into(),
343021429061225383u128,
),
(
hex!["4850e7dd6e309b3758b16a43e96cc16455245ab31dbf2920397e58106ee7a112"].into(),
898508876174623538u128,
),
(
hex!["c28559a4c9a9ffc428441295a309e944e3e9b87a832cf3cebd3def8c57b4ec1a"].into(),
13244103182710791045u128,
),
(
hex!["6a7a10e74c6fbcd0d9ea2ec1cfff2ce89cc5501315117757642f50c36dfa5c01"].into(),
24416873171189988097u128,
),
(
hex!["5a792ca101c15da5b237477a3c1e30f4873a21c8046bfc44117d4f3dedceb374"].into(),
24023038343078900634u128,
),
(
hex!["3068d31973cc3b18745cf5d6e75e2ec0a940d2aec79af2b313a530f6c558d77e"].into(),
2095662152322035040u128,
),
(
hex!["76ef9c99dfb1ee5604b7d7314f61908957db55fa294a0794c6bf793691c49954"].into(),
17910287937252530940u128,
),
(
hex!["c8ffc2b4e770b08b9a4ae10168c48dd821581a2df3cf5f3a371dcc1326bbe94c"].into(),
25677594611394060807u128,
),
(
hex!["f235af8680ec5cbfbac0fc818da07c727e449454b04e2d96671e2d64ececb30a"].into(),
4260671995070680428u128,
),
(
hex!["c8f4d838e6e262a7c905eb268f36a3e5b7240130aa895384822cdd968586cb01"].into(),
14912878206297721983u128,
),
(
hex!["160d647d9a380687f63cbe4ea23279692b997a3dad19227b1bb85f08965d7859"].into(),
15825904340197502330u128,
),
(
hex!["e872e23fc05919751708f5bf887a68ef9c175cf7f1728dca6220e2a2370e163f"].into(),
25193857844634143446u128,
),
(
hex!["685c600574546bad67b0ae6768f07b7fee1f1aec6473c941606f9829cfa93b6c"].into(),
2211687751137074462u128,
),
(
hex!["ba821401516b2429cd25e506c1af11b23808d039d1319d6b2eb7a9222d922179"].into(),
28918786313447682171u128,
),
(
hex!["2e1158566a7c2a57c68e542b64ac5987cb69aaaf846735addafc6f90cb5d8e3b"].into(),
13985217814424299670u128,
),
(
hex!["da35bf90643e1f5431031728c9f9c3eebea63c6bcfce1c8b468591cf6ed35210"].into(),
11680033590958446157u128,
),
(
hex!["d0b6e4237e5d05345ce398eed219ae1be33b4180afb35c54d1d02a5da4feeb68"].into(),
30482480277587823790u128,
),
(
hex!["a8c76be6e69cb05748f5accbced41809a1bdf30400402e63753fc85adfbea418"].into(),
8060691100000000000u128,
),
(
hex!["f442a26de0c465651bbe51ff90d0b31f63af206d84cf2bcab5a1ee7ab537ec4b"].into(),
2793000000000000u128,
),
(
hex!["909ab2271d3fc8df9e8556232a29eea7cf1cfdf8c89603a602779daa6484f011"].into(),
24759199566796371707u128,
),
(
hex!["f0515fcc6570d35645675f99aa04295fd1e12d88ab9abcac61f58092a5c3e316"].into(),
1622526628523870614u128,
),
(
hex!["8af45cf6dd06aeb958c3b41fe2b37a2d523179efffe7ce287fbe0b80471e363b"].into(),
6949838187631199u128,
),
(
hex!["a02d33ee7c4d38649d4bd88f330e75740ab4e4aa55e0f18110d8e6c72f71615a"].into(),
430027752349247076u128,
),
(
hex!["ee5005bc008184ed8d8d71774a167e4773fdbad6c8bf8e4d46a211b6b52e806f"].into(),
405127480873117690u128,
),
(
hex!["562f42de365612dd23609a21117e3b807242f50af7a51877fc907656e723b41c"].into(),
23545504698493896u128,
),
(
hex!["bc5660de2352353da342e9c853ff20f820929aff755a0802841d32f36cf06672"].into(),
14997410948120188860u128,
),
(
hex!["3cd73e0f752cf301d3c2bca3d72d2502003d7143bacac8944e972bbe921a1b11"].into(),
1193117758715803834u128,
),
(
hex!["223ab980529a7f877a79fb4bd2280c60e8ed0978b21007de70e1682f5d0fe846"].into(),
6566608321352507005u128,
),
(
hex!["74302b4989cfd149c4a99b0bc9a4ff82cf63d3f4291fa2597963fe4db56e401a"].into(),
898508876174623538u128,
),
(
hex!["9696d44dce264f5c1e2e5cdbc3c0609a627ac712dbd7ce6a24a415b7ea652773"].into(),
20698814168008932416u128,
),
(
hex!["b852757ba5ce6a3fddcdd13f7a548d16532dbf1b16693d951c348860c421ab16"].into(),
11351527332712054762u128,
),
(
hex!["223983e8b68f45666ec4faa573b2aa9b664b20bc25517c179cb354eda6704b04"].into(),
14905713185341512010u128,
),
(
hex!["94cc169c4cd81710fe19a6ce10ef35b1fe1d53aa04dc24e0a55d3a6dda728909"].into(),
9490152116008452257u128,
),
(
hex!["9811dbf8f334e5bd354374b5224be3db6d2d0019d4abd84e57701093ae2fcd38"].into(),
508205226151823215u128,
),
(
hex!["daff035dfadff80ada04930d67be6dc9837d65d39a124a64973b1f52e6203876"].into(),
14139373499800648011u128,
),
(
hex!["a04214ec6484663f990a1dd3f4a02f8f174723a54a369478c076573aa43d1e30"].into(),
16582086343620630086u128,
),
(
hex!["3884cb632764ef37c200430b9247935df3370eb1f68e26d2335e7a08cfee6331"].into(),
15809344826831310198u128,
),
(
hex!["425533de216bf2e3a9d1f3358dbf23a8d56d3d2fdbfe5deb2d989716fd26734f"].into(),
14123180658174610206u128,
),
(
hex!["fc1310a824a7c8744b6f6308198e4a9bf9baea4a673bafedd49f35824eeb3947"].into(),
9795048450282732123u128,
),
(
hex!["385a826ba8113391c26d03c8bf3d911ce8f20a523ba19da996926e401226e921"].into(),
1048508876174623538u128,
),
(
hex!["e82bad686d3318e72e36bfe9776e197ae04b60fc140b7a221fbf1b730e9b0162"].into(),
898508876174623538u128,
),
(
hex!["8a0bb3642b563b842649ca9870ddb8efb67d0bc3b128df0d59e7bd5f1c19db22"].into(),
297635726269865672u128,
),
(
hex!["8e18636616b2f67f20469a71d7f6508fd2e2f045742e6ba5d80b2a0782b2ae50"].into(),
3072300000000000000u128,
),
(
hex!["08c04b4b3540dff6e2e489a888f336f1f09c7a648b19194836584ecafe74f632"].into(),
962544380873117722u128,
),
(
hex!["30acd0fd37df7b6b9dca64287fe3bf0ad3563ad2868567170b79d48a2be1905d"].into(),
10233781528150093525u128,
),
(
hex!["10b2b93e271f30d21a3c0c8937e5190750667fea2ae7fb56a0f179a86c383713"].into(),
21613466323512262u128,
),
(
hex!["46c78fcacffd80abc9cca4917ef8369a37e21a1691ca11e7a3b53f80be745313"].into(),
7147764927833644204u128,
),
(
hex!["d25b9ebe75a5d72c366c26588416509881a273ac9411e5fe6052c25ab7ed5311"].into(),
25066498882541180296u128,
),
(
hex!["e8c8d51024385be1fa0e5003a6725626d96f7b02fdc0a289bdef2095a2170039"].into(),
461545504698494152u128,
),
(
hex!["a0746c5aee539430c94f18adc4a723d3216e348a5e770bd65c70c8e2655e4f73"].into(),
19193345540608109431u128,
),
(
hex!["da59bcd9273cea92f120a9a9a5a5148a551decb191588dc949331d6badf29a19"].into(),
9490654217464110064u128,
),
(
hex!["3482a145ab988dfd56683d2ca621a900656188eef040c92e8dbc45288fa51409"].into(),
12923631455237538822u128,
),
(
hex!["96b26d15a812e30bc0dae710eb6ab9ce0c82a450e8eeb94c19c9ee0483ed907c"].into(),
3389562133222364766u128,
),
(
hex!["8a5807668ec5a9f0cad02fa02a7b8b5ac7a754f94f00da5048de53e883c54d14"].into(),
20555316237553836240u128,
),
(
hex!["8610f2ee704cb43240f62a9d7aafa91e31168976c4f91ce7f87db37f42db2953"].into(),
2702544380873117690u128,
),
(
hex!["96cd8b97a9256ee5ddac3d5d4e128544041d041957815f415d33e51212e5794d"].into(),
2790800114219541994u128,
),
(
hex!["b0d88e3974dd9b8e2b5919bb3eaca3241bc3ceca163df036ea539528121cde36"].into(),
12804373197912707987u128,
),
(
hex!["8a0d0b66e827bf20e79f9a499317e73925ce4f422371067edfab690e43857f13"].into(),
17029519112752711171u128,
),
(
hex!["40ad428cb7a2530fc0c38ab879e7f5d54f25cd757cfcb21f46cb023d413eb916"].into(),
236636628523870614u128,
),
(
hex!["4cec57aebb419ab80b7d8b699024eaaa9016bb2b90821f18303abebe87b4983e"].into(),
5989065741777255205u128,
),
(
hex!["2c2d1ac621c332cc1b8e5c1bfc5b1c00c61e9767e8fcf96b1852bb39940fa209"].into(),
97016443351365356u128,
),
(
hex!["6ea653659d6a5e6f3fa95b2ffa4acad62233f91d2dc323632a3fa5c9fc7b533a"].into(),
7082036763487176084u128,
),
(
hex!["f614e6494fbb66397fe4c799971be187183d85996ac08c2ba37d666635fd0f7d"].into(),
14369468997618688200u128,
),
(
hex!["24fae36f401bf052057d4a011dc8b9ec40fcd9ef12a2823c9c8a2acbd40b906d"].into(),
2315886107309065433u128,
),
(
hex!["46b7889030d5f4653002b4b3cc50b031548c237e1b26639e26b66af113258c65"].into(),
12142098465731542975u128,
),
(
hex!["eefeff9e4cfa6e9d55128803895ff50e917f5601fda7f38f7aa71c48ee8a182c"].into(),
11439023815236597370u128,
),
(
hex!["4ec775d54f1e4d03524571e664108c5c7d8e256ac0b7a9566fe91a13fb489c1d"].into(),
9489578019617777151u128,
),
(
hex!["cebeae91074bd44a612a42098fc923e69d9b2986a9346b9e22e194867cfe1878"].into(),
15601890531640086483u128,
),
(
hex!["2c1a2fcaaddeb083764fdd5364e961506807f295b7de086bfebcf85323ec3e6f"].into(),
13079350324389304724u128,
),
(
hex!["345ff8df58e39dbae032bfed1a3f5d41078376d57adb6cabd8b319fb817b892e"].into(),
23468808288638423759u128,
),
(
hex!["da6875e9df9a7894e065ef5befcde567dec4dc2c0b73a6ad5514dcca26a90702"].into(),
6493072525488370028u128,
),
(
hex!["1a32c203646616b88f262569c5e52c8c45468c0b5ade90996af844a9971ddf31"].into(),
19038726261292405641u128,
),
(
hex!["e261f574706b696fa627ca60abcd27d71e509d48955c7bd39cfe26a4dbd1a305"].into(),
21295213717464967001u128,
),
(
hex!["3484fb56e2660d6d91ef93f432777778dcff9df2f9cccf0672504dd71a705358"].into(),
898508876174623538u128,
),
(
hex!["fef9b143712fefdf6825c9d85a151c0ff526f978becf980da6f5b10f8dac6c47"].into(),
32731550000000000000u128,
),
(
hex!["70ee2d1a6ae80d1fee15f47c646cbcbc9fa8dcf7365bfb5f7135daf9e4933312"].into(),
11375887786446002232u128,
),
(
hex!["94715daf5090147de11f48aee9661c46f98b1215e3a4e54867344635c7e8cf68"].into(),
1000000000000000u128,
),
(
hex!["3618b39b2ea7f3b6540772f898d4e10659e63be2cae3f83809464ca0bb5db22a"].into(),
464151188721441320u128,
),
(
hex!["d2da442bc774b21bf0a2485bc6099e468765255363136b6517adda3d6ceb8e39"].into(),
11360623175679553528u128,
),
(
hex!["4e5dbd1516d69f4132e5ea96b7cf92799075c14a32f7995fb9d6f6ebed537d64"].into(),
898508876174623538u128,
),
(
hex!["c60a0232c2be6412a0d4e48d6754179b554d35a245adf6f6fccde7ae6cc0243e"].into(),
58698491577496531u128,
),
(
hex!["dc3c2d888a41e766647e56ec7e9b71cc8db6553407be8646e35d4c0f803b9946"].into(),
118117752349247076u128,
),
(
hex!["b2c232a2c68b1b9094568fde28bca4b3845031b1afc386b4f6881c7c0162b00d"].into(),
931000000000000u128,
),
(
hex!["422f1935ec60c7e30ea45aa8b9f94adf9fc416887bdfb797860eae4d6ff2552c"].into(),
13279615062396777665u128,
),
(
hex!["90d14cddba5be458254e80a127cb06f6b2e0344928d949241da6c3e230a9c374"].into(),
4686200000000000000u128,
),
(
hex!["728d8f346c9be14f387d1ce92598cee4becdb41d944ed0d77b9ee3d652e7ec62"].into(),
6258403189666179783u128,
),
(
hex!["3e4c0237d057d92401fc9188893254f503d28af6b35535749f46420827de754d"].into(),
19242175230462504503u128,
),
(
hex!["4c19778e758d3f4763972e2b5119aee898a0c86b3f7dc2f4536f495b44f7a151"].into(),
93100000000000000u128,
),
(
hex!["484b5356ad84cc7ce4cbaf5e53c79c5d77195ad560810fa6d3fafc2145a04f69"].into(),
7634199999999999046u128,
),
(
hex!["80eca749f37cb93f00f5309552c26b2c70960452e11faa63d081090542aeac42"].into(),
15018909223219290155u128,
),
(
hex!["585bde23981ce0400b174cf234c495114421bb01554344c63dc724357a6dac24"].into(),
35007104380873117690u128,
),
(
hex!["c02c41834889bf3fec8d38e25d976dcfde3e2e44ca1275c341b0ff7617a2f14c"].into(),
2976235504698494152u128,
),
(
hex!["328135c5defeeb32f3b3f90196108f56837bb1cb999033bf380464c20ede0d4e"].into(),
1670483976174623538u128,
),
(
hex!["fc01510458f9a54c10b0fb9be4f6a5f110388ecffbffb79e3b6bfd999a17ed4c"].into(),
1824791460713404165u128,
),
(
hex!["1c96c3a56374256afa95ffa1c15cb9730d33d91fa4a8fa10b4053b166e714e68"].into(),
9310000000000000u128,
),
(
hex!["6c151c9f790fa18a0dd60debb296bb252700c482298eaf8b681f599b6f7b5150"].into(),
100000000000000u128,
),
(
hex!["844ee060a2a94beb0c3a744d00093d1929a68f3b5acc2265e99375855bd60c00"].into(),
6979217752349247076u128,
),
(
hex!["6083d585d458daed6a19c3258e311132ab786eb5144bb7b7dace2218522d274b"].into(),
931000000000000u128,
),
(
hex!["68c3d18fb07714cab1b1f8b5368e9c1e1f2b5f0e739c0602eeffc1669936ed02"].into(),
23861181086695331736u128,
),
(
hex!["5cb839c6a5e065e83b5dbf20d7082086a376586fe37fa7658cba71eda689c118"].into(),
14120423305018263853u128,
),
]
}
use hex_literal::hex;
pub fn legacy_endowments() -> Vec<(primitives::AccountId, u128)> {
vec![
(hex!["fe3cb0119ffaf59434233d0b0d85cd2d16fde46f713dcab39047eb222f3ae666"].into(), 898508876174623538u128),
(hex!["88a74a42ca9a17acc210ae56ff8ace565e246025a2743da967dfde9d6c76277c"].into(), 11499490981584684807u128),
(hex!["94addf7d81d155c9f4d8d0eab3ceb019939db5f3b0081ae3e888a6ed3c845307"].into(), 1000000000000000u128),
(hex!["6e4429a8fa85cfe2a60488af446d57e719207831b2579b937325645e110bb666"].into(), 20045398007416485176u128),
(hex!["7409c6caca65472f77938a143a7ee73a85dd9c1acf60fcc13aade8dc1be38a0a"].into(), 30478997642754917282u128),
(hex!["fa402c6b1c1db2ce9e3e1ba4e559581faa821d20254d8d16e4e18057a3b90672"].into(), 9796698744519740142u128),
(hex!["ac1932d76a47c5819724999aa3626aa85e71bf60c8fccdeac92cf53beab7a85f"].into(), 346508876174623538u128),
(hex!["a6bbe75122ce02a5c0d9ebeda902fb0ae21138a7487e18adef1c3e7d106b3715"].into(), 898508876174623538u128),
(hex!["1225d9453ad3fe1197dfc2410760cea284529e226fef262fb01574ae2a6c5900"].into(), 16442998462241875728u128),
(hex!["ac871e8bab00dd56ba3a1c0bd289357203dcaf10010b0b04ad7472870cd22a3c"].into(), 1998508837042115740u128),
(hex!["6cabf6e32fb8909acae30605bb3e5997d201103d298734851d58022423977655"].into(), 12822257832237511466u128),
(hex!["fe0f596b6bf22b5fbad52ebce3429bb6bdeb00996fc8e51aae2e437450f6b578"].into(), 12157355198880897693u128),
(hex!["84e01e431c701383fb0fc204338aca8cff0a2e88bb9397ba7b5ec8b236850e17"].into(), 9488095602980648270u128),
(hex!["507110e1a96c4b781207ad9c790c558f752ca99614f281b6b24a2e467e04e25e"].into(), 9713310740009473644u128),
(hex!["005dc72f4d842896adf3505695eef833aad9cdee22448751f0500c30cfdda247"].into(), 14021423144351682305u128),
(hex!["a64f42e128afa40b848faf5df5e260e58390c6ca2bbcd5e866b5460a4c2dc60c"].into(), 10792504141381628956u128),
(hex!["4a32ed6e36b6dec1ce328c650f5276a6e5ac4e594b7ba71a1cb87a2770f53b33"].into(), 14140001662633653275u128),
(hex!["58967ccdc9d4ddab5c32b6605947becba27cca5799a93c9d4d03a0fb3ebc7316"].into(), 453608876174623538u128),
(hex!["323158b7e1cb9b3104fce73ed72095764fe785a1d14b9a8f73e54973f04b9d74"].into(), 13375245216003871505u128),
(hex!["3e130ccc1fac5e9d5c2c280341ce8b8dbcafc17ceb75d3722f83404ed2215856"].into(), 16753318413269579418u128),
(hex!["acbda1ba4cfd81cd430b53a834c0d92085e8efc6948a03c10c2f6a66ba19443a"].into(), 36751232674856508996u128),
(hex!["4cecf92b37e6954f086002cf7b6a61ac7d9ba40c83ef963005e3cacfb5c1e13f"].into(), 14040022959030355565u128),
(hex!["f09c9f7ecdd1be0d07a2d0759efdff5152f23ec742f86e15a9ac03c0995f2365"].into(), 898508876174623538u128),
(hex!["8256b4a52f0277042cacc427cf00b8d668d0e7fe7824f53acf927da985f32410"].into(), 898508876174623538u128),
(hex!["3a926d7cf3546e58e48f9faf392b02e6d1d43011676378914988eeaea2cbff3a"].into(), 4035504698494152u128),
(hex!["e4dcfdec0dda94b9cb45bf6ff12439392f01fb9d738f806fb115b1d21c99135d"].into(), 3977726628523870614u128),
(hex!["cc88301ef74e085f731220d101dcd14d2b04bc1e59a6c45009c156a9990eab46"].into(), 38103139771143223684u128),
(hex!["46f41aed549dcfa8c094c19787dfbe974fef680eacd209ef88640c82bcb77811"].into(), 13819008291976111251u128),
(hex!["9a3e9942c0cb9fe1f1acc97c3bf458e9b7955f44604183e569d5120de3400e10"].into(), 8835780408986419448u128),
(hex!["9aceaa2fa9e3226bbe106cd0150f9807b089281b16942bff471caa1359aa8a22"].into(), 1360508232557032475u128),
(hex!["661fd59a3748d65d66d9612f0c8f5871029e8e74deb3c0e1fbdbcf3c04e84a5e"].into(), 246508876174623538u128),
(hex!["20fed126411d5d1a1ab3915bffac49297b0eae9dcf4288589c0cad49d925637b"].into(), 1308508876174623538u128),
(hex!["eeaaf5db1b1eb55cc8c1b26c5092868ada9af63c2961bba4d4b5d63e99371c00"].into(), 13381482878571786796u128),
(hex!["ac9e227e30a63ce6eeb55cfbb1fb832aa7e1d3fad2bcb3f663de4a91d744fd50"].into(), 75053899371678858u128),
(hex!["144a1fa97fdba679efd2a36696a0d40f585b649143bb7da5cbd7458ea4a0f674"].into(), 19762757562620855283u128),
(hex!["a231498b31f698619d80746aa2049ec187c4a103a3c5a8940e14d1b03abe1239"].into(), 676568060690000000u128),
(hex!["d05b788865ffffdfbb7dfecd937188628a275926ab47742f84b5cda86e5d825d"].into(), 97017752349247076u128),
(hex!["7673ef8a48eaf9364831735201743d20587e27ff5ff2df42808e4625be6f656b"].into(), 899439876174623538u128),
(hex!["6a92d2e77c6b56428db2129d33c3ba1e71c8a52315a65f03f30dbaf31224153d"].into(), 708444482928862970u128),
(hex!["d8193ef891724c66a6cc58273eadcfb133f9bbc7d777e6456721a70e90ded71f"].into(), 195510000000000000u128),
(hex!["c256b6d62a54c94220ceb1b55f4afae84e59c913b8163d57791463d7ac67555c"].into(), 13111614265582327685u128),
(hex!["723aabc24abe3a04fb79c4a51e5b023e99f5c1afcfeac7d434276496a65ede3e"].into(), 898508876174623538u128),
(hex!["4078ddb1ba1388f768fe6aa40ba9124a72692ecbcc83dc088fa86c735e4dc128"].into(), 1045536628523870614u128),
(hex!["d8a1924995f48a61c0bb79f3fdaeff18573cf1d2164454938c773f6066d81413"].into(), 3296223653083995083u128),
(hex!["b85a4db79fa17d9853f2c4031aa60c8ee09a38bbce5e484ddb4c6b32bfefd401"].into(), 14390589865809310762u128),
(hex!["224f1f3a7534ab5a9a218812d5b6d3587d8b3de89e73310ca8ea74d35c63ee46"].into(), 898508876174623538u128),
(hex!["d84a9b4a2039ac793cb4108990e10e8341039a9c5caee9ed271cd84cc91d2e10"].into(), 82999821765415413069u128),
(hex!["a280b6e97389ed44d9ae9fcb36df39072ab60c7e71088087c4890b8e07f1d97b"].into(), 13104582315236011828u128),
(hex!["0436858543a367154f1a6e9c1f67c4a865a7c92e6adb31d21e7c4312a64d6219"].into(), 2201608876174623538u128),
(hex!["de24e0e98fd99ca8079f9f154293f967731303cf3b862d19d34b98c1db689f41"].into(), 2196169714471969993u128),
(hex!["6255ca0f443e06c0031045d9b6883964f3176526f7243941b48cf89a09adc057"].into(), 14616699999999998u128),
(hex!["f01ce72cc4db3db4eff729f4dab35db89117f40e9f53c7d5cb68d09f2bf28802"].into(), 10583410569668495529u128),
(hex!["3a6626211a2dd35683fd7cb5f2f343d75f2b698d6c48c2d6eb1cdbe116e32315"].into(), 28409923837144670351u128),
(hex!["785b89d27366fcba6ff4dc6a6fa3dfc586d2f5edc15f9416e3a93229f0e7c45d"].into(), 2203940931652105261u128),
(hex!["985562d52d2ce181cdfe12598b40c15ea91adbf74a681ce82029d323f63af45d"].into(), 10071185931226347521u128),
(hex!["fa7728904cfced5998fd559251a9dfb008d2bd838917b9eb6c5332a9ed22b302"].into(), 13266286751478030059u128),
(hex!["80aac52e8482215ae5d022f71c50734b9f5e6d5048bb4d7a198fb77925f97a34"].into(), 11402028653479979903u128),
(hex!["0afa4924d17ab1f9d4aa4197f566ab29f5360a3e03949799f74638cf33d9b852"].into(), 12792398754994057800u128),
(hex!["42c3d5a95c5ba5b9daaa0f68631fa1d0cc744c0dc50476c392167d86d6368b0a"].into(), 12276140304411166019u128),
(hex!["1c65ddadd315f740e7cc162ed79f1d2d743af5c92403615cb078f0da9d78f95d"].into(), 898508876174623538u128),
(hex!["ea1c01ff56725c6fdd62efaa119b704a2f467fd21d20a3c2117668bfeba02e76"].into(), 15364926655816994525u128),
(hex!["ea24c5b5640658f8ad793b40d819dc22c4d55415c666c2e402f6c8412c9c3126"].into(), 13459266313430743241u128),
(hex!["0e05218ac7c6f6c809460d476bc23f660415089854ffe9ad2ddce02704de0049"].into(), 898508876174623538u128),
(hex!["ac0ed11176b0f1cd7539ea734c2a157aadb8b385e43f7731fa3c115174260332"].into(), 921318876174623538u128),
(hex!["f684d118dc9ddfc2f3f6365feae3c258c8ba2c8e5872373c9fa3803ef3d0cf5b"].into(), 21228508876174623538u128),
(hex!["d281d7b41a3e369eef42d15060819df4d9c7d3e43eb5c223244a9bb8c5a2ed44"].into(), 12907092936613202269u128),
(hex!["2224294c8b826c3d35b6105a91923dfcf6c50706a2d57527b971dbc1f4a8c90b"].into(), 529726628523870614u128),
(hex!["20655f7d14fb63c001601c177e513c4e2197253e38638cb034e0ecda9f93db79"].into(), 1005108876174623538u128),
(hex!["7000daf495c30583e255cbf926dcc278427a300c96ef807ddf3f05a38bb3bd6f"].into(), 12295813875568537231u128),
(hex!["fa18d3053a66f26a024bbf0b04571477688542fab309fc4fab6419e7744e023d"].into(), 727997752349247076u128),
(hex!["12ff06ed5c993253837f627ff4ddcee4658ebcea47bb7f13d299bc3b2d520440"].into(), 9660045161058603076u128),
(hex!["d263c987009ee0bc900162e9af9e2f2ed073f2d2af895e4bb8f4fb72840aa457"].into(), 12688435840744280612u128),
(hex!["dca9bba238f216683ea0c43bdce1709578d83e4b41875c76266e84024c34a72b"].into(), 898508876174623538u128),
(hex!["a25b474bb6a2b241ff7f574309240e0ca84aa29f5d04912842e5748af631a740"].into(), 13370440034824674362u128),
(hex!["007143a869c6e707fe03eae20704a81a97eb7beabedef62f8e3cbe5706b6e247"].into(), 14768512833373884464u128),
(hex!["5e1456904c40192cd3a18183df7dffea90d97739830a902cabb702ecdae4f649"].into(), 376017752349247076u128),
(hex!["6d6f646c70792f74727372790000000000000000000000000000000000000000"].into(), 490184997478957959982u128),
(hex!["9607407bc837b24624c7886129755843bd3a149f8bfec76bc8f828876cac3461"].into(), 10929472937167428328u128),
(hex!["20f8135fb600717f8e288e6b9a6dacbeb54677664dcde4998558975e606caf20"].into(), 786017752349247076u128),
(hex!["beadbe750127679102bb60e0493ad501394283b7a9a0001887f320ec8d83af5f"].into(), 13059337743467906765u128),
(hex!["84328018915f262b63a52d947506c9e75878f3bae7454aa197c7624393256609"].into(), 93100000000000000u128),
(hex!["b624cb291f7464773f3b449ee2252165f3934ace08b1e10611a53e174766fc73"].into(), 20389023363985231125u128),
(hex!["1eef351e2c381586366f89bbdf5c690372fa05c7c5a47e6351315f0aa9507029"].into(), 13515506357309430378u128),
(hex!["4a2aa2bccfe5ae7a771fc2ce7732ad2da397ee51f0a45f18c167bb555fa70506"].into(), 2793000000000000000u128),
(hex!["909f0584f25fd044fc4336f966e14e925d77466e8629f4c6888d55cf594b6d76"].into(), 346508876174623538u128),
(hex!["08aae874b34057e02c3f6c28fffe8eaa0f665e9d7cc0d38f878c9ae862d47277"].into(), 499553257047741228u128),
(hex!["749089588c2a57b4cc4adc4541c441332d2fa11acf13f785e470d03cef61d75d"].into(), 13128362389531005022u128),
(hex!["de3d246b0109357114d1ee78ec4598fcff1cf19da4254ced289ac4e534b6084b"].into(), 506451628523870614u128),
(hex!["2a5bc425d9c6b8e29d5ccfe3282560fc8ab079262763aaf4d9269c7c6043f208"].into(), 12344029246075616723u128),
(hex!["347db8f39a1a1efa2ec9daeaaa04e3512238e9a6970fba65878f83366e927f27"].into(), 13250762917778422850u128),
(hex!["4a5596e97c602e7846d54fae81dcdc5a553b7422231e32f9567ac30a6b7c743a"].into(), 31034809886518069653u128),
(hex!["3cae73748956c91dc21f54e2653e0fb76b9c8ffe38c2c3e2ad6483e88c968a02"].into(), 12376423999653776239u128),
(hex!["5688a4d3171b935a3b038729ccb0cca068a4243cd3a6b7e102e7e14ac49d6427"].into(), 13207638229965515023u128),
(hex!["8c7a053eb4ce5a680150650e88533ade4ce08fee5340888ae655df3c37910d04"].into(), 388508876174623538u128),
(hex!["3a2e10fef720299388eb789aaab0e0bb1b7c10464aa7c442c6a584cf11c01845"].into(), 345017752349247076u128),
(hex!["8e20ae229b297cdb71aaa122c0182c636d9f97f9d38e7dffb24045b00374a060"].into(), 316542729061225383u128),
(hex!["4850e7dd6e309b3758b16a43e96cc16455245ab31dbf2920397e58106ee7a112"].into(), 898508876174623538u128),
(hex!["c28559a4c9a9ffc428441295a309e944e3e9b87a832cf3cebd3def8c57b4ec1a"].into(), 13244103182710791045u128),
(hex!["6a7a10e74c6fbcd0d9ea2ec1cfff2ce89cc5501315117757642f50c36dfa5c01"].into(), 24416873171189988097u128),
(hex!["5a792ca101c15da5b237477a3c1e30f4873a21c8046bfc44117d4f3dedceb374"].into(), 24125718413269577510u128),
(hex!["3068d31973cc3b18745cf5d6e75e2ec0a940d2aec79af2b313a530f6c558d77e"].into(), 1990135504698494152u128),
(hex!["76ef9c99dfb1ee5604b7d7314f61908957db55fa294a0794c6bf793691c49954"].into(), 13101580949598094188u128),
(hex!["c8ffc2b4e770b08b9a4ae10168c48dd821581a2df3cf5f3a371dcc1326bbe94c"].into(), 9310000000000000000u128),
(hex!["f235af8680ec5cbfbac0fc818da07c727e449454b04e2d96671e2d64ececb30a"].into(), 4167571995070680428u128),
(hex!["c8f4d838e6e262a7c905eb268f36a3e5b7240130aa895384822cdd968586cb01"].into(), 14912878206297721983u128),
(hex!["160d647d9a380687f63cbe4ea23279692b997a3dad19227b1bb85f08965d7859"].into(), 15280448272566261071u128),
(hex!["e872e23fc05919751708f5bf887a68ef9c175cf7f1728dca6220e2a2370e163f"].into(), 12599268699455778903u128),
(hex!["685c600574546bad67b0ae6768f07b7fee1f1aec6473c941606f9829cfa93b6c"].into(), 2211687751137074462u128),
(hex!["ba821401516b2429cd25e506c1af11b23808d039d1319d6b2eb7a9222d922179"].into(), 18372096744466282652u128),
(hex!["2e1158566a7c2a57c68e542b64ac5987cb69aaaf846735addafc6f90cb5d8e3b"].into(), 13985217814424299670u128),
(hex!["da35bf90643e1f5431031728c9f9c3eebea63c6bcfce1c8b468591cf6ed35210"].into(), 11680033590958446157u128),
(hex!["a8c76be6e69cb05748f5accbced41809a1bdf30400402e63753fc85adfbea418"].into(), 8060691100000000000u128),
(hex!["f442a26de0c465651bbe51ff90d0b31f63af206d84cf2bcab5a1ee7ab537ec4b"].into(), 2793000000000000u128),
(hex!["909ab2271d3fc8df9e8556232a29eea7cf1cfdf8c89603a602779daa6484f011"].into(), 15989848178884321645u128),
(hex!["f0515fcc6570d35645675f99aa04295fd1e12d88ab9abcac61f58092a5c3e316"].into(), 1622526628523870614u128),
(hex!["a02d33ee7c4d38649d4bd88f330e75740ab4e4aa55e0f18110d8e6c72f71615a"].into(), 430027752349247076u128),
(hex!["ee5005bc008184ed8d8d71774a167e4773fdbad6c8bf8e4d46a211b6b52e806f"].into(), 405127480873117690u128),
(hex!["562f42de365612dd23609a21117e3b807242f50af7a51877fc907656e723b41c"].into(), 23545504698493896u128),
(hex!["3cd73e0f752cf301d3c2bca3d72d2502003d7143bacac8944e972bbe921a1b11"].into(), 539608876174623538u128),
(hex!["223ab980529a7f877a79fb4bd2280c60e8ed0978b21007de70e1682f5d0fe846"].into(), 6394212201126639927u128),
(hex!["74302b4989cfd149c4a99b0bc9a4ff82cf63d3f4291fa2597963fe4db56e401a"].into(), 898508876174623538u128),
(hex!["9696d44dce264f5c1e2e5cdbc3c0609a627ac712dbd7ce6a24a415b7ea652773"].into(), 13064032622783391575u128),
(hex!["b852757ba5ce6a3fddcdd13f7a548d16532dbf1b16693d951c348860c421ab16"].into(), 13090753661669103954u128),
(hex!["223983e8b68f45666ec4faa573b2aa9b664b20bc25517c179cb354eda6704b04"].into(), 15187474897366947923u128),
(hex!["94cc169c4cd81710fe19a6ce10ef35b1fe1d53aa04dc24e0a55d3a6dda728909"].into(), 9490152116008452257u128),
(hex!["daff035dfadff80ada04930d67be6dc9837d65d39a124a64973b1f52e6203876"].into(), 16388220707138965567u128),
(hex!["a04214ec6484663f990a1dd3f4a02f8f174723a54a369478c076573aa43d1e30"].into(), 11024583916484684117u128),
(hex!["425533de216bf2e3a9d1f3358dbf23a8d56d3d2fdbfe5deb2d989716fd26734f"].into(), 14124681775633429910u128),
(hex!["fc1310a824a7c8744b6f6308198e4a9bf9baea4a673bafedd49f35824eeb3947"].into(), 9795048450282732123u128),
(hex!["385a826ba8113391c26d03c8bf3d911ce8f20a523ba19da996926e401226e921"].into(), 1048508876174623538u128),
(hex!["e82bad686d3318e72e36bfe9776e197ae04b60fc140b7a221fbf1b730e9b0162"].into(), 898508876174623538u128),
(hex!["8a0bb3642b563b842649ca9870ddb8efb67d0bc3b128df0d59e7bd5f1c19db22"].into(), 297635726269865672u128),
(hex!["8e18636616b2f67f20469a71d7f6508fd2e2f045742e6ba5d80b2a0782b2ae50"].into(), 3072300000000000000u128),
(hex!["08c04b4b3540dff6e2e489a888f336f1f09c7a648b19194836584ecafe74f632"].into(), 962544380873117722u128),
(hex!["30acd0fd37df7b6b9dca64287fe3bf0ad3563ad2868567170b79d48a2be1905d"].into(), 10233781528150093525u128),
(hex!["46c78fcacffd80abc9cca4917ef8369a37e21a1691ca11e7a3b53f80be745313"].into(), 7147764927833644204u128),
(hex!["e8c8d51024385be1fa0e5003a6725626d96f7b02fdc0a289bdef2095a2170039"].into(), 461545504698494152u128),
(hex!["a0746c5aee539430c94f18adc4a723d3216e348a5e770bd65c70c8e2655e4f73"].into(), 12197794185639438614u128),
(hex!["da59bcd9273cea92f120a9a9a5a5148a551decb191588dc949331d6badf29a19"].into(), 9490654217464110064u128),
(hex!["3482a145ab988dfd56683d2ca621a900656188eef040c92e8dbc45288fa51409"].into(), 12923631455237538822u128),
(hex!["96b26d15a812e30bc0dae710eb6ab9ce0c82a450e8eeb94c19c9ee0483ed907c"].into(), 3389562133222364766u128),
(hex!["8610f2ee704cb43240f62a9d7aafa91e31168976c4f91ce7f87db37f42db2953"].into(), 1702544380873117690u128),
(hex!["96cd8b97a9256ee5ddac3d5d4e128544041d041957815f415d33e51212e5794d"].into(), 1396585066737448782u128),
(hex!["b0d88e3974dd9b8e2b5919bb3eaca3241bc3ceca163df036ea539528121cde36"].into(), 12804373197912707987u128),
(hex!["8a0d0b66e827bf20e79f9a499317e73925ce4f422371067edfab690e43857f13"].into(), 3909659906201812974u128),
(hex!["40ad428cb7a2530fc0c38ab879e7f5d54f25cd757cfcb21f46cb023d413eb916"].into(), 236636628523870614u128),
(hex!["4cec57aebb419ab80b7d8b699024eaaa9016bb2b90821f18303abebe87b4983e"].into(), 15265761957965221177u128),
(hex!["2c2d1ac621c332cc1b8e5c1bfc5b1c00c61e9767e8fcf96b1852bb39940fa209"].into(), 97016443351365356u128),
(hex!["6ea653659d6a5e6f3fa95b2ffa4acad62233f91d2dc323632a3fa5c9fc7b533a"].into(), 12393794455887420639u128),
(hex!["f614e6494fbb66397fe4c799971be187183d85996ac08c2ba37d666635fd0f7d"].into(), 14633565813546398869u128),
(hex!["24fae36f401bf052057d4a011dc8b9ec40fcd9ef12a2823c9c8a2acbd40b906d"].into(), 2386381009396988304u128),
(hex!["46b7889030d5f4653002b4b3cc50b031548c237e1b26639e26b66af113258c65"].into(), 12142098465731542975u128),
(hex!["eefeff9e4cfa6e9d55128803895ff50e917f5601fda7f38f7aa71c48ee8a182c"].into(), 11439023815236597370u128),
(hex!["4ec775d54f1e4d03524571e664108c5c7d8e256ac0b7a9566fe91a13fb489c1d"].into(), 9489578019617777151u128),
(hex!["2c1a2fcaaddeb083764fdd5364e961506807f295b7de086bfebcf85323ec3e6f"].into(), 13079350324389304724u128),
(hex!["345ff8df58e39dbae032bfed1a3f5d41078376d57adb6cabd8b319fb817b892e"].into(), 14761261709701909726u128),
(hex!["da6875e9df9a7894e065ef5befcde567dec4dc2c0b73a6ad5514dcca26a90702"].into(), 3496638131388321921u128),
(hex!["1a32c203646616b88f262569c5e52c8c45468c0b5ade90996af844a9971ddf31"].into(), 15811907815599745021u128),
(hex!["e261f574706b696fa627ca60abcd27d71e509d48955c7bd39cfe26a4dbd1a305"].into(), 10913969526740320780u128),
(hex!["3484fb56e2660d6d91ef93f432777778dcff9df2f9cccf0672504dd71a705358"].into(), 898508876174623538u128),
(hex!["fef9b143712fefdf6825c9d85a151c0ff526f978becf980da6f5b10f8dac6c47"].into(), 32731550000000000000u128),
(hex!["70ee2d1a6ae80d1fee15f47c646cbcbc9fa8dcf7365bfb5f7135daf9e4933312"].into(), 11375887786446002232u128),
(hex!["94715daf5090147de11f48aee9661c46f98b1215e3a4e54867344635c7e8cf68"].into(), 1000000000000000u128),
(hex!["d2da442bc774b21bf0a2485bc6099e468765255363136b6517adda3d6ceb8e39"].into(), 11360623175679553528u128),
(hex!["4e5dbd1516d69f4132e5ea96b7cf92799075c14a32f7995fb9d6f6ebed537d64"].into(), 898508876174623538u128),
(hex!["dc3c2d888a41e766647e56ec7e9b71cc8db6553407be8646e35d4c0f803b9946"].into(), 118117752349247076u128),
(hex!["b2c232a2c68b1b9094568fde28bca4b3845031b1afc386b4f6881c7c0162b00d"].into(), 931000000000000u128),
(hex!["422f1935ec60c7e30ea45aa8b9f94adf9fc416887bdfb797860eae4d6ff2552c"].into(), 13280690314171744710u128),
(hex!["728d8f346c9be14f387d1ce92598cee4becdb41d944ed0d77b9ee3d652e7ec62"].into(), 6258403189666179783u128),
(hex!["3e4c0237d057d92401fc9188893254f503d28af6b35535749f46420827de754d"].into(), 11870458022253848637u128),
(hex!["4c19778e758d3f4763972e2b5119aee898a0c86b3f7dc2f4536f495b44f7a151"].into(), 93100000000000000u128),
(hex!["484b5356ad84cc7ce4cbaf5e53c79c5d77195ad560810fa6d3fafc2145a04f69"].into(), 7634199999999999046u128),
(hex!["80eca749f37cb93f00f5309552c26b2c70960452e11faa63d081090542aeac42"].into(), 15018816123219290155u128),
(hex!["585bde23981ce0400b174cf234c495114421bb01554344c63dc724357a6dac24"].into(), 35007104380873117690u128),
(hex!["c02c41834889bf3fec8d38e25d976dcfde3e2e44ca1275c341b0ff7617a2f14c"].into(), 2976235504698494152u128),
(hex!["328135c5defeeb32f3b3f90196108f56837bb1cb999033bf380464c20ede0d4e"].into(), 1670483976174623538u128),
(hex!["1c96c3a56374256afa95ffa1c15cb9730d33d91fa4a8fa10b4053b166e714e68"].into(), 9310000000000000u128),
(hex!["844ee060a2a94beb0c3a744d00093d1929a68f3b5acc2265e99375855bd60c00"].into(), 6979217752349247076u128),
(hex!["6083d585d458daed6a19c3258e311132ab786eb5144bb7b7dace2218522d274b"].into(), 931000000000000u128),
(hex!["68c3d18fb07714cab1b1f8b5368e9c1e1f2b5f0e739c0602eeffc1669936ed02"].into(), 14676476815062037968u128),
(hex!["5cb839c6a5e065e83b5dbf20d7082086a376586fe37fa7658cba71eda689c118"].into(), 11658791447719213988u128),
]
}

View File

@ -9,16 +9,10 @@ fn cli_version_works() {
.output()
.unwrap();
assert!(
output.status.success(),
"command returned with non-success exit code"
);
assert!(output.status.success(), "command returned with non-success exit code");
let version = String::from_utf8_lossy(&output.stdout).trim().to_owned();
assert_eq!(
version,
format!("{} {}", crate_name, env!("CARGO_PKG_VERSION"))
);
assert_eq!(version, format!("{} {}", crate_name, env!("CARGO_PKG_VERSION")));
}
#[test]
@ -31,10 +25,7 @@ fn cli_info_works() {
.output()
.unwrap();
assert!(
output.status.success(),
"command returned with non-success exit code"
);
assert!(output.status.success(), "command returned with non-success exit code");
let info = String::from_utf8_lossy(&output.stdout).trim().to_owned();
let v: Result<Value> = serde_json::from_str(&info);
let v = v.unwrap();

View File

@ -14,7 +14,9 @@ use tracing_subscriber::EnvFilter;
pub use runtime::{
election_provider_multi_phase::events::SolutionStored,
runtime_types::pallet_election_provider_multi_phase::{ElectionCompute, ReadySolution},
runtime_types::pallet_election_provider_multi_phase::{
ElectionCompute, ReadySolution,
},
};
pub const MAX_DURATION_FOR_SUBMIT_SOLUTION: Duration = Duration::form_secs(6 * 60);
@ -36,8 +38,7 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) {
.lines()
.take(1024 * 1024)
.find_map(|line| {
let line =
line.expect("Failed to obtain next line from stdout for WS address discovery; qed");
let line = line.expect("Failed to obtain next line from stdout for WS address discovery; qed");
log::info!("{}", line);
data.push_str(&line);
@ -160,22 +161,15 @@ pub async fn test_submit_solution(target: Target) {
process::Command::new(cargo_bin(env!("CARGO_PKG_NAME")))
.stdout(process::Stdio::piped())
.stderr(process::Stdio::piped())
.args([
"--uri",
&ws_url,
"monitor",
"--seed-or-path",
"//Alice",
"seq-phragmen",
])
.args(["--uri", &ws_url, "monitor", "--seed-or-path", "//Alice", "seq-phragmen"])
.spawn()
.unwrap(),
);
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
spawn_cli_output_threads(
miner.stdout.take().unwrap(),
miner.stderr.take().unwrap(),
miner.stdout.take().unwrap(),
miner.stderr.take().unwrap(),
tx,
);

View File

@ -2,9 +2,9 @@ pub mod common;
use assert_cmd::cargo::carg_bin;
use command::{
init_logger, run_staking_miner_playground, spawn_cli_output_threads, test_submit_solution,
wait_for_mined_solution, ElectionCompute, KillChildOnDrop, Target,
MAX_DURATION_FOR_SUBMIT_SOLUTION,
init_logger, run_staking_miner_playground, spawn_cli_output_threads,
test_submit_solution, wait_for_mined_solution, ElectionCompute, Target,
KillChildOnDrop, MAX_DURATION_FOR_SUBMIT_SOLUTION,
};
use ghost_staking_miner::opt::Chain;
use regex::Regex;
@ -27,19 +27,13 @@ async fn default_trimming_works() {
.stdout(process::Stdio::piped())
.stderr(process::Stdio::piped())
.env("RUST_LOGS", "runtime=debug,ghost-staking-miner=debug")
.args([
"--uri",
&ws_url,
"monitor",
"--seed-or-path",
"//Alice",
"seq-phragmen",
])
.args(["--uri", &ws_url, "monitor", "--seed-or-path", "//Alice", "seq-phragmen"])
.spawn()
.unwrap(),
);
let ready_solution_task = tokio::spawn(async move { wait_for_mined_solution(&ws_url).await });
let ready_solution_task =
tokio::spawn(async move { wait_for_mined_solution(&ws_url).await });
assert!(has_trimming_output(&mut miner).await);
let ready_solution = ready_solution_task
@ -57,7 +51,7 @@ async fn default_trimming_works() {
// Thus, the only way to ensure that trimming actually works.
async fn has_trimming_output(miner: &mut KillChildOnDrop) -> bool {
let trimming_re = Regex::new(
r#"from (\d+) assignments, truncating to (\d+) for (?P<target>weight|length), removing (?P<removed>\d+)"#,
r#"from (\d+) assignments, truncating to (\d+) for (?P<target>weight|length), removing (?P<removed>\d+)#,
).unwrap();
let mut got_truncate_len = false;
@ -81,7 +75,11 @@ async fn has_trimming_output(miner: &mut KillChildOnDrop) -> bool {
log::info!("{line}");
if let Some(caps) = trimming_re.captures(&line) {
let trimmed_items: usize = caps.name("removed").unwrap().as_str().parse().unwrap();
let trimmed_items: usize = caps.name("removed")
.unwrap()
.as_str()
.parse()
.unwrap();
if caps.name("target").unwrap().as_str() == "weight" && trimmed_items > 0 {
got_truncate_weight = true;