Compare commits

...

30 Commits

Author SHA1 Message Date
d5643472ee
update chain specification based on NetworkData new fields
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-18 18:56:08 +03:00
a503295939
update weights for the ghost-networks on the casper runtime
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-18 18:54:44 +03:00
671196ebac
remove legacy release_delay and add block_distance for maximum block range for the eth_getLogs
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-18 18:53:19 +03:00
39a6192d28
avoid re-using of to_block during rotation of block_range
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-18 17:20:25 +03:00
6100e79ebf
make clap regardless of fail during applause
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-18 17:03:09 +03:00
99c43a0c24
runtime update, with history depth for the slow clap
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-18 14:17:02 +03:00
417de5a7b2
clear storage based on provided history depth
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-18 13:47:13 +03:00
b5845924dc
fixes for the default weights on slow-clap package
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-17 20:56:32 +03:00
7107283121
update casper runtime with pre-calculated weights
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-17 20:46:39 +03:00
f28e57cf8e
add files with weights for the slow-clap, benchmarked according to the casper reference machine
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-17 20:44:44 +03:00
3040dfb775
make benchmark work, issue with authorities fixed
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-06-17 20:34:42 +03:00
1196cc9faa
changes to runtime based on the new version of ghost-slow claps
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-17 13:54:32 +03:00
66fa8409fa
additional tests for the pallet
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-17 13:50:38 +03:00
5beb22f116
avoid errors from minting sub-existential balance
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-13 16:42:14 +03:00
7be24ed139
use latest version of ghost-networks
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-13 16:22:21 +03:00
e73f3855fd
authorities stored based on the session hash map
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-11 22:56:48 +03:00
a00eec9bb9
tests for clap and applause events added
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-04 16:33:03 +03:00
2c2df5a607
ability to do self applause if claps received
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-04 15:44:53 +03:00
186fb58367
merge new functionality which will be used for benchmarking purposes
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-04 15:40:13 +03:00
573e57dfb4
new tests based on new ghost-network functinality
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-03 20:41:51 +03:00
46d4716f67
merge extended ghost-networks with ability to nullify accumulated commission
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-03 19:48:23 +03:00
9cb7f3c782
replacing the average claps in session with median to determine a harmful authority
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-03 19:38:07 +03:00
04a63e234d
tests updated and small tweaks of the lib
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-02 19:20:14 +03:00
2b738c009b
merge latest ghost-network version
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-06-02 19:17:16 +03:00
2da07d7b24
chmod 644 Cargo.toml for ghost-slow-claps
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-05-31 14:55:30 +03:00
9ba25d6b3d
friendly merge for ghost-claims weights
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-05-31 14:51:53 +03:00
3234341fed
use benchmarked weights as a default weights for ghost-claims pallet
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-05-31 14:48:08 +03:00
fa2cb811a8
update for slow-claps: remove companions, updgrade block range storage, new way of commission accumulation
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
2025-05-31 14:30:15 +03:00
561d4430b4
another indention fix in main Cargo.toml
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-05-31 14:21:21 +03:00
b64700fb42
fix indentation in TOML files
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-05-31 13:12:48 +03:00
28 changed files with 2142 additions and 1884 deletions

24
Cargo.lock generated
View File

@ -1186,7 +1186,7 @@ dependencies = [
[[package]] [[package]]
name = "casper-runtime" name = "casper-runtime"
version = "3.5.20" version = "3.5.23"
dependencies = [ dependencies = [
"casper-runtime-constants", "casper-runtime-constants",
"frame-benchmarking", "frame-benchmarking",
@ -3504,7 +3504,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-claims" name = "ghost-claims"
version = "0.2.2" version = "0.2.3"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -3528,7 +3528,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-cli" name = "ghost-cli"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"clap 4.5.4", "clap 4.5.4",
@ -3584,7 +3584,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-machine-primitives" name = "ghost-machine-primitives"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"sc-sysinfo", "sc-sysinfo",
@ -3593,7 +3593,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-metrics" name = "ghost-metrics"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"assert_cmd", "assert_cmd",
"bs58 0.5.1", "bs58 0.5.1",
@ -3648,7 +3648,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-networks" name = "ghost-networks"
version = "0.1.4" version = "0.1.7"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -3667,7 +3667,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-node" name = "ghost-node"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"assert_cmd", "assert_cmd",
"color-eyre", "color-eyre",
@ -3698,7 +3698,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-rpc" name = "ghost-rpc"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"ghost-core-primitives", "ghost-core-primitives",
"jsonrpsee", "jsonrpsee",
@ -3750,7 +3750,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-service" name = "ghost-service"
version = "0.7.197" version = "0.7.198"
dependencies = [ dependencies = [
"assert_matches", "assert_matches",
"async-trait", "async-trait",
@ -3834,7 +3834,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-slow-clap" name = "ghost-slow-clap"
version = "0.3.15" version = "0.3.27"
dependencies = [ dependencies = [
"frame-benchmarking", "frame-benchmarking",
"frame-support", "frame-support",
@ -3843,6 +3843,8 @@ dependencies = [
"log", "log",
"pallet-balances", "pallet-balances",
"pallet-session", "pallet-session",
"pallet-staking",
"pallet-staking-reward-curve",
"parity-scale-codec", "parity-scale-codec",
"scale-info", "scale-info",
"serde", "serde",
@ -3868,7 +3870,7 @@ dependencies = [
[[package]] [[package]]
name = "ghost-traits" name = "ghost-traits"
version = "0.3.20" version = "0.3.22"
dependencies = [ dependencies = [
"frame-support", "frame-support",
"sp-runtime 31.0.1", "sp-runtime 31.0.1",

View File

@ -17,7 +17,7 @@ homepage.workspace = true
[workspace.package] [workspace.package]
license = "GPL-3.0-only" license = "GPL-3.0-only"
authors = ["571nky", "57r37ch", "f4750"] authors = ["571nky", "57r37ch", "f4750"]
version = "0.7.197" version = "0.7.198"
edition = "2021" edition = "2021"
homepage = "https://ghostchain.io" homepage = "https://ghostchain.io"
repository = "https://git.ghostchain.io/ghostchain/ghost-node" repository = "https://git.ghostchain.io/ghostchain/ghost-node"
@ -258,24 +258,24 @@ substrate-build-script-utils = { workspace = true }
resolver = "2" resolver = "2"
members = [ members = [
"core-primitives", "core-primitives",
"cli", "cli",
"rpc", "rpc",
"service", "service",
"metrics", "metrics",
"client/cli", "client/cli",
"primitives/machine", "primitives/machine",
"runtime/common", "runtime/common",
"runtime/casper", "runtime/casper",
"runtime/casper/constants", "runtime/casper/constants",
"pallets/networks", "pallets/networks",
"pallets/claims", "pallets/claims",
"pallets/slow-clap", "pallets/slow-clap",
"utils/bags-list", "utils/bags-list",
"utils/chain-spec-builder", "utils/chain-spec-builder",
"utils/generate-bags", "utils/generate-bags",
"utils/ghostkey", "utils/ghostkey",
"utils/staking-miner", "utils/staking-miner",
] ]
[badges] [badges]

View File

@ -52,14 +52,14 @@ substrate-build-script-utils = { workspace = true }
default = ["cli", "db", "full-node"] default = ["cli", "db", "full-node"]
db = ["service/db"] db = ["service/db"]
cli = [ cli = [
"clap", "clap",
"frame-benchmarking-cli", "frame-benchmarking-cli",
"sc-cli", "sc-cli",
"sc-service", "sc-service",
"sc-tracing", "sc-tracing",
"service", "service",
"ghost-client-cli", "ghost-client-cli",
"ghost-machine-primitives", "ghost-machine-primitives",
] ]
runtime-benchmarks = [ runtime-benchmarks = [
"frame-benchmarking-cli?/runtime-benchmarks", "frame-benchmarking-cli?/runtime-benchmarks",

View File

@ -15,7 +15,7 @@ sp-runtime = { workspace = true }
[features] [features]
default = ["std"] default = ["std"]
std = [ std = [
"sp-core/std", "sp-core/std",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std", "sp-std/std",
] ]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-claims" name = "ghost-claims"
version = "0.2.2" version = "0.2.3"
description = "Ghost balance and rank claims based on EVM actions" description = "Ghost balance and rank claims based on EVM actions"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true
@ -37,17 +37,17 @@ serde_json = { workspace = true, default-features = true }
[features] [features]
default = ["std"] default = ["std"]
std = [ std = [
"frame-benchmarking?/std", "frame-benchmarking?/std",
"serde/std", "serde/std",
"codec/std", "codec/std",
"scale-info/std", "scale-info/std",
"libsecp256k1/std", "libsecp256k1/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"sp-core/std", "sp-core/std",
"sp-runtime/std", "sp-runtime/std",
"sp-io/std", "sp-io/std",
"sp-std/std", "sp-std/std",
"pallet-ranked-collective/std", "pallet-ranked-collective/std",
"pallet-vesting/std", "pallet-vesting/std",
"pallet-balances/std", "pallet-balances/std",
@ -56,19 +56,19 @@ std = [
runtime-benchmarks = [ runtime-benchmarks = [
"libsecp256k1/hmac", "libsecp256k1/hmac",
"libsecp256k1/static-context", "libsecp256k1/static-context",
"frame-benchmarking/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks", "frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks", "frame-system/runtime-benchmarks",
"pallet-ranked-collective/runtime-benchmarks", "pallet-ranked-collective/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks", "pallet-vesting/runtime-benchmarks",
"pallet-balances/runtime-benchmarks", "pallet-balances/runtime-benchmarks",
"sp-runtime/runtime-benchmarks", "sp-runtime/runtime-benchmarks",
] ]
try-runtime = [ try-runtime = [
"frame-support/try-runtime", "frame-support/try-runtime",
"frame-system/try-runtime", "frame-system/try-runtime",
"pallet-ranked-collective/try-runtime", "pallet-ranked-collective/try-runtime",
"pallet-vesting/try-runtime", "pallet-vesting/try-runtime",
"pallet-balances/try-runtime", "pallet-balances/try-runtime",
"sp-runtime/try-runtime", "sp-runtime/try-runtime",
] ]

View File

@ -20,8 +20,9 @@ extern crate alloc;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
use alloc::{format, string::String}; use alloc::{format, string::String};
pub mod weights; mod weights;
pub use crate::weights::WeightInfo; pub use crate::weights::WeightInfo;
mod tests; mod tests;
mod mock; mod mock;
mod benchmarking; mod benchmarking;

View File

@ -1,9 +1,104 @@
use frame_support::weights::Weight; // 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 `ghost_claims`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-02, 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=ghost_claims
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_claims.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
traits::Get,
weights::{Weight, constants::RocksDbWeight},
};
use core::marker::PhantomData;
/// Weight functions needed for `ghost_claims`.
pub trait WeightInfo { pub trait WeightInfo {
fn claim() -> Weight; fn claim() -> Weight;
}
/// Weight for ghost_claims using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `GhostClaims::Total` (r:1 w:1)
/// Proof: `GhostClaims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `CultCollective::Members` (r:2 w:2)
/// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
/// Storage: `CultCollective::MemberCount` (r:6 w:6)
/// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
/// Storage: `CultCollective::IdToIndex` (r:6 w:12)
/// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `CultCollective::IndexToId` (r:0 w:6)
/// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn claim() -> Weight {
// Proof Size summary in bytes:
// Measured: `896`
// Estimated: `16164`
// Minimum execution time: 754_086_000 picoseconds.
Weight::from_parts(756_147_000, 0)
.saturating_add(Weight::from_parts(0, 16164))
.saturating_add(T::DbWeight::get().reads(17))
.saturating_add(T::DbWeight::get().writes(29))
}
} }
impl WeightInfo for () { impl WeightInfo for () {
fn claim() -> Weight { Weight::zero() } /// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `GhostClaims::Total` (r:1 w:1)
/// Proof: `GhostClaims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `CultCollective::Members` (r:2 w:2)
/// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
/// Storage: `CultCollective::MemberCount` (r:6 w:6)
/// Proof: `CultCollective::MemberCount` (`max_values`: None, `max_size`: Some(14), added: 2489, mode: `MaxEncodedLen`)
/// Storage: `CultCollective::IdToIndex` (r:6 w:12)
/// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
/// Storage: `CultCollective::IndexToId` (r:0 w:6)
/// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn claim() -> Weight {
// Proof Size summary in bytes:
// Measured: `896`
// Estimated: `16164`
// Minimum execution time: 754_086_000 picoseconds.
Weight::from_parts(756_147_000, 0)
.saturating_add(Weight::from_parts(0, 16164))
.saturating_add(RocksDbWeight::get().reads(17))
.saturating_add(RocksDbWeight::get().writes(29))
}
} }

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-networks" name = "ghost-networks"
version = "0.1.6" version = "0.1.7"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true

View File

@ -31,7 +31,7 @@ fn prepare_network<T: Config>(
gatekeeper, gatekeeper,
topic_name, topic_name,
finality_delay: Some(69), finality_delay: Some(69),
release_delay: Some(69), block_distance: 69,
network_type: NetworkType::Evm, network_type: NetworkType::Evm,
incoming_fee: 0, incoming_fee: 0,
outgoing_fee: 0, outgoing_fee: 0,
@ -120,16 +120,16 @@ benchmarks! {
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network); assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
} }
update_network_release_delay { update_network_block_distance {
let delay = Some(1337); let block_distance = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1); let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin() let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?; .map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?; let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), delay) }: _<T::RuntimeOrigin>(authority, chain_id.clone(), block_distance)
verify { verify {
assert_last_event::<T>(Event::NetworkReleaseDelayUpdated { assert_last_event::<T>(Event::NetworkBlockDistanceUpdated {
chain_id: chain_id.clone(), release_delay: delay, chain_id: chain_id.clone(), block_distance,
}.into()); }.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network); assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
} }

View File

@ -55,8 +55,8 @@ pub struct NetworkData {
pub gatekeeper: Vec<u8>, pub gatekeeper: Vec<u8>,
pub topic_name: Vec<u8>, pub topic_name: Vec<u8>,
pub finality_delay: Option<u64>, pub finality_delay: Option<u64>,
pub release_delay: Option<u64>,
pub network_type: NetworkType, pub network_type: NetworkType,
pub block_distance: u64,
pub incoming_fee: u32, pub incoming_fee: u32,
pub outgoing_fee: u32, pub outgoing_fee: u32,
} }
@ -158,7 +158,7 @@ pub mod module {
NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> }, NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> },
NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> }, NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> },
NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option<u64> }, NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option<u64> },
NetworkReleaseDelayUpdated { chain_id: T::NetworkId, release_delay: Option<u64> }, NetworkBlockDistanceUpdated { chain_id: T::NetworkId, block_distance: u64 },
NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType }, NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType },
NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> }, NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> },
NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> }, NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> },
@ -303,16 +303,16 @@ pub mod module {
} }
#[pallet::call_index(4)] #[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::update_network_release_delay())] #[pallet::weight(T::WeightInfo::update_network_block_distance())]
pub fn update_network_release_delay( pub fn update_network_block_distance(
origin: OriginFor<T>, origin: OriginFor<T>,
chain_id: T::NetworkId, chain_id: T::NetworkId,
release_delay: Option<u64>, block_distance: u64,
) -> DispatchResult { ) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?; T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_release_delay( Self::do_update_network_block_distance(
chain_id, chain_id,
release_delay, block_distance,
) )
} }
@ -484,21 +484,21 @@ impl<T: Config> Pallet<T> {
Ok(()) Ok(())
} }
/// Update existent network default endpoint. /// Update existent network default max distance between blocks.
pub fn do_update_network_release_delay( pub fn do_update_network_block_distance(
chain_id: T::NetworkId, chain_id: T::NetworkId,
release_delay: Option<u64>, block_distance: u64,
) -> DispatchResult { ) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult { Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist); ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap(); let net = maybe_network.as_mut().unwrap();
net.release_delay = release_delay; net.block_distance = block_distance;
*maybe_network = Some(net.clone()); *maybe_network = Some(net.clone());
Ok(()) Ok(())
})?; })?;
Self::deposit_event(Event::<T>::NetworkReleaseDelayUpdated { Self::deposit_event(Event::<T>::NetworkBlockDistanceUpdated {
chain_id, chain_id,
release_delay, block_distance,
}); });
Ok(()) Ok(())
} }

View File

@ -12,7 +12,7 @@ fn prepare_network_data() -> (u32, NetworkData) {
chain_name: "Ethereum".into(), chain_name: "Ethereum".into(),
default_endpoint: "https:://some-endpoint.my-server.com/v1/my-super-secret-key".into(), default_endpoint: "https:://some-endpoint.my-server.com/v1/my-super-secret-key".into(),
finality_delay: Some(69), finality_delay: Some(69),
release_delay: Some(69), block_distance: 69,
network_type: NetworkType::Evm, network_type: NetworkType::Evm,
gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(), gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(),
topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(), topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(),
@ -137,21 +137,21 @@ fn could_update_network_finality_delay_from_authority_account() {
} }
#[test] #[test]
fn could_update_network_release_delay_from_authority_account() { fn could_update_network_block_distance_from_authority_account() {
ExtBuilder::build() ExtBuilder::build()
.execute_with(|| { .execute_with(|| {
let new_release_delay = Some(1337); let new_block_distance = 1337;
let (chain_id, network) = prepare_network_data(); let (chain_id, network) = prepare_network_data();
register_and_check_network(chain_id, network.clone()); register_and_check_network(chain_id, network.clone());
assert_ok!(GhostNetworks::update_network_release_delay( assert_ok!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(UpdaterAccount::get()), RuntimeOrigin::signed(UpdaterAccount::get()),
chain_id, new_release_delay)); chain_id, new_block_distance));
System::assert_last_event(RuntimeEvent::GhostNetworks( System::assert_last_event(RuntimeEvent::GhostNetworks(
crate::Event::NetworkReleaseDelayUpdated { crate::Event::NetworkBlockDistanceUpdated {
chain_id, chain_id,
release_delay: new_release_delay })); block_distance: new_block_distance }));
let mut final_network = network.clone(); let mut final_network = network.clone();
final_network.release_delay = new_release_delay; final_network.block_distance = new_block_distance;
assert_eq!(Networks::<Test>::get(chain_id), Some(final_network.clone())); assert_eq!(Networks::<Test>::get(chain_id), Some(final_network.clone()));
assert_ne!(network, final_network); assert_ne!(network, final_network);
}); });
@ -333,18 +333,19 @@ fn could_not_update_network_release_delay_from_random_account() {
ExtBuilder::build() ExtBuilder::build()
.execute_with(|| { .execute_with(|| {
let (chain_id, network) = prepare_network_data(); let (chain_id, network) = prepare_network_data();
let block_distance = 1337;
register_and_check_network(chain_id, network.clone()); register_and_check_network(chain_id, network.clone());
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(RegistererAccount::get()), RuntimeOrigin::signed(RegistererAccount::get()),
chain_id, Some(1337)), chain_id, block_distance),
DispatchError::BadOrigin); DispatchError::BadOrigin);
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(RemoverAccount::get()), RuntimeOrigin::signed(RemoverAccount::get()),
chain_id, Some(1337)), chain_id, block_distance),
DispatchError::BadOrigin); DispatchError::BadOrigin);
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(RandomAccount::get()), RuntimeOrigin::signed(RandomAccount::get()),
chain_id, Some(1337)), chain_id, block_distance),
DispatchError::BadOrigin); DispatchError::BadOrigin);
assert_eq!(Networks::<Test>::get(chain_id), Some(network)); assert_eq!(Networks::<Test>::get(chain_id), Some(network));
}); });
@ -508,9 +509,9 @@ fn could_not_update_release_delay_for_non_existent_network() {
.execute_with(|| { .execute_with(|| {
let chain_id: u32 = 1; let chain_id: u32 = 1;
assert_eq!(Networks::<Test>::get(chain_id), None); assert_eq!(Networks::<Test>::get(chain_id), None);
assert_err!(GhostNetworks::update_network_release_delay( assert_err!(GhostNetworks::update_network_block_distance(
RuntimeOrigin::signed(UpdaterAccount::get()), RuntimeOrigin::signed(UpdaterAccount::get()),
chain_id, Some(1337)), chain_id, 1337),
crate::Error::<Test>::NetworkDoesNotExist); crate::Error::<Test>::NetworkDoesNotExist);
assert_eq!(Networks::<Test>::get(chain_id), None); assert_eq!(Networks::<Test>::get(chain_id), None);
}); });

View File

@ -7,7 +7,7 @@
// Ghost Network is distributed in the hope that it will be useful, // Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
@ -15,14 +15,14 @@
//! Autogenerated weights for `ghost_networks` //! Autogenerated weights for `ghost_networks`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2023-11-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-06-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghost`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("casper-dev"), DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
// Executed Command: // Executed Command:
// ./target/production/ghost // ./target/release/ghost
// benchmark // benchmark
// pallet // pallet
// --chain=casper-dev // --chain=casper-dev
@ -30,8 +30,8 @@
// --repeat=20 // --repeat=20
// --pallet=ghost_networks // --pallet=ghost_networks
// --extrinsic=* // --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled // --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt // --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_networks.rs // --output=./runtime/casper/src/weights/ghost_networks.rs
@ -53,7 +53,7 @@ pub trait WeightInfo {
fn update_network_name(n: u32, ) -> Weight; fn update_network_name(n: u32, ) -> Weight;
fn update_network_endpoint(n: u32, ) -> Weight; fn update_network_endpoint(n: u32, ) -> Weight;
fn update_network_finality_delay() -> Weight; fn update_network_finality_delay() -> Weight;
fn update_network_release_delay() -> Weight; fn update_network_block_distance() -> Weight;
fn update_network_type() -> Weight; fn update_network_type() -> Weight;
fn update_network_gatekeeper() -> Weight; fn update_network_gatekeeper() -> Weight;
fn update_network_topic_name() -> Weight; fn update_network_topic_name() -> Weight;
@ -65,260 +65,290 @@ pub trait WeightInfo {
/// Weight for ghost_networks using the Substrate node and recommended hardware. /// Weight for ghost_networks using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>); pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// The range of component `i` is `[1, 20]`.
/// The range of component `m` is `[1, 150]`. /// The range of component `j` is `[1, 150]`.
fn register_network(_n: u32, _m: u32, ) -> Weight { fn register_network(i: u32, j: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `76` // Measured: `109`
// Estimated: `2551` // Estimated: `3574`
// Minimum execution time: 32_086 nanoseconds. // Minimum execution time: 43_624_000 picoseconds.
Weight::from_parts(33_092_855, 2551) Weight::from_parts(44_945_690, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 3_439
.saturating_add(Weight::from_parts(15_557, 0).saturating_mul(i.into()))
// Standard Error: 450
.saturating_add(Weight::from_parts(3_508, 0).saturating_mul(j.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// 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: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_496 nanoseconds. // Minimum execution time: 48_741_000 picoseconds.
Weight::from_parts(35_728_230, 2616) Weight::from_parts(50_426_703, 0)
// Standard Error: 2_591 .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 150]`. /// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(_n: u32, ) -> Weight { fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_666 nanoseconds. // Minimum execution time: 49_090_000 picoseconds.
Weight::from_parts(35_959_961, 2616) Weight::from_parts(50_734_447, 0)
// Standard Error: 381 .saturating_add(Weight::from_parts(0, 3759))
// Standard Error: 863
.saturating_add(Weight::from_parts(786, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight { fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_107_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(48_993_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_release_delay() -> Weight { fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_277_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(49_393_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight { fn update_network_type() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_976 nanoseconds. // Minimum execution time: 47_642_000 picoseconds.
Weight::from_parts(36_182_000, 2616) Weight::from_parts(49_212_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight { fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_440_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_315_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight { fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_469_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_532_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight { fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_858_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(48_703_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight { fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_895_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(49_230_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight { fn remove_network() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_336 nanoseconds. // Minimum execution time: 44_052_000 picoseconds.
Weight::from_parts(34_609_000, 2616) Weight::from_parts(44_612_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
} }
impl WeightInfo for () { impl WeightInfo for () {
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// The range of component `i` is `[1, 20]`.
/// The range of component `m` is `[1, 150]`. /// The range of component `j` is `[1, 150]`.
fn register_network(_n: u32, _m: u32, ) -> Weight { fn register_network(i: u32, j: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `76` // Measured: `109`
// Estimated: `2551` // Estimated: `3574`
// Minimum execution time: 32_086 nanoseconds. // Minimum execution time: 43_624_000 picoseconds.
Weight::from_parts(33_092_855, 2551) Weight::from_parts(44_945_690, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 3_439
.saturating_add(Weight::from_parts(15_557, 0).saturating_mul(i.into()))
// Standard Error: 450
.saturating_add(Weight::from_parts(3_508, 0).saturating_mul(j.into()))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`. /// 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: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_496 nanoseconds. // Minimum execution time: 48_741_000 picoseconds.
Weight::from_parts(35_728_230, 2616) Weight::from_parts(50_426_703, 0)
// Standard Error: 2_591 .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 150]`. /// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(_n: u32, ) -> Weight { fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_666 nanoseconds. // Minimum execution time: 49_090_000 picoseconds.
Weight::from_parts(35_959_961, 2616) Weight::from_parts(50_734_447, 0)
// Standard Error: 381 .saturating_add(Weight::from_parts(0, 3759))
// Standard Error: 863
.saturating_add(Weight::from_parts(786, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight { fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_107_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(48_993_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_release_delay() -> Weight { fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_860 nanoseconds. // Minimum execution time: 48_277_000 picoseconds.
Weight::from_parts(34_995_000, 2616) Weight::from_parts(49_393_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight { fn update_network_type() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_976 nanoseconds. // Minimum execution time: 47_642_000 picoseconds.
Weight::from_parts(36_182_000, 2616) Weight::from_parts(49_212_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight { fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_440_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_315_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight { fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 49_469_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(50_532_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight { fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_858_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(48_703_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight { fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 34_768 nanoseconds. // Minimum execution time: 47_895_000 picoseconds.
Weight::from_parts(35_580_000, 2616) Weight::from_parts(49_230_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }
/// Storage: GhostNetworks Networks (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight { fn remove_network() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `141` // Measured: `294`
// Estimated: `2616` // Estimated: `3759`
// Minimum execution time: 33_336 nanoseconds. // Minimum execution time: 44_052_000 picoseconds.
Weight::from_parts(34_609_000, 2616) Weight::from_parts(44_612_000, 0)
.saturating_add(Weight::from_parts(0, 3759))
.saturating_add(RocksDbWeight::get().reads(1)) .saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1)) .saturating_add(RocksDbWeight::get().writes(1))
} }

9
pallets/slow-clap/Cargo.toml Executable file → Normal file
View File

@ -1,6 +1,6 @@
[package] [package]
name = "ghost-slow-clap" name = "ghost-slow-clap"
version = "0.3.15" version = "0.3.27"
description = "Applause protocol for the EVM bridge" description = "Applause protocol for the EVM bridge"
license.workspace = true license.workspace = true
authors.workspace = true authors.workspace = true
@ -27,11 +27,13 @@ sp-staking = { workspace = true }
sp-io = { workspace = true } sp-io = { workspace = true }
sp-std = { workspace = true } sp-std = { workspace = true }
pallet-balances = { workspace = true }
ghost-networks = { workspace = true } ghost-networks = { workspace = true }
[dev-dependencies] [dev-dependencies]
pallet-session = { workspace = true, default-features = true } pallet-balances = { workspace = true }
pallet-session = { workspace = true }
pallet-staking = { workspace = true }
pallet-staking-reward-curve = { workspace = true }
[features] [features]
default = ["std"] default = ["std"]
@ -49,6 +51,7 @@ std = [
"sp-io/std", "sp-io/std",
"sp-std/std", "sp-std/std",
"pallet-session/std", "pallet-session/std",
"pallet-staking/std",
"pallet-balances/std", "pallet-balances/std",
"ghost-networks/std", "ghost-networks/std",
] ]

View File

@ -4,12 +4,7 @@ use super::*;
use frame_benchmarking::v1::*; use frame_benchmarking::v1::*;
use frame_system::RawOrigin; use frame_system::RawOrigin;
use frame_support::traits::fungible::{Inspect, Mutate}; use frame_support::traits::fungible::Inspect;
use crate::Pallet as SlowClap;
const MAX_CLAPS: u32 = 100;
const MAX_COMPANIONS: u32 = 20;
pub fn create_account<T: Config>() -> T::AccountId { pub fn create_account<T: Config>() -> T::AccountId {
let account_bytes = Vec::from([1u8; 32]); let account_bytes = Vec::from([1u8; 32]);
@ -17,184 +12,89 @@ pub fn create_account<T: Config>() -> T::AccountId {
.expect("32 bytes always construct an AccountId32") .expect("32 bytes always construct an AccountId32")
} }
pub fn create_companions<T: Config>(
total: usize,
network_id: NetworkIdOf<T>,
user_account: T::AccountId,
fee: H256,
receiver: H160,
) -> Result<CompanionId, &'static str> {
T::NetworkDataHandler::register(network_id.into(), NetworkData {
chain_name: "Ethereum".into(),
default_endpoint:
"https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14/".into(),
finality_delay: Some(0),
release_delay: Some(0),
network_type: Default::default(),
gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(),
topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(),
incoming_fee: 0,
outgoing_fee: 0,
}).map_err(|_| BenchmarkError::Weightless)?;
let mut last_companion_id = 0;
for _ in 0..total {
let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
let balance = minimum_balance + minimum_balance;
let companion = Companion::<NetworkIdOf::<T>, BalanceOf::<T>> {
network_id: network_id.into(), receiver,
fee, amount: balance,
};
let _ = <<T as pallet::Config>::Currency>::mint_into(&user_account, balance);
let companion_id = SlowClap::<T>::current_companion_id();
let _ = SlowClap::<T>::propose_companion(
RawOrigin::Signed(user_account.clone()).into(),
network_id,
companion,
)?;
last_companion_id = companion_id;
}
Ok(last_companion_id)
}
pub fn create_claps<T: Config>(i: u32, j: u32) -> Result<
(
Vec<crate::Clap<T::AccountId, NetworkIdOf<T>, BalanceOf<T>>>,
<T::AuthorityId as RuntimeAppPublic>::Signature,
),
&'static str,
> {
let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
let amount = minimum_balance + minimum_balance;
let total_amount = amount.saturating_mul(j.into());
let network_id = NetworkIdOf::<T>::default();
let mut claps = Vec::new();
let mut companions = BTreeMap::new();
let authorities = vec![T::AuthorityId::generate_pair(None)];
let bounded_authorities =
WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities.clone())
.map_err(|()| "more than the maximum number of keys provided")?;
Authorities::<T>::put(bounded_authorities);
for index in 0..j {
companions.insert(
index.into(),
amount,
);
}
for _ in 0..i {
claps.push(Clap {
session_index: 1,
authority_index: 0,
network_id,
transaction_hash: H256::repeat_byte(1u8),
block_number: 69,
removed: true,
receiver: create_account::<T>(),
amount: total_amount,
companions: companions.clone(),
});
}
let authority_id = authorities
.get(0usize)
.expect("first authority should exist");
let encoded_claps = claps.encode();
let signature = authority_id.sign(&encoded_claps)
.ok_or("couldn't make signature")?;
Ok((claps, signature))
}
benchmarks! { benchmarks! {
slow_clap { slow_clap {
let k in 1 .. MAX_CLAPS;
let j in 1 .. MAX_COMPANIONS;
let receiver = H160::repeat_byte(69u8);
let fee = H256::repeat_byte(0u8);
let user_account: T::AccountId = whitelisted_caller();
let network_id = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default();
let (claps, signature) = create_claps::<T>(k, j)?;
let _ = create_companions::<T>(j as usize, network_id, user_account, fee, receiver)?;
}: _(RawOrigin::None, claps, signature)
verify {
let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance(); let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
let total_amount = (minimum_balance + minimum_balance).saturating_mul(j.into()); let receiver = create_account::<T>();
} let amount = minimum_balance + minimum_balance;
let network_id = NetworkIdOf::<T>::default();
let session_index = T::ValidatorSet::session_index();
propose_companion { let authorities = vec![T::AuthorityId::generate_pair(None)];
let receiver = H160::repeat_byte(69u8); let bounded_authorities = WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities.clone())
let fee = H256::repeat_byte(0u8); .map_err(|()| "more than the maximum number of keys provided")?;
let user_account: T::AccountId = whitelisted_caller(); Authorities::<T>::set(&session_index, bounded_authorities);
let network_id = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default();
// T::NetworkDataHandler::register(network_id.into(), NetworkData { let clap = Clap {
// chain_name: "Ethereum".into(), session_index: 0,
// // https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/ authority_index: 0,
// default_endpoint: transaction_hash: H256::repeat_byte(1u8),
// "https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14/".into(), block_number: 69,
// finality_delay: Some(50), removed: false,
// release_delay: Some(100), network_id,
// network_type: Default::default(), receiver: receiver.clone(),
// gatekeeper: b"0x1234567891234567891234567891234567891234".to_vec(), amount,
// topic_name: b"0x12345678912345678912345678912345678912345678912345678912345678".to_vec(),
// incoming_fee: 0,
// outgoing_fee: 0,
// }).map_err(|_| BenchmarkError::Weightless)?;
let companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?;
let companion_id = SlowClap::<T>::current_companion_id();
let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
let balance = minimum_balance + minimum_balance;
let companion = Companion::<NetworkIdOf::<T>, BalanceOf::<T>> {
network_id: network_id.into(), receiver,
fee, amount: balance,
}; };
let _ = <<T as pallet::Config>::Currency>::mint_into(&user_account, balance);
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id); let authority_id = authorities
}: _(RawOrigin::Signed(user_account), network_id.into(), companion) .get(0usize)
.expect("first authority should exist");
let encoded_clap = clap.encode();
let signature = authority_id.sign(&encoded_clap)
.ok_or("couldn't make signature")?;
}: _(RawOrigin::None, clap, signature)
verify { verify {
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id + 1); assert_eq!(<<T as pallet::Config>::Currency>::total_balance(&receiver), amount);
} }
release_companion { self_applause {
let receiver = H160::repeat_byte(69u8); let session_index = T::ValidatorSet::session_index();
let fee = H256::repeat_byte(0u8); let authorities = vec![T::AuthorityId::generate_pair(None)];
let user_account: T::AccountId = whitelisted_caller(); let bounded_authorities = WeakBoundedVec::<_, T::MaxAuthorities>::try_from(authorities.clone())
let network_id = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default(); .map_err(|()| "more than the maximum number of keys provided")?;
let companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?; Authorities::<T>::set(&session_index, bounded_authorities);
assert_eq!(SlowClap::<T>::release_blocks(companion_id), BlockNumberFor::<T>::default());
}: _(RawOrigin::Signed(user_account), network_id.into(), companion_id)
verify {
assert_ne!(SlowClap::<T>::release_blocks(companion_id), BlockNumberFor::<T>::default());
}
kill_companion { let minimum_balance = <<T as pallet::Config>::Currency>::minimum_balance();
let receiver = H160::repeat_byte(69u8); let receiver = create_account::<T>();
let fee = H256::repeat_byte(0u8); let receiver_clone = receiver.clone();
let user_account: T::AccountId = whitelisted_caller(); let amount = minimum_balance + minimum_balance;
let network_id = <<T as pallet::Config>::NetworkDataHandler as NetworkDataBasicHandler>::NetworkId::default(); let network_id = NetworkIdOf::<T>::default();
let companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?; let transaction_hash = H256::repeat_byte(1u8);
SlowClap::<T>::release_companion(
RawOrigin::Signed(user_account.clone()).into(), let unique_transaction_hash = <Pallet<T>>::generate_unique_hash(
network_id, &receiver,
companion_id, &amount,
)?; &network_id,
let block_shift = );
<<T as pallet::Config>::NetworkDataHandler as NetworkDataInspectHandler<NetworkData>>::get(&network_id) let storage_key = (session_index, &transaction_hash, &unique_transaction_hash);
.unwrap()
.release_delay <Pallet::<T>>::trigger_nullification_for_benchmark();
.unwrap(); let clap = Clap {
frame_system::Pallet::<T>::set_block_number((block_shift + 1).saturated_into()); session_index,
}: _(RawOrigin::Signed(user_account), network_id.into(), companion_id) authority_index: 0,
transaction_hash,
block_number: 69,
removed: false,
network_id,
receiver: receiver.clone(),
amount,
};
let authority_id = authorities
.get(0usize)
.expect("first authority should exist");
let encoded_clap = clap.encode();
let signature = authority_id.sign(&encoded_clap).unwrap();
<Pallet<T>>::slow_clap(RawOrigin::None.into(), clap, signature)?;
<Pallet::<T>>::trigger_nullification_for_benchmark();
assert_eq!(<<T as pallet::Config>::Currency>::total_balance(&receiver), Default::default());
assert_eq!(ApplausesForTransaction::<T>::get(&storage_key), false);
}: _(RawOrigin::Signed(receiver_clone), network_id, session_index, transaction_hash, receiver_clone.clone(), amount)
verify { verify {
assert_eq!(SlowClap::<T>::companions(network_id, companion_id), None); assert_eq!(<<T as pallet::Config>::Currency>::total_balance(&receiver), amount);
assert_eq!(SlowClap::<T>::companion_details(companion_id), None); assert_eq!(ApplausesForTransaction::<T>::get(&storage_key), true);
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id + 1);
} }
impl_benchmark_test_suite!( impl_benchmark_test_suite!(

1150
pallets/slow-clap/src/lib.rs Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,22 +2,22 @@
use frame_support::{ use frame_support::{
derive_impl, parameter_types, derive_impl, parameter_types,
traits::{ConstU32, ConstU64}, traits::{ConstU32, ConstU64}, weights::Weight,
weights::Weight,
PalletId,
}; };
use frame_system::EnsureRoot; use frame_system::EnsureRoot;
use pallet_session::historical as pallet_session_historical; use pallet_session::historical as pallet_session_historical;
use sp_runtime::{ use sp_runtime::{
testing::{TestXt, UintAuthorityId}, testing::{TestXt, UintAuthorityId},
traits::ConvertInto, traits::ConvertInto, curve::PiecewiseLinear,
BuildStorage, Permill, Permill,
}; };
use sp_staking::{ use sp_staking::{
offence::{OffenceError, ReportOffence}, offence::{OffenceError, ReportOffence},
SessionIndex, SessionIndex,
}; };
use sp_runtime::BuildStorage;
use crate as slow_clap; use crate as slow_clap;
use crate::Config; use crate::Config;
@ -84,24 +84,22 @@ impl ReportOffence<u64, IdentificationTuple, Offence> for OffenceHandler {
} }
} }
pub fn alice_account_id() -> <Runtime as frame_system::Config>::AccountId { 69 }
pub fn eve_account_id() -> <Runtime as frame_system::Config>::AccountId { 1337 }
pub fn new_test_ext() -> sp_io::TestExternalities { pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::<Runtime>::default() let t = frame_system::GenesisConfig::<Runtime>::default()
.build_storage() .build_storage()
.unwrap(); .unwrap();
pallet_balances::GenesisConfig::<Runtime> {
balances: vec![ (alice_account_id(), 100) ],
}
.assimilate_storage(&mut t)
.unwrap();
let mut result = sp_io::TestExternalities::new(t); let mut result = sp_io::TestExternalities::new(t);
result.execute_with(|| { result.execute_with(|| {
System::set_block_number(1); for i in 1..=3 {
System::inc_providers(&i);
assert_eq!(Session::set_keys(
RuntimeOrigin::signed(i),
i.into(),
vec![],
), Ok(()));
}
}); });
result result
@ -167,6 +165,7 @@ impl frame_support::traits::EstimateNextSessionRotation<u64> for TestNextSession
impl ghost_networks::Config for Runtime { impl ghost_networks::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type NetworkId = u32; type NetworkId = u32;
type RegisterOrigin = EnsureRoot<Self::AccountId>; type RegisterOrigin = EnsureRoot<Self::AccountId>;
type UpdateOrigin = EnsureRoot<Self::AccountId>; type UpdateOrigin = EnsureRoot<Self::AccountId>;
@ -174,9 +173,21 @@ impl ghost_networks::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
} }
pallet_staking_reward_curve::build! {
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
min_inflation: 0_006_000,
max_inflation: 1_000_000,
ideal_stake: 0_690_000,
falloff: 0_050_000,
max_piece_count: 100,
test_precision: 0_005_000,
);
}
parameter_types! { parameter_types! {
pub static ExistentialDeposit: u64 = 2; pub static ExistentialDeposit: u64 = 2;
pub const TreasuryPalletId: PalletId = PalletId(*b"mck/test"); pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const HistoryDepth: u32 = 10;
} }
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)] #[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
@ -199,23 +210,16 @@ impl Config for Runtime {
type ReportUnresponsiveness = OffenceHandler; type ReportUnresponsiveness = OffenceHandler;
type MaxAuthorities = ConstU32<5>; type MaxAuthorities = ConstU32<5>;
type MaxNumberOfClaps = ConstU32<100>; type ApplauseThreshold = ConstU32<50>;
type ApplauseThreshold = ConstU32<0>; type OffenceThreshold = ConstU32<75>;
type MaxAuthorityInfoInSession = ConstU32<5_000>;
type OffenceThreshold = ConstU32<40>;
type UnsignedPriority = ConstU64<{ 1 << 20 }>; type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type TreasuryPalletId = TreasuryPalletId; type HistoryDepth = HistoryDepth;
type WeightInfo = (); type WeightInfo = ();
} }
pub type Extrinsic = TestXt<RuntimeCall, ()>; pub type Extrinsic = TestXt<RuntimeCall, ()>;
// impl frame_system::offchain::SigningTypes for Runtime {
// type Public = <Signature as Verify>::Signer;
// type Signature = Signature;
// }
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Runtime impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Runtime
where where
RuntimeCall: From<LocalCall>, RuntimeCall: From<LocalCall>,
@ -224,30 +228,37 @@ where
type Extrinsic = Extrinsic; type Extrinsic = Extrinsic;
} }
// impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime pub fn advance_session() {
// where let now = System::block_number().max(1);
// RuntimeCall: From<LocalCall>, System::set_block_number(now + 1);
// { Session::rotate_session();
// fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>( let session_index = Session::current_index();
// call: Self::OverarchingCall,
// _public: Self::Public,
// _account: Self::AccountId,
// nonce: Self::Nonce,
// ) -> Option<(RuntimeCall, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
// Some((call, (nonce.into(), ())))
// }
// }
// pub fn advance_session() { let authorities = Session::validators()
// let now = System::block_number().max(1); .into_iter()
// System::set_block_number(now + 1); .map(UintAuthorityId)
// Session::rotate_session(); .collect();
//
// let authorities = Session::validators() SlowClap::set_test_authorities(session_index, authorities);
// .into_iter() assert_eq!(session_index, (now / Period::get()) as u32);
// .map(UintAuthorityId) }
// .collect();
// pub fn advance_session_with_authority(authority: u64) {
// SlowClap::set_authorities(authorities); let now = System::block_number().max(1);
// assert_eq!(Session::current_index(), (now / Period::get()) as u32); System::set_block_number(now + 1);
// } Session::rotate_session();
let session_index = Session::current_index();
SlowClap::set_test_authorities(
session_index,
vec![
UintAuthorityId::from(authority),
UintAuthorityId::from(69),
UintAuthorityId::from(420),
UintAuthorityId::from(1337),
]
);
assert_eq!(session_index, (now / Period::get()) as u32);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,176 @@
use frame_support::weights::Weight; // 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 `ghost_slow_clap`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-06-17, 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=ghost_slow_clap
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_slow_clap.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{
traits::Get,
weights::{Weight, constants::RocksDbWeight}
};
use core::marker::PhantomData;
pub trait WeightInfo { pub trait WeightInfo {
fn slow_clap(claps_len: u32, companions_len: u32) -> Weight; fn slow_clap() -> Weight;
fn propose_companion() -> Weight; fn self_applause()-> Weight;
fn release_companion() -> Weight; }
fn kill_companion() -> Weight;
/// Weight functions for `ghost_slow_clap`.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
/// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// 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)
/// Proof: `GhostNetworks::BridgedImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::AccumulatedCommission` (r:1 w:1)
/// Proof: `GhostNetworks::AccumulatedCommission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn slow_clap() -> Weight {
// Proof Size summary in bytes:
// Measured: `355`
// Estimated: `3820`
// Minimum execution time: 211_154_000 picoseconds.
Weight::from_parts(215_420_000, 0)
.saturating_add(Weight::from_parts(0, 3820))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0)
/// Proof: `GhostSlowClaps::ReceivedClaps` (`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::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)
/// Proof: `GhostNetworks::BridgedImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::AccumulatedCommission` (r:1 w:1)
/// Proof: `GhostNetworks::AccumulatedCommission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn self_applause() -> Weight {
// Proof Size summary in bytes:
// Measured: `655`
// Estimated: `4120`
// Minimum execution time: 208_453_000 picoseconds.
Weight::from_parts(212_038_000, 0)
.saturating_add(Weight::from_parts(0, 4120))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(5))
}
} }
impl WeightInfo for () { impl WeightInfo for () {
fn slow_clap( /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
_claps_len: u32, /// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
_companions_len: u32, /// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:1)
) -> Weight { Weight::zero() } /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn propose_companion() -> Weight { Weight::zero() } /// Storage: `GhostSlowClaps::ClapsInSession` (r:1 w:1)
fn release_companion() -> Weight { Weight::zero() } /// Proof: `GhostSlowClaps::ClapsInSession` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn kill_companion() -> Weight { Weight::zero() } /// 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)
/// Proof: `GhostNetworks::BridgedImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::AccumulatedCommission` (r:1 w:1)
/// Proof: `GhostNetworks::AccumulatedCommission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn slow_clap() -> Weight {
// Proof Size summary in bytes:
// Measured: `355`
// Estimated: `3820`
// Minimum execution time: 211_154_000 picoseconds.
Weight::from_parts(215_420_000, 0)
.saturating_add(Weight::from_parts(0, 3820))
.saturating_add(RocksDbWeight::get().reads(10))
.saturating_add(RocksDbWeight::get().writes(7))
}
/// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0)
/// Proof: `GhostSlowClaps::ReceivedClaps` (`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::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)
/// Proof: `GhostNetworks::BridgedImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::AccumulatedCommission` (r:1 w:1)
/// Proof: `GhostNetworks::AccumulatedCommission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn self_applause() -> Weight {
// Proof Size summary in bytes:
// Measured: `655`
// Estimated: `4120`
// Minimum execution time: 208_453_000 picoseconds.
Weight::from_parts(212_038_000, 0)
.saturating_add(Weight::from_parts(0, 4120))
.saturating_add(RocksDbWeight::get().reads(9))
.saturating_add(RocksDbWeight::get().writes(5))
}
} }

View File

@ -14,6 +14,6 @@ sp-runtime = { workspace = true }
[features] [features]
default = ["std"] default = ["std"]
std = [ std = [
"frame-support/std", "frame-support/std",
"sp-runtime/std", "sp-runtime/std",
] ]

View File

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

View File

@ -65,7 +65,7 @@ parameter_types! {
pub type CultReferendaInstance = pallet_referenda::Instance1; pub type CultReferendaInstance = pallet_referenda::Instance1;
impl pallet_referenda::Config<CultReferendaInstance> for Runtime { impl pallet_referenda::Config<CultReferendaInstance> for Runtime {
type WeightInfo = (); type WeightInfo = weights::pallet_referenda::WeightInfo<Runtime>;
type RuntimeCall = RuntimeCall; type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler; type Scheduler = Scheduler;

View File

@ -492,6 +492,8 @@ parameter_types! {
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxNominations: u32 = pub const MaxNominations: u32 =
<NposCompactSolution16 as frame_election_provider_support::NposSolution>::LIMIT as u32; <NposCompactSolution16 as frame_election_provider_support::NposSolution>::LIMIT as u32;
pub const StakingHistoryDepth: u32 = 84;
pub const MaxUnlockingChunks: u32 = 32;
} }
impl pallet_staking::Config for Runtime { impl pallet_staking::Config for Runtime {
@ -520,8 +522,8 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList; type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>; type TargetList = UseValidatorsMap<Self>;
type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>; type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>; type MaxUnlockingChunks = MaxUnlockingChunks;
type HistoryDepth = frame_support::traits::ConstU32<84>; type HistoryDepth = StakingHistoryDepth;
type MaxControllersInDeprecationBatch = ConstU32<5314>; type MaxControllersInDeprecationBatch = ConstU32<5314>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig; type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type EventListeners = NominationPools; type EventListeners = NominationPools;
@ -1035,6 +1037,7 @@ impl pallet_alliance::Config for Runtime {
impl ghost_networks::Config for Runtime { impl ghost_networks::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type NetworkId = u64; type NetworkId = u64;
type Currency = Balances;
type RegisterOrigin = EitherOf< type RegisterOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
@ -1073,14 +1076,13 @@ impl ghost_claims::Config<CultCollectiveInstance> for Runtime {
} }
parameter_types! { parameter_types! {
// maximum number of claps in one tx
pub MaxNumberOfClaps: u32 = 5;
// will be used in `Perbill::from_percent()` // will be used in `Perbill::from_percent()`
pub ApplauseThreshold: u32 = 70; pub const ApplauseThreshold: u32 = 70;
// will be used in `Perbill::from_percent()` // will be used in `Perbill::from_percent()`
pub OffenceThreshold: u32 = 40; pub const OffenceThreshold: u32 = 40;
pub const SlowClapUnsignedPriority: TransactionPriority = pub const SlowClapUnsignedPriority: TransactionPriority = TransactionPriority::MAX;
TransactionPriority::max_value(); pub const SlowClapHistoryDepth: sp_staking::SessionIndex =
StakingHistoryDepth::get() * SessionsPerEra::get();
} }
impl ghost_slow_clap::Config for Runtime { impl ghost_slow_clap::Config for Runtime {
@ -1095,13 +1097,10 @@ impl ghost_slow_clap::Config for Runtime {
type ReportUnresponsiveness = Offences; type ReportUnresponsiveness = Offences;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = MaxAuthorities;
type MaxNumberOfClaps = MaxNumberOfClaps;
type ApplauseThreshold = ApplauseThreshold; type ApplauseThreshold = ApplauseThreshold;
type MaxAuthorityInfoInSession = MaxAuthorities;
type OffenceThreshold = OffenceThreshold; type OffenceThreshold = OffenceThreshold;
type UnsignedPriority = SlowClapUnsignedPriority; type UnsignedPriority = SlowClapUnsignedPriority;
type TreasuryPalletId = TreasuryPalletId; type HistoryDepth = SlowClapHistoryDepth;
type WeightInfo = weights::ghost_slow_clap::WeightInfo<Runtime>; type WeightInfo = weights::ghost_slow_clap::WeightInfo<Runtime>;
} }

View File

@ -7,7 +7,7 @@
// Ghost Network is distributed in the hope that it will be useful, // Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_networks` //! Autogenerated weights for `ghost_networks`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-06-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -54,13 +54,13 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `109` // Measured: `109`
// Estimated: `3574` // Estimated: `3574`
// Minimum execution time: 44_464_000 picoseconds. // Minimum execution time: 43_624_000 picoseconds.
Weight::from_parts(44_802_179, 0) Weight::from_parts(44_945_690, 0)
.saturating_add(Weight::from_parts(0, 3574)) .saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 11_381 // Standard Error: 3_439
.saturating_add(Weight::from_parts(42_872, 0).saturating_mul(i.into())) .saturating_add(Weight::from_parts(15_557, 0).saturating_mul(i.into()))
// Standard Error: 1_492 // Standard Error: 450
.saturating_add(Weight::from_parts(8_794, 0).saturating_mul(j.into())) .saturating_add(Weight::from_parts(3_508, 0).saturating_mul(j.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -69,11 +69,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// The range of component `n` is `[1, 20]`. /// 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: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_224_000 picoseconds. // Minimum execution time: 48_741_000 picoseconds.
Weight::from_parts(54_405_362, 0) Weight::from_parts(50_426_703, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -82,13 +82,13 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// The range of component `n` is `[1, 150]`. /// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(n: u32, ) -> Weight { fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_598_000 picoseconds. // Minimum execution time: 49_090_000 picoseconds.
Weight::from_parts(54_951_352, 0) Weight::from_parts(50_734_447, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
// Standard Error: 10_596 // Standard Error: 863
.saturating_add(Weight::from_parts(11_691, 0).saturating_mul(n.into())) .saturating_add(Weight::from_parts(786, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -96,23 +96,23 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight { fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 49_089_000 picoseconds. // Minimum execution time: 48_107_000 picoseconds.
Weight::from_parts(50_797_000, 0) Weight::from_parts(48_993_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
/// Storage: `GhostNetworks::Networks` (r:1 w:1) /// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_release_delay() -> Weight { fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 49_606_000 picoseconds. // Minimum execution time: 48_277_000 picoseconds.
Weight::from_parts(50_371_000, 0) Weight::from_parts(49_393_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -120,11 +120,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_type() -> Weight { fn update_network_type() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 48_135_000 picoseconds. // Minimum execution time: 47_642_000 picoseconds.
Weight::from_parts(48_619_000, 0) Weight::from_parts(49_212_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -132,11 +132,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_gatekeeper() -> Weight { fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_027_000 picoseconds. // Minimum execution time: 49_440_000 picoseconds.
Weight::from_parts(51_212_000, 0) Weight::from_parts(50_315_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -144,11 +144,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_topic_name() -> Weight { fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 50_686_000 picoseconds. // Minimum execution time: 49_469_000 picoseconds.
Weight::from_parts(52_276_000, 0) Weight::from_parts(50_532_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -156,11 +156,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_incoming_network_fee() -> Weight { fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 48_485_000 picoseconds. // Minimum execution time: 47_858_000 picoseconds.
Weight::from_parts(49_672_000, 0) Weight::from_parts(48_703_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -168,11 +168,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight { fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 48_926_000 picoseconds. // Minimum execution time: 47_895_000 picoseconds.
Weight::from_parts(49_482_000, 0) Weight::from_parts(49_230_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .saturating_add(T::DbWeight::get().writes(1))
} }
@ -180,11 +180,11 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight { fn remove_network() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `295` // Measured: `294`
// Estimated: `3760` // Estimated: `3759`
// Minimum execution time: 45_163_000 picoseconds. // Minimum execution time: 44_052_000 picoseconds.
Weight::from_parts(45_822_000, 0) Weight::from_parts(44_612_000, 0)
.saturating_add(Weight::from_parts(0, 3760)) .saturating_add(Weight::from_parts(0, 3759))
.saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1)) .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, // Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // 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. // GNU General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_slow_clap` //! Autogenerated weights for `ghost_slow_clap`
//! //!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-08-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! DATE: 2025-06-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000` //! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz` //! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024 //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -47,79 +47,61 @@ use core::marker::PhantomData;
pub struct WeightInfo<T>(PhantomData<T>); pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> { impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> {
/// Storage: `GhostSlowClaps::Authorities` (r:1 w:0) /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
/// Proof: `GhostSlowClaps::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::AuthorityInfoInSession` (r:1 w:0) /// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:1)
/// Proof: `GhostSlowClaps::AuthorityInfoInSession` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:0) /// 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`) /// 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)
/// Proof: `GhostNetworks::BridgedImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::AccumulatedCommission` (r:1 w:1)
/// Proof: `GhostNetworks::AccumulatedCommission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn slow_clap() -> Weight {
// Proof Size summary in bytes:
// Measured: `355`
// Estimated: `3820`
// Minimum execution time: 211_154_000 picoseconds.
Weight::from_parts(215_420_000, 0)
.saturating_add(Weight::from_parts(0, 3820))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0) /// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0)
/// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `k` is `[1, 100]`. /// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
/// The range of component `j` is `[1, 20]`. /// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn slow_clap(k: u32, j: u32, ) -> Weight { /// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:1)
// Proof Size summary in bytes: /// Proof: `GhostSlowClaps::ApplausesForTransaction` (`max_values`: None, `max_size`: None, mode: `Measured`)
// Measured: `372 + j * (19 ±0)` /// Storage: `GhostNetworks::NullifyNeeded` (r:1 w:0)
// Estimated: `3853 + j * (19 ±0)` /// Proof: `GhostNetworks::NullifyNeeded` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
// Minimum execution time: 95_459_000 picoseconds.
Weight::from_parts(96_224_000, 0)
.saturating_add(Weight::from_parts(0, 3853))
// Standard Error: 152_014
.saturating_add(Weight::from_parts(32_092_278, 0).saturating_mul(k.into()))
// Standard Error: 761_228
.saturating_add(Weight::from_parts(22_412_712, 0).saturating_mul(j.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(Weight::from_parts(0, 19).saturating_mul(j.into()))
}
/// Storage: `GhostSlowClaps::CurrentCompanionId` (r:1 w:1)
/// Proof: `GhostSlowClaps::CurrentCompanionId` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0) /// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Companions` (r:0 w:1) /// Storage: `GhostNetworks::GatekeeperAmount` (r:1 w:1)
/// Proof: `GhostSlowClaps::Companions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::GatekeeperAmount` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::CompanionDetails` (r:0 w:1) /// Storage: `GhostNetworks::BridgedImbalance` (r:1 w:1)
/// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Proof: `GhostNetworks::BridgedImbalance` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn propose_companion() -> Weight { /// Storage: `GhostNetworks::AccumulatedCommission` (r:1 w:1)
/// Proof: `GhostNetworks::AccumulatedCommission` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `System::Account` (r:1 w:1)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn self_applause() -> Weight {
// Proof Size summary in bytes: // Proof Size summary in bytes:
// Measured: `634` // Measured: `655`
// Estimated: `4099` // Estimated: `4120`
// Minimum execution time: 167_770_000 picoseconds. // Minimum execution time: 208_453_000 picoseconds.
Weight::from_parts(168_826_000, 0) Weight::from_parts(212_038_000, 0)
.saturating_add(Weight::from_parts(0, 4099)) .saturating_add(Weight::from_parts(0, 4120))
.saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(3)) .saturating_add(T::DbWeight::get().writes(5))
}
/// Storage: `GhostSlowClaps::Companions` (r:1 w:0)
/// Proof: `GhostSlowClaps::Companions` (`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::CompanionDetails` (r:1 w:0)
/// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ReleaseBlocks` (r:0 w:1)
/// Proof: `GhostSlowClaps::ReleaseBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn release_companion() -> Weight {
// Proof Size summary in bytes:
// Measured: `839`
// Estimated: `4304`
// Minimum execution time: 82_884_000 picoseconds.
Weight::from_parts(84_135_000, 0)
.saturating_add(Weight::from_parts(0, 4304))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostSlowClaps::ReleaseBlocks` (r:1 w:0)
/// Proof: `GhostSlowClaps::ReleaseBlocks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Companions` (r:1 w:1)
/// Proof: `GhostSlowClaps::Companions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::CompanionDetails` (r:1 w:1)
/// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn kill_companion() -> Weight {
// Proof Size summary in bytes:
// Measured: `514`
// Estimated: `3979`
// Minimum execution time: 152_418_000 picoseconds.
Weight::from_parts(153_436_000, 0)
.saturating_add(Weight::from_parts(0, 3979))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
} }
} }

View File

@ -17,7 +17,7 @@ pub mod pallet_nomination_pools;
pub mod pallet_preimage; pub mod pallet_preimage;
pub mod pallet_proxy; pub mod pallet_proxy;
pub mod pallet_ranked_collective; pub mod pallet_ranked_collective;
// pub mod pallet_referenda; pub mod pallet_referenda;
pub mod pallet_salary; pub mod pallet_salary;
pub mod pallet_scheduler; pub mod pallet_scheduler;
pub mod pallet_session; pub mod pallet_session;

View File

@ -31,21 +31,21 @@ primitives = { workspace = true }
default = ["std"] default = ["std"]
no_std = [] no_std = []
std = [ std = [
"sp-core/std", "sp-core/std",
"sp-std/std", "sp-std/std",
"sp-io/std", "sp-io/std",
"sp-runtime/std", "sp-runtime/std",
"sp-staking/std", "sp-staking/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"pallet-authorship/std", "pallet-authorship/std",
"pallet-balances/std", "pallet-balances/std",
"pallet-staking/std", "pallet-staking/std",
"pallet-staking-reward-fn/std", "pallet-staking-reward-fn/std",
"pallet-timestamp/std", "pallet-timestamp/std",
"pallet-transaction-payment/std", "pallet-transaction-payment/std",
"pallet-treasury/std", "pallet-treasury/std",
"pallet-election-provider-multi-phase/std", "pallet-election-provider-multi-phase/std",
"primitives/std", "primitives/std",
] ]
runtime-benchmarks = [ runtime-benchmarks = [
@ -53,21 +53,21 @@ runtime-benchmarks = [
"sp-staking/runtime-benchmarks", "sp-staking/runtime-benchmarks",
"frame-support/runtime-benchmarks", "frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks", "frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks", "pallet-balances/runtime-benchmarks",
"pallet-staking/runtime-benchmarks", "pallet-staking/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks", "pallet-treasury/runtime-benchmarks",
"pallet-election-provider-multi-phase/runtime-benchmarks", "pallet-election-provider-multi-phase/runtime-benchmarks",
] ]
try-runtime = [ try-runtime = [
"sp-runtime/try-runtime", "sp-runtime/try-runtime",
"frame-support/try-runtime", "frame-support/try-runtime",
"frame-system/try-runtime", "frame-system/try-runtime",
"pallet-authorship/try-runtime", "pallet-authorship/try-runtime",
"pallet-balances/try-runtime", "pallet-balances/try-runtime",
"pallet-staking/try-runtime", "pallet-staking/try-runtime",
"pallet-timestamp/try-runtime", "pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime", "pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime", "pallet-treasury/try-runtime",
"pallet-election-provider-multi-phase/try-runtime", "pallet-election-provider-multi-phase/try-runtime",
] ]

View File

@ -107,16 +107,16 @@ default = ["db", "full-node"]
db = ["sc-service/rocksdb"] db = ["sc-service/rocksdb"]
full-node = ["kvdb-rocksdb", "parity-db"] full-node = ["kvdb-rocksdb", "parity-db"]
runtime-benchmarks = [ runtime-benchmarks = [
"frame-benchmarking-cli/runtime-benchmarks", "frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks", "frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks", "frame-system/runtime-benchmarks",
"pallet-babe/runtime-benchmarks", "pallet-babe/runtime-benchmarks",
"pallet-staking/runtime-benchmarks", "pallet-staking/runtime-benchmarks",
"casper-runtime?/runtime-benchmarks", "casper-runtime?/runtime-benchmarks",
"sc-client-db/runtime-benchmarks", "sc-client-db/runtime-benchmarks",
"sc-service/runtime-benchmarks", "sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks", "sp-runtime/runtime-benchmarks",
] ]
try-runtime = [ try-runtime = [
"frame-support/try-runtime", "frame-support/try-runtime",

View File

@ -178,7 +178,7 @@ fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
chain_name: "ethereum-mainnet".into(), chain_name: "ethereum-mainnet".into(),
default_endpoint: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(), default_endpoint: "https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/".into(),
finality_delay: Some(40u64), finality_delay: Some(40u64),
release_delay: Some(80u64), block_distance: 50u64,
network_type: ghost_networks::NetworkType::Evm, network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(), gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(),
@ -189,7 +189,7 @@ fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
chain_name: "bnb-mainnet".into(), chain_name: "bnb-mainnet".into(),
default_endpoint: "https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab/".into(), default_endpoint: "https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab/".into(),
finality_delay: Some(20u64), finality_delay: Some(20u64),
release_delay: Some(40u64), block_distance: 50u64,
network_type: ghost_networks::NetworkType::Evm, network_type: ghost_networks::NetworkType::Evm,
gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(), gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(), topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(),