Compare commits

..

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

177 changed files with 7558 additions and 14896 deletions

63
Cargo.lock generated
View File

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
version = 3
[[package]]
name = "Inflector"
@ -1186,7 +1186,7 @@ dependencies = [
[[package]]
name = "casper-runtime"
version = "3.5.41"
version = "3.5.20"
dependencies = [
"casper-runtime-constants",
"frame-benchmarking",
@ -1203,8 +1203,6 @@ dependencies = [
"ghost-networks",
"ghost-runtime-common",
"ghost-slow-clap",
"ghost-sudo",
"ghost-traits",
"log",
"pallet-alliance",
"pallet-authority-discovery",
@ -3506,7 +3504,7 @@ dependencies = [
[[package]]
name = "ghost-claims"
version = "0.2.4"
version = "0.2.2"
dependencies = [
"frame-benchmarking",
"frame-support",
@ -3530,7 +3528,7 @@ dependencies = [
[[package]]
name = "ghost-cli"
version = "0.8.5"
version = "0.7.197"
dependencies = [
"cfg-if",
"clap 4.5.4",
@ -3562,7 +3560,7 @@ dependencies = [
[[package]]
name = "ghost-client-cli"
version = "0.1.4"
version = "0.1.3"
dependencies = [
"array-bytes",
"clap 4.5.4",
@ -3586,7 +3584,7 @@ dependencies = [
[[package]]
name = "ghost-machine-primitives"
version = "0.8.5"
version = "0.7.197"
dependencies = [
"lazy_static",
"sc-sysinfo",
@ -3595,7 +3593,7 @@ dependencies = [
[[package]]
name = "ghost-metrics"
version = "0.8.5"
version = "0.7.197"
dependencies = [
"assert_cmd",
"bs58 0.5.1",
@ -3618,7 +3616,7 @@ dependencies = [
[[package]]
name = "ghost-miner"
version = "1.5.1"
version = "1.5.0"
dependencies = [
"anyhow",
"assert_cmd",
@ -3650,18 +3648,14 @@ dependencies = [
[[package]]
name = "ghost-networks"
version = "0.1.26"
version = "0.7.197"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"ghost-core-primitives",
"ghost-traits",
"log",
"num-traits",
"pallet-balances",
"pallet-staking",
"pallet-staking-reward-curve",
"parity-scale-codec",
"scale-info",
"sp-io 30.0.0",
@ -3671,7 +3665,7 @@ dependencies = [
[[package]]
name = "ghost-node"
version = "0.8.5"
version = "0.7.197"
dependencies = [
"assert_cmd",
"color-eyre",
@ -3687,7 +3681,7 @@ dependencies = [
[[package]]
name = "ghost-remote-ext-tests-bags-list"
version = "1.0.1"
version = "1.0.0"
dependencies = [
"casper-runtime",
"casper-runtime-constants",
@ -3702,7 +3696,7 @@ dependencies = [
[[package]]
name = "ghost-rpc"
version = "0.8.5"
version = "0.7.197"
dependencies = [
"ghost-core-primitives",
"jsonrpsee",
@ -3731,7 +3725,7 @@ dependencies = [
[[package]]
name = "ghost-runtime-common"
version = "0.4.3"
version = "0.4.2"
dependencies = [
"frame-support",
"frame-system",
@ -3754,7 +3748,7 @@ dependencies = [
[[package]]
name = "ghost-service"
version = "0.8.5"
version = "0.7.197"
dependencies = [
"assert_matches",
"async-trait",
@ -3838,18 +3832,15 @@ dependencies = [
[[package]]
name = "ghost-slow-clap"
version = "0.4.28"
version = "0.3.15"
dependencies = [
"frame-benchmarking",
"frame-support",
"frame-system",
"ghost-networks",
"ghost-traits",
"log",
"pallet-balances",
"pallet-session",
"pallet-staking",
"pallet-staking-reward-curve",
"parity-scale-codec",
"scale-info",
"serde",
@ -3864,7 +3855,7 @@ dependencies = [
[[package]]
name = "ghost-staging-chain-spec-builder"
version = "1.6.2"
version = "1.6.1"
dependencies = [
"clap 4.5.4",
"log",
@ -3873,33 +3864,17 @@ dependencies = [
"sp-tracing 16.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)",
]
[[package]]
name = "ghost-sudo"
version = "0.0.2"
dependencies = [
"docify",
"frame-benchmarking",
"frame-support",
"frame-system",
"parity-scale-codec",
"scale-info",
"sp-io 30.0.0",
"sp-runtime 31.0.1",
"sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)",
]
[[package]]
name = "ghost-traits"
version = "0.3.32"
version = "0.3.19"
dependencies = [
"frame-support",
"sp-runtime 31.0.1",
"sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk.git?tag=polkadot-v1.12.0)",
]
[[package]]
name = "ghost-voter-bags"
version = "0.3.7"
version = "0.3.6"
dependencies = [
"casper-runtime",
"clap 4.5.4",
@ -3909,7 +3884,7 @@ dependencies = [
[[package]]
name = "ghostkey"
version = "0.3.16"
version = "0.3.15"
dependencies = [
"clap 4.5.4",
"ghost-client-cli",

View File

@ -17,7 +17,7 @@ homepage.workspace = true
[workspace.package]
license = "GPL-3.0-only"
authors = ["571nky", "57r37ch", "f4750"]
version = "0.8.5"
version = "0.7.197"
edition = "2021"
homepage = "https://ghostchain.io"
repository = "https://git.ghostchain.io/ghostchain/ghost-node"
@ -69,7 +69,6 @@ bs58 = { version = "0.5.0" }
prometheus-parse = { version = "0.2.2" }
rustc-hex = { version = "2.1.0", default-features = false }
log = { version = "0.4", default-features = false }
num-traits = { version = "0.2.17", default-features = false }
libsecp256k1 = { version = "0.7", default-features = false }
bip39 = { package = "parity-bip39", version = "2.0.1" }
sha3 = { version = "0.10", default-features = false }
@ -230,7 +229,6 @@ ghost-traits = { path = "pallets/traits", default-features = false }
ghost-networks = { path = "pallets/networks", default-features = false }
ghost-claims = { path = "pallets/claims", default-features = false }
ghost-slow-clap = { path = "pallets/slow-clap", default-features = false }
ghost-sudo = { path = "pallets/sudo", default-features = false }
ghost-runtime-constants = { package = "ghost-runtime-constants", path = "runtime/ghost/constants", default-features = false }
casper-runtime = { path = "runtime/casper", default-features = false }
casper-runtime-constants = { package = "casper-runtime-constants", path = "runtime/casper/constants", default-features = false }
@ -273,7 +271,6 @@ members = [
"pallets/networks",
"pallets/claims",
"pallets/slow-clap",
"pallets/sudo",
"utils/bags-list",
"utils/chain-spec-builder",
"utils/generate-bags",

0
LICENSE.md Normal file → Executable file
View File

126
README.md Normal file → Executable file
View File

@ -150,8 +150,28 @@ rustup default stable
rustup update
```
Add the nightly release and the nightly WebAssembly (wasm) targets
to your development environment by running the following commands:
```bash
rustup target add wasm32-unknown-unknown --toolchain stable
rustup update nightly
```
```bash
rustup target add wasm32-unknown-unknown --toolchain nightly
```
```bash
rustup target add wasm32-unknown-unknown --toolchain stable-x86_64-unknown-linux-gnu
```
If you are trying to install WebAssembly (wasm) on an ARM-based processor like the ones in Raspberry Pi try this instead:
```bash
rustup target add wasm32-unknown-unknown --toolchain stable-aarch64-unknown-linux-gnu
```
**_IF error try_**
```bash
rustup target add wasm32-unknown-unknown --toolchain default
```
Verify the configuration of your development environment by running
@ -160,6 +180,10 @@ the following command:
rustup show
```
```bash
rustup +nightly show
```
You should see something like this:
![images/img_9.png](images/img_9.png)
@ -170,6 +194,13 @@ Now run:
rustup component add rust-src --toolchain stable
```
**_IF error try_**
```bash
rustup component add rust-src --toolchain default
```
## Install GHOST
Check if Git is already installed:
@ -180,7 +211,7 @@ git --version
Make a GHOST Directory and go to it:
```bash
mkdir ~/ghost && cd ~/ghost
mkdir ghost && cd ghost
```
Clone GHOST Node Git:
@ -195,7 +226,7 @@ cd ghost-node
Compile the node template by running the following command:
```bash
./scripts/starter.sh --release
cargo build --release
```
The build can take up to 20 minutes depending on the specifications of your machine.
@ -203,6 +234,7 @@ The build can take up to 20 minutes depending on the specifications of your mach
![images/img_12.png](images/img_12.png)
# Boot Node Qualification
## Boot Node Qualification Test
@ -288,7 +320,7 @@ Only `port 30333` should be opened.
Press _CTRL+C_ to stop the node.
# Launching GHOST TestNet
# Launching GHOST TestNet 3.1
Switch to main GIT branch:
```bash
@ -316,7 +348,66 @@ To generate the node key use the following command:
./target/release/ghost key generate-node-key --bin --file=/etc/ghost/node-key
```
Feel free to backup the file on a separate storage device.
Generate Wallet Key file with the following command:
```bash
./target/release/ghost key generate | grep "Secret seed" | awk '{$1=$2=""; sub(/^[ \t]+/, ""); print}' > /etc/ghost/wallet-key
```
Display the wallet-key on the screen by using cat command:
```bash
./target/release/ghost key inspect $(cat /etc/ghost/wallet-key)
```
![images/img_22.png](images/img_22.png)
Feel free to back the file on a separate storage device.
Generate Stash Key file with the following command:
```bash
./target/release/ghost key generate | grep "Secret seed" | awk '{$1=$2=""; sub(/^[ \t]+/, ""); print}' > /etc/ghost/stash-key
```
Display the stash-key on the screen by using cat command:
```bash
./target/release/ghost key inspect $(cat /etc/ghost/stash-key)
```
![images/img_23.png](images/img_23.png)
Generate Session Key file with the following command:
```bash
./target/release/ghost key generate | grep "Secret seed" | awk '{$1=$2=""; sub(/^[ \t]+/, ""); print}' > /etc/ghost/session-key
```
You have generates 4 types of Session Keys:
1. Session Key AUDI
2. Session Key BABE
3. Session Key SLOW
4. Session Key GRAN
Now let's display them!
Display the session-key//audi on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//audi"
```
![images/img_24.png](images/img_24.png)
Display the session-key//babe on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//babe"
```
![images/img_25.png](images/img_25.png)
Display the session-key//slow on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//slow"
```
![images/img_26.png](images/img_26.png)
Display the session-key//gran on the screen by using cat command:
```bash
./target/release/ghost key inspect "$(cat /etc/ghost/session-key)//gran" --scheme=ed25519
```
![images/img_27.png](images/img_27.png)
## Build and start the ghost-node
@ -346,7 +437,7 @@ sha256sum /etc/ghost/casper.json
You should see:
```
9da6045ed6d4fd844e3939573b31c013d0e564e542029330faa6d978cb4a915a
ad653233c978bfd00c5e4525b17628632bc4319c5f5f4b4dcc2f050ef3c3d145
```
Create running `ghost-node` service that starts on system boot using `--unit-file` flag.
@ -372,7 +463,10 @@ To choose default options press Enter here:
![images/img_30.png](images/img_30.png)
If you want to validate from this node press Enter:
Currently, you have to qualify to become a validator node through [GHOST Whales](https://ghostchain.io/whales-apply).
If you were NOT included in the [ghosties file](https://git.ghostchain.io/ghostchain/ghost-node/src/branch/main/service/ghosties) then you cannot be a validator node,
and you can only be a full node so for `disable validator mode? [y/N]` type `y`.
If you were included in the ghosties file you can press Enter:
```
disable validator mode? [y/N]: y
```
@ -417,6 +511,17 @@ Type `y` and press _Enter_ for create dedicated user for running `ghost-node`:
![images/img_37.png](images/img_37.png)
Now you can check whether or not the keys on your GHOST Node match those
in the [ghosties file](https://git.ghostchain.io/ghostchain/ghost-node/src/branch/main/service/ghosties) on GHOST Git.
If you are running a **Validator Node** and if you have followed
the Generating Keys Part you will see all `[+]`.
If you are a running a **Full Node** you will see errors:
(Press _Enter_ for prompts)
```bash
./scripts/starter.sh --check-keys
```
Full Node:
![images/img_38.png](images/img_38.png)
@ -430,7 +535,7 @@ Start `ghost-node`:
sudo systemctl start ghost-node
```
Wait ~60 seconds!
Wait 60 seconds!
Check node is started:
```bash
@ -440,6 +545,11 @@ sudo systemctl status ghost-node
For exit press _CTRL+C_
In order to insert keys run the following flags `--check-keys` `--insert-keys`:
```bash
./scripts/starter.sh --check-keys --insert-keys
```
Restart `ghost-node`:
```bash
sudo systemctl restart ghost-node

0
cli/Cargo.toml Normal file → Executable file
View File

0
cli/build.rs Normal file → Executable file
View File

0
cli/src/cli.rs Normal file → Executable file
View File

171
cli/src/command.rs Normal file → Executable file
View File

@ -1,13 +1,14 @@
use crate::cli::{Cli, Subcommand};
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory};
use futures::future::TryFutureExt;
use keyring::Sr25519Keyring;
use sc_cli::SubstrateCli;
use service::{
self,
benchmarking::{benchmark_inherent_data, RemarkBuilder, TransferKeepAliveBuilder},
IdentifyVariant,
self, IdentifyVariant,
benchmarking::{
benchmark_inherent_data, RemarkBuilder, TransferKeepAliveBuilder
},
};
use keyring::Sr25519Keyring;
pub use crate::{error::Error, service::BlockId};
#[cfg(feature = "pyroscope")]
@ -67,35 +68,28 @@ impl SubstrateCli for Cli {
#[cfg(feature = "casper-native")]
"casper" => Box::new(service::chain_spec::casper_config()?),
#[cfg(feature = "casper-native")]
"casper-dev" | "dev" | "development" => {
Box::new(service::chain_spec::casper_development_config()?)
}
"casper-dev" | "dev" | "development" => Box::new(service::chain_spec::casper_development_config()?),
#[cfg(feature = "casper-native")]
"casper-local" | "local" => {
Box::new(service::chain_spec::casper_local_testnet_config()?)
}
"casper-local" | "local" => Box::new(service::chain_spec::casper_local_testnet_config()?),
#[cfg(feature = "casper-native")]
"casper-staging" | "staging" => {
Box::new(service::chain_spec::casper_staging_testnet_config()?)
}
"casper-staging" | "staging" => Box::new(service::chain_spec::casper_staging_testnet_config()?),
#[cfg(not(feature = "casper-native"))]
name if name.starts_with("casper-") && !name.ends_with(".json") => Err(format!(
"`{}` only supported with `casper-native` feature enabled.",
name
))?,
name if name.starts_with("casper-") && !name.ends_with(".json") =>
Err(format!("`{}` only supported with `casper-native` feature enabled.", name))?,
#[cfg(feature = "casper-native")]
path => {
let path = std::path::PathBuf::from(path);
let chain_spec = Box::new(service::GenericChainSpec::from_json_file(path.clone())?)
as Box<dyn service::ChainSpec>;
let chain_spec = Box::new(
service::GenericChainSpec::from_json_file(path.clone())?
) as Box<dyn service::ChainSpec>;
if chain_spec.is_casper() {
Box::new(service::CasperChainSpec::from_json_file(path)?)
} else {
chain_spec
}
}
},
})
}
}
@ -115,7 +109,10 @@ fn set_ss58_version(spec: &Box<dyn service::ChainSpec>) {
sp_core::crypto::set_default_ss58_version(ss58_version);
}
fn run_node_inner<F>(cli: Cli, logger_hook: F) -> Result<()>
fn run_node_inner<F>(
cli: Cli,
logger_hook: F,
) -> Result<()>
where
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
{
@ -131,8 +128,7 @@ where
.then_some(config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(&database_path);
sc_sysinfo::gather_hwbench(Some(database_path))
}))
.flatten();
})).flatten();
let database_source = config.database.clone();
let task_manager = service::build_full(
@ -142,8 +138,7 @@ where
telemetry_worker_handle: None,
hwbench,
},
)
.map(|full| full.task_manager)?;
).map(|full| full.task_manager)?;
if let Some(path) = database_source.path() {
sc_storage_monitor::StorageMonitorService::try_spawn(
@ -172,9 +167,7 @@ pub fn run() -> Result<()> {
let agent = pyro::Pyroscope::builder(
"http://".to_owned() + address.to_string().as_str(),
"ghost".to_owned(),
)
.backend(pprof_backend(PprofConfig::new().sample_rate(113)))
.build()?;
).backend(pprof_backend(PprofConfig::new().sample_rate(113))).build()?;
Some(agent.start()?)
} else {
@ -183,7 +176,7 @@ pub fn run() -> Result<()> {
#[cfg(not(feature = "pyroscope"))]
if cli.run.pyroscope_server.is_some() {
return Err(Error::PyroscopeNotCompiledIn);
return Err(Error::PyroscopeNotCompiledIn)
}
match &cli.subcommand {
@ -191,7 +184,7 @@ pub fn run() -> Result<()> {
Some(Subcommand::BuildSpec(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
Ok(runner.sync_run(|config| cmd.run(config.chain_spec, config.network))?)
}
},
Some(Subcommand::CheckBlock(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
let chain_spec = &runner.config().chain_spec;
@ -199,13 +192,11 @@ pub fn run() -> Result<()> {
set_ss58_version(chain_spec);
runner.async_run(|mut config| {
let (client, _, import_queue, task_manager) = service::new_chain_ops(&mut config)?;
Ok((
cmd.run(client, import_queue).map_err(Error::SubstrateCli),
task_manager,
))
let (client, _, import_queue, task_manager) =
service::new_chain_ops(&mut config)?;
Ok((cmd.run(client, import_queue).map_err(Error::SubstrateCli), task_manager))
})
}
},
Some(Subcommand::ExportBlocks(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
let chain_spec = &runner.config().chain_spec;
@ -213,14 +204,11 @@ pub fn run() -> Result<()> {
set_ss58_version(chain_spec);
Ok(runner.async_run(|mut config| {
let (client, _, _, task_manager) = service::new_chain_ops(&mut config)?;
Ok((
cmd.run(client, config.database)
.map_err(Error::SubstrateCli),
task_manager,
))
let ( client, _, _, task_manager ) =
service::new_chain_ops(&mut config)?;
Ok((cmd.run(client, config.database).map_err(Error::SubstrateCli), task_manager))
})?)
}
},
Some(Subcommand::ExportState(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
let chain_spec = &runner.config().chain_spec;
@ -228,14 +216,11 @@ pub fn run() -> Result<()> {
set_ss58_version(chain_spec);
Ok(runner.async_run(|mut config| {
let (client, _, _, task_manager) = service::new_chain_ops(&mut config)?;
Ok((
cmd.run(client, config.chain_spec)
.map_err(Error::SubstrateCli),
task_manager,
))
let ( client, _, _, task_manager ) =
service::new_chain_ops(&mut config)?;
Ok((cmd.run(client, config.chain_spec).map_err(Error::SubstrateCli), task_manager))
})?)
}
},
Some(Subcommand::ImportBlocks(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
let chain_spec = &runner.config().chain_spec;
@ -243,17 +228,15 @@ pub fn run() -> Result<()> {
set_ss58_version(chain_spec);
Ok(runner.async_run(|mut config| {
let (client, _, import_queue, task_manager) = service::new_chain_ops(&mut config)?;
Ok((
cmd.run(client, import_queue).map_err(Error::SubstrateCli),
task_manager,
))
let ( client, _, import_queue, task_manager ) =
service::new_chain_ops(&mut config)?;
Ok((cmd.run(client, import_queue).map_err(Error::SubstrateCli), task_manager))
})?)
}
},
Some(Subcommand::PurgeChain(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
Ok(runner.sync_run(|config| cmd.run(config.database))?)
}
},
Some(Subcommand::Revert(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
let chain_spec = &runner.config().chain_spec;
@ -261,59 +244,62 @@ pub fn run() -> Result<()> {
set_ss58_version(chain_spec);
Ok(runner.async_run(|mut config| {
let (client, backend, _, task_manager) = service::new_chain_ops(&mut config)?;
let (client, backend, _, task_manager) =
service::new_chain_ops(&mut config)?;
let aux_revert = Box::new(|client, backend, blocks| {
service::revert_backend(client, backend, blocks).map_err(|err| match err {
service::revert_backend(client, backend, blocks).map_err(|err| {
match err {
service::Error::Blockchain(err) => err.into(),
err => sc_cli::Error::Application(err.into()),
}
})
});
Ok((
cmd.run(client, backend, Some(aux_revert))
.map_err(Error::SubstrateCli),
task_manager,
cmd.run(client, backend, Some(aux_revert)).map_err(Error::SubstrateCli),
task_manager
))
})?)
}
},
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
let chain_spec = &runner.config().chain_spec;
match cmd {
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) => {
BenchmarkCmd::Storage(_) =>
return Err(sc_cli::Error::Input(
"Compile with `--feature=runtime-benchmarks \
to enable storage benchmarks."
.into(),
)
.into())
}
to enable storage benchmarks.".into()
).into()),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| {
let (client, backend, _, _) = service::new_chain_ops(&mut config)?;
let (client, backend, _, _,) =
service::new_chain_ops(&mut config)?;
let db = backend.expose_db();
let storage = backend.expose_storage();
cmd.run(config, client.clone(), db, storage)
.map_err(Error::SubstrateCli)
cmd.run(config, client.clone(), db, storage).map_err(Error::SubstrateCli)
}),
BenchmarkCmd::Block(cmd) => runner.sync_run(|mut config| {
let (client, _, _, _) = service::new_chain_ops(&mut config)?;
let (client, _, _, _,) =
service::new_chain_ops(&mut config)?;
cmd.run(client.clone()).map_err(Error::SubstrateCli)
}),
// These commands are very similar and can be handled in nearly the same way
BenchmarkCmd::Extrinsic(_) | BenchmarkCmd::Overhead(_) => {
BenchmarkCmd::Extrinsic(_) | BenchmarkCmd::Overhead(_) =>
runner.sync_run(|mut config| {
let (client, _, _, _) = service::new_chain_ops(&mut config)?;
let (client, _, _, _) =
service::new_chain_ops(&mut config)?;
let inherent_data = benchmark_inherent_data()
.map_err(|e| format!("generating inherent data: {:?}", e))?;
let remark_builder =
RemarkBuilder::new(client.clone(), config.chain_spec.identify_chain());
let remark_builder = RemarkBuilder::new(
client.clone(),
config.chain_spec.identify_chain(),
);
match cmd {
BenchmarkCmd::Extrinsic(cmd) => {
@ -330,20 +316,17 @@ pub fn run() -> Result<()> {
cmd.run(client.clone(), inherent_data, Vec::new(), &ext_factory)
.map_err(Error::SubstrateCli)
}
BenchmarkCmd::Overhead(cmd) => cmd
.run(
},
BenchmarkCmd::Overhead(cmd) => cmd.run(
config,
client.clone(),
inherent_data,
Vec::new(),
&remark_builder,
)
.map_err(Error::SubstrateCli),
).map_err(Error::SubstrateCli),
_ => unreachable!("Ensured by the outside match; qed"),
}
})
}
}),
BenchmarkCmd::Pallet(cmd) => {
set_ss58_version(chain_spec);
@ -351,23 +334,17 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| {
cmd.run_with_spec::<sp_runtime::traits::HashingFor<service::Block>, ()>(
Some(config.chain_spec),
)
.map_err(|e| Error::SubstrateCli(e))
).map_err(|e| Error::SubstrateCli(e))
})
} else {
Err(sc_cli::Error::Input(
"Benchmarking wasn't enabled when building the node. \
You can enable it with `--features=runtime-benchmarks`."
.into(),
)
.into())
}
You can enable it with `--features=runtime-benchmarks`.".into()
).into())
}
},
BenchmarkCmd::Machine(cmd) => runner.sync_run(|config| {
cmd.run(
&config,
ghost_machine_primitives::GHOST_NODE_REFERENCE_HARDWARE.clone(),
)
cmd.run(&config, ghost_machine_primitives::GHOST_NODE_REFERENCE_HARDWARE.clone())
.map_err(Error::SubstrateCli)
}),
// Note: this allows to implement additional new benchmark
@ -375,12 +352,12 @@ pub fn run() -> Result<()> {
#[allow(unreachable_patterns)]
_ => Err(Error::CommandNotImplemented),
}
}
},
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
Ok(runner.sync_run(|config| cmd.run::<service::Block>(&config))?)
}
},
}?;
#[cfg(feature = "pyroscope")]

0
cli/src/error.rs Normal file → Executable file
View File

4
cli/src/lib.rs Normal file → Executable file
View File

@ -6,7 +6,9 @@ mod command;
mod error;
#[cfg(feature = "service")]
pub use service::{self, Block, CoreApi, IdentifyVariant, ProvideRuntimeApi, TFullClient};
pub use service::{
self, Block, CoreApi, IdentifyVariant, ProvideRuntimeApi, TFullClient,
};
#[cfg(feature = "cli")]
pub use cli::*;

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-client-cli"
version = "0.1.4"
version = "0.1.3"
description = "Ghost CLI interface"
license.workspace = true
authors.workspace = true

View File

@ -3,10 +3,13 @@
use bip39::Mnemonic;
use clap::Parser;
use itertools::Itertools;
use sc_cli::{with_crypto_scheme, CryptoSchemeFlag, Error, KeystoreParams, OutputTypeFlag};
use sc_cli::{
with_crypto_scheme, KeystoreParams, OutputTypeFlag,
CryptoSchemeFlag, Error,
};
use crate::commands::utils::print_from_uri;
use crate::params::NetworkSchemeFlag;
use crate::commands::utils::print_from_uri;
/// The `generate` command
#[derive(Debug, Clone, Parser)]

View File

@ -1,13 +1,14 @@
//! Implementation of the `inspect` subcommand
use crate::commands::utils::{print_from_public, print_from_uri};
use crate::params::NetworkSchemeFlag;
use clap::Parser;
use sc_cli::{
utils::read_uri, with_crypto_scheme, CryptoSchemeFlag, Error, KeystoreParams, OutputTypeFlag,
};
use sp_core::crypto::{ExposeSecret, SecretString, SecretUri, Ss58Codec};
use std::str::FromStr;
use sc_cli::{
with_crypto_scheme, KeystoreParams, OutputTypeFlag, CryptoSchemeFlag, Error,
utils::read_uri,
};
use crate::params::NetworkSchemeFlag;
use crate::commands::utils::{print_from_public, print_from_uri};
/// The `inspect` command
#[derive(Debug, Parser)]
@ -235,16 +236,8 @@ mod tests {
array_bytes::bytes2hex("0x", valid_public_with_password_and_derivation.as_slice());
// They should still be valid, because we check the base secret key.
check_cmd(
&seed_with_password_and_derivation,
&valid_public_hex_with_password,
true,
);
check_cmd(
&seed_with_password_and_derivation,
&valid_accountid_with_password,
true,
);
check_cmd(&seed_with_password_and_derivation, &valid_public_hex_with_password, true);
check_cmd(&seed_with_password_and_derivation, &valid_accountid_with_password, true);
// And these should be invalid.
check_cmd(&seed_with_password_and_derivation, &valid_public_hex, false);

View File

@ -1,7 +1,10 @@
//! Key related CLI utilities
use super::{generate::GenerateCmd, inspect_key::InspectKeyCmd};
use sc_cli::{Error, GenerateKeyCmdCommon, InsertKeyCmd, InspectNodeKeyCmd, SubstrateCli};
use sc_cli::{
GenerateKeyCmdCommon, InsertKeyCmd, InspectNodeKeyCmd, Error,
SubstrateCli,
};
/// Key utilities for the cli.
#[derive(Debug, clap::Subcommand)]

View File

@ -1,13 +1,11 @@
mod generate;
mod inspect_key;
mod key;
mod utils;
mod generate;
mod vanity;
mod inspect_key;
mod utils;
pub use self::{
key::KeySubcommand, vanity::VanityCmd, inspect_key::InspectKeyCmd,
generate::GenerateCmd,
inspect_key::InspectKeyCmd,
key::KeySubcommand,
utils::{print_from_public, print_from_uri, unwrap_or_default_ss58_name},
vanity::VanityCmd,
utils::{unwrap_or_default_ss58_name, print_from_uri, print_from_public},
};

View File

@ -1,15 +1,16 @@
use sc_cli::{
utils::{PublicFor, SeedFor},
OutputType,
};
use serde_json::json;
use sc_cli::{
OutputType,
utils::{PublicFor, SeedFor},
};
use sp_runtime::{traits::IdentifyAccount, MultiSigner};
use sp_core::{
crypto::{
unwrap_or_default_ss58_version, ExposeSecret, SecretString, Ss58AddressFormat, Ss58Codec,
unwrap_or_default_ss58_version,
Ss58Codec, ExposeSecret, Ss58AddressFormat, SecretString,
},
hexdisplay::HexDisplay,
};
use sp_runtime::{traits::IdentifyAccount, MultiSigner};
pub fn print_from_uri<Pair>(
uri: &str,
@ -42,7 +43,7 @@ pub fn print_from_uri<Pair>(
"{}",
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
);
}
},
OutputType::Text => {
println!(
"Secret phrase: {}\n \
@ -58,12 +59,9 @@ pub fn print_from_uri<Pair>(
format_public_key::<Pair>(public_key.clone()),
format_account_id::<Pair>(public_key.clone()),
public_key.to_ss58check_with_version(network_override),
pair.public()
.into()
.into_account()
.to_ss58check_with_version(network_override),
pair.public().into().into_account().to_ss58check_with_version(network_override),
);
}
},
}
} else if let Ok((pair, seed)) = Pair::from_string_with_seed(uri, password) {
let public_key = pair.public();
@ -84,7 +82,7 @@ pub fn print_from_uri<Pair>(
"{}",
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
);
}
},
OutputType::Text => {
println!(
"Secret Key URI `{}` is account:\n \
@ -96,20 +94,13 @@ pub fn print_from_uri<Pair>(
SS58 Address: {}",
uri,
network_id,
if let Some(seed) = seed {
format_seed::<Pair>(seed)
} else {
"n/a".into()
},
if let Some(seed) = seed { format_seed::<Pair>(seed) } else { "n/a".into() },
format_public_key::<Pair>(public_key.clone()),
format_account_id::<Pair>(public_key.clone()),
public_key.to_ss58check_with_version(network_override),
pair.public()
.into()
.into_account()
.to_ss58check_with_version(network_override),
pair.public().into().into_account().to_ss58check_with_version(network_override),
);
}
},
}
} else if let Ok((public_key, network)) = Pair::Public::from_string_with_version(uri) {
let network_override = network_override.unwrap_or(network);
@ -129,7 +120,7 @@ pub fn print_from_uri<Pair>(
"{}",
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
);
}
},
OutputType::Text => {
println!(
"Public Key URI `{}` is account:\n \
@ -145,7 +136,7 @@ pub fn print_from_uri<Pair>(
public_key.to_ss58check_with_version(network_override),
public_key.to_ss58check_with_version(network_override),
);
}
},
}
} else {
println!("Invalid phrase/URI given");
@ -179,11 +170,8 @@ where
"ss58Address": public_key.to_ss58check_with_version(network_override),
});
println!(
"{}",
serde_json::to_string_pretty(&json).expect("Json pretty print failed")
);
}
println!("{}", serde_json::to_string_pretty(&json).expect("Json pretty print failed"));
},
OutputType::Text => {
println!(
"Network ID/Version: {}\n \
@ -197,7 +185,7 @@ where
public_key.to_ss58check_with_version(network_override),
public_key.to_ss58check_with_version(network_override),
);
}
},
}
Ok(())
@ -228,8 +216,5 @@ fn format_account_id<P: sp_core::Pair>(public_key: PublicFor<P>) -> String
where
PublicFor<P>: Into<MultiSigner>,
{
format!(
"0x{}",
HexDisplay::from(&public_key.into().into_account().as_ref())
)
format!("0x{}", HexDisplay::from(&public_key.into().into_account().as_ref()))
}

View File

@ -2,19 +2,21 @@
use clap::Parser;
use rand::{rngs::OsRng, RngCore};
use sc_cli::{utils::format_seed, with_crypto_scheme, CryptoSchemeFlag, Error, OutputTypeFlag};
use sp_core::crypto::{unwrap_or_default_ss58_version, Ss58AddressFormat, Ss58Codec};
use sp_core::crypto::{
unwrap_or_default_ss58_version, Ss58AddressFormat, Ss58Codec,
};
use sp_runtime::traits::IdentifyAccount;
use sc_cli::{
with_crypto_scheme, Error, OutputTypeFlag, CryptoSchemeFlag,
utils::format_seed,
};
use crate::commands::utils::print_from_uri;
use crate::params::NetworkSchemeFlag;
/// The `vanity` command
#[derive(Debug, Clone, Parser)]
#[command(
name = "vanity",
about = "Generate a seed that provides a vanity address"
)]
#[command(name = "vanity", about = "Generate a seed that provides a vanity address")]
pub struct VanityCmd {
/// Desired pattern
#[arg(long, value_parser = assert_non_empty_string)]
@ -82,17 +84,14 @@ where
}
let p = Pair::from_seed(&seed);
let ss58 = p
.public()
.into_account()
.to_ss58check_with_version(network_override);
let ss58 = p.public().into_account().to_ss58check_with_version(network_override);
println!("{:?}", ss58);
let score = calculate_score(desired, &ss58);
if score > best || desired.len() < 2 {
best = score;
if best >= top {
println!("best: {} == top: {}", best, top);
return Ok(format_seed::<Pair>(seed.clone()));
return Ok(format_seed::<Pair>(seed.clone()))
}
}
done += 1;
@ -117,11 +116,11 @@ fn next_seed(seed: &mut [u8]) {
match s {
255 => {
*s = 0;
}
},
_ => {
*s += 1;
break;
}
break
},
}
}
}
@ -133,7 +132,7 @@ fn calculate_score(_desired: &str, key: &str) -> usize {
let snip_size = _desired.len() - truncate;
let truncated = &_desired[0..snip_size];
if let Some(pos) = key.find(truncated) {
return (47 - pos) + (snip_size * 48);
return (47 - pos) + (snip_size * 48)
}
}
0
@ -165,13 +164,11 @@ mod tests {
#[test]
fn test_generation_with_single_char() {
let seed = generate_key::<sr25519::Pair>("ab", default_ss58_version()).unwrap();
assert!(
sr25519::Pair::from_seed_slice(&array_bytes::hex2bytes_unchecked(&seed))
assert!(sr25519::Pair::from_seed_slice(&array_bytes::hex2bytes_unchecked(&seed))
.unwrap()
.public()
.to_ss58check()
.contains("ab")
);
.contains("ab"));
}
#[test]
@ -179,13 +176,11 @@ mod tests {
let seed =
generate_key::<sr25519::Pair>("ab", Ss58AddressFormatRegistry::PolkadotAccount.into())
.unwrap();
assert!(
sr25519::Pair::from_seed_slice(&array_bytes::hex2bytes_unchecked(&seed))
assert!(sr25519::Pair::from_seed_slice(&array_bytes::hex2bytes_unchecked(&seed))
.unwrap()
.public()
.to_ss58check_with_version(Ss58AddressFormatRegistry::PolkadotAccount.into())
.contains("ab")
);
.contains("ab"));
}
#[test]

View File

@ -1,5 +1,5 @@
pub mod commands;
pub mod params;
pub mod commands;
pub use commands::KeySubcommand;
pub use commands::VanityCmd;

View File

@ -21,21 +21,15 @@ pub struct InnerSs58AddressFormat(Ss58AddressFormat);
impl InnerSs58AddressFormat {
#[inline]
pub fn custom(prefix: u16) -> Self {
Self {
0: Ss58AddressFormat::custom(prefix),
}
Self { 0: Ss58AddressFormat::custom(prefix) }
}
}
impl std::fmt::Display for InnerSs58AddressFormat {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
"{} network",
ALL_POSSIBLE_IDS
write!(f, "{} network", ALL_POSSIBLE_IDS
.binary_search(&u16::from(self.0))
.expect("always be found")
)
.expect("always be found"))
}
}
@ -50,13 +44,13 @@ impl<'a> TryFrom<&'a str> for InnerSs58AddressFormat {
}
}
pub fn parse_s58_prefix_address_format(x: &str) -> Result<Ss58AddressFormat, String> {
pub fn parse_s58_prefix_address_format(x: &str,) -> Result<Ss58AddressFormat, String> {
match InnerSs58AddressFormat::try_from(x) {
Ok(format_registry) => Ok(format_registry.0.into()),
Err(_) => Err(format!(
"Unable to parse variant. Known variants: {:?}",
&ALL_POSSIBLE_NAMES
)),
))
}
}

0
core-primitives/Cargo.toml Normal file → Executable file
View File

0
core-primitives/src/lib.rs Normal file → Executable file
View File

0
file_header.txt Normal file → Executable file
View File

View File

@ -22,11 +22,7 @@ impl Metronome {
/// Create a new metronome source with a defined cycle duration.
pub fn new(cycle: Duration) -> Self {
let period = cycle.into();
Self {
period,
delay: Delay::new(period),
state: MetronomeState::Snooze,
}
Self { period, delay: Delay::new(period), state: MetronomeState::Snooze }
}
}
@ -40,14 +36,14 @@ impl futures::Stream for Metronome {
let val = self.period;
self.delay.reset(val);
self.state = MetronomeState::Snooze;
}
},
MetronomeState::Snooze => {
if !Pin::new(&mut self.delay).poll(cx).is_ready() {
break;
break
}
self.state = MetronomeState::SetAlarm;
return Poll::Ready(Some(()));
}
return Poll::Ready(Some(()))
},
}
}
Poll::Pending

View File

@ -2,16 +2,19 @@
use codec::Decode;
use core_primitives::{
metrics_definitions::{CounterDefinition, CounterVecDefinition, HistogramDefinition},
metrics_definitions::{
CounterDefinition, CounterVecDefinition, HistogramDefinition,
},
RuntimeMetricLabelValues, RuntimeMetricOp, RuntimeMetricUpdate,
};
use prometheus_endpoint::{
register, Counter, CounterVec, Histogram, HistogramOpts, Opts, PrometheusError, Registry, U64,
register, Counter, CounterVec, Histogram, HistogramOpts, Opts, Registry,
PrometheusError, U64,
};
use std::{
collections::hash_map::HashMap,
sync::{Arc, Mutex, MutexGuard},
};
}
#[derive(Clone, Debug)]
pub struct Metrics {
@ -29,9 +32,7 @@ impl RuntimeMetricsProvider {
pub fn register_countervec(&self, countervec: CounterVecDefinition) {
self.with_counter_vecs_lock_held(|mut hashmap| {
hashmap
.entry(countervec.name.to_owned())
.or_insert(register(
hashmap.entry(countervec.name.to_owned()).or_insert(register(
CounterVec::new(
Opts::new(countervec.name, countervec.description),
countervec.labels,
@ -45,7 +46,10 @@ impl RuntimeMetricsProvider {
pub fn register_counter(&self, counter: CounterDefinition) {
self.with_counters_lock_held(|mut hashmap| {
hashmap.entry(counter.name.to_owned()).or_insert(register(
Counter::new(counter.name, counter.description)?,
Counter::new(
counter.name,
counter.description,
)?,
&self.0,
)?);
Ok(())
@ -56,7 +60,8 @@ impl RuntimeMetricsProvider {
self.with_histograms_lock_held(|mut hashmap| {
hashmap.entry(hist.name.to_owned()).or_insert(register(
Histogram::with_opts(
HistogramOpts::new(hist.name, hist.description).buckets(hist.buckets.to_vec()),
HistogramOpts::new(hist.name, hist.description)
.buckets(hist.buckets.to_vec()),
)?,
&self.0,
)?);
@ -64,12 +69,15 @@ impl RuntimeMetricsProvider {
})
}
pub fn inc_counter_vec_by(&self, name: &str, value: u64, labels: &RuntimeMetricsProvider) {
pub fn inc_counter_vec_by(
&self,
name: &str,
value: u64,
labels: &RuntimeMetricsProvider,
) {
self.with_counter_vecs_lock_held(|mut hashmap| {
hashmap.entry(name.to_owned()).and_modify(|counter_vec| {
counter_vec
.with_label_values(&labels.as_str_vec())
.inc_by(value)
counter_vec.with_label_values(&labels.as_str_vec()).inc_by(value)
});
Ok(())
})
@ -77,8 +85,7 @@ impl RuntimeMetricsProvider {
pub fn inc_counter_by(&self, name: &str, value: u64) {
self.with_counters_lock_held(|mut hashmap| {
hashmap
.entry(name.to_owned())
hashmap.entry(name.to_owned())
.and_modify(|counter_vec| counter_vec.inc_by(value));
Ok(())
})
@ -86,9 +93,8 @@ impl RuntimeMetricsProvider {
pub fn observe_histogram(&self, name: &str, value: u128) {
self.with_histograms_lock_held(|mut hashmap| {
hashmap
.entry(name.to_owned())
.and_modify(|histogram| histogram.observe(value as f64 / 1_000_000_000.0));
hashmap.entry(name.to_owned())
and_modify(|histogram| histogram.observe(value as f64 / 1_000_000_000.0));
Ok(())
})
}
@ -97,36 +103,21 @@ impl RuntimeMetricsProvider {
where
F: FnOnce(MutexGuard<'_, HashMap<String, Counter<U64>>>) -> Result<(), PrometheusError>,
{
let _ = self
.1
.counters
.lock()
.map(do_something)
.or_else(|error| Err(error));
let _ = self.1.counters.lock().map(do_something).or_else(|error| Err(error));
}
fn with_counter_vecs_lock_held<F>(&self, do_something: F)
where
F: FnOnce(MutexGuard<'_, HashMap<String, CounterVec<U64>>>) -> Result<(), PrometheusError>,
{
let _ = self
.1
.counter_vecs
.lock()
.map(do_something)
.or_else(|error| Err(error));
let _ = self.1.counter_vecs.lock().map(do_something).or_else(|error| Err(error));
}
fn with_histograms_lock_held<F>(&self, do_something: F)
where
F: FnOnce(MutexGuard<'_, HashMap<String, Histogram>>) -> Result<(), PrometheusError>,
{
let _ = self
.1
.histograms
.lock()
.map(do_something)
.or_else(|error| Err(error));
let _ = self.1.histograms.lock().map(do_something).or_else(|error| Err(error));
}
}
@ -140,7 +131,7 @@ impl sc_tracing::TraceHandler for RuntimeMetricsProvider {
.unwrap_or(&String::default())
.ne("metrics")
{
return;
return
}
if let Some(update_op_bs58) = event.values.string_values.get("params") {
@ -150,7 +141,7 @@ impl sc_tracing::TraceHandler for RuntimeMetricsProvider {
.as_slice(),
) {
Ok(update_op) => self.parse_metric_update(update_op),
Err(_) => {}
Err(_) => {},
}
}
}
@ -159,15 +150,12 @@ impl sc_tracing::TraceHandler for RuntimeMetricsProvider {
impl RuntimeMetricsProvider {
fn parse_metric_update(&self, update: RuntimeMetricUpdate) {
match update.op {
RuntimeMetricOp::IncrementCounterVec(value, ref labels) => {
self.inc_counter_vec_by(update.metric_name(), value, labels)
}
RuntimeMetricOp::IncrementCounter(value) => {
self.inc_counter_by(update.metric_name(), value)
}
RuntimeMetricOp::ObserveHistogram(value) => {
self.observe_histogram(update.metric_name(), value)
}
RuntimeMetricOp::IncrementCounterVec(value, ref labels) =>
self.inc_counter_vec_by(update.metric_name(), value, labels),
RuntimeMetricOp::IncrementCounter(value) =>
self.inc_counter_by(update.metric_name(), value),
RuntimeMetricOp::ObserveHistogram(value) =>
self.observe_histogram(update.metric_name(), value),
}
}
@ -190,7 +178,7 @@ impl RuntimeMetricsProvider {
pub fn logger_hook() -> impl FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration) -> () {
|logger_builder, config| {
if config.prometheus_registry().is_none() {
return;
return
}
let registry = config.prometheus_registry().cloned().unwrap();

View File

@ -1,5 +1,5 @@
use ghost_test_service::{node_config, run_validator_node, test_prometheus_config};
use hyper::{Client, Uri};
use ghost_test_service::{node_config, run_validator_node, test_prometheus_config};
use keyring::AccountKeyring::*;
use std::collections::HashMap;
@ -7,13 +7,8 @@ const DEFAULT_PROMETHEUS_PORT: u16 = 9616;
#[tokio::test(flavor = "multi_thread")]
async fn runtime_can_publish_metrics() {
let mut alice_config = node_config(
|| {},
tokio::runtime::Handle::current(),
Alice,
Vec::new(),
true,
);
let mut alice_config =
node_config(|| {}, tokio::runtime::Handle::current(), Alice, Vec::new(), true);
// Enable prometheus metrics for Alice.
alice_config.prometheus_config = Some(test_prometheus_config(DEFAULT_PROMETHEUS_PORT));
@ -31,13 +26,8 @@ async fn runtime_can_publish_metrics() {
// Start validator Alice
let alice = run_validator_node(alice_config, None);
let bob_config = node_config(
|| {},
tokio::runtime::Handle::current(),
Bob,
vec![alice.addr.clone()],
true,
);
let bob_config =
node_config(|| {}, tokio::runtime::Handle::current(), Bob, vec![alice.addr.clone()], true);
// Start validator Bob
let _bob = run_validator_node(bob_config, None);
@ -58,25 +48,19 @@ async fn scrape_prometheus_metrics(metrics_uri: &str) -> HashMap<String, u64> {
.expect("GET request failed");
let body = String::from_utf8(
hyper::body::to_bytes(res)
.await
.expect("can't get body as bytes")
.to_vec(),
)
.expect("body is not an UTF8 string");
hyper::body::to_bytes(res).await.expect("can't get body as bytes").to_vec(),
).expect("body is not an UTF8 string");
let lines: Vec<_> = body.lines().map(|s| Ok(s.to_owned())).collect();
prometheus_parse::Scrape::parse(lines.into_iter())
.expect("Scraper failed to parse Prometheus metrics")
.samples
.into_iter()
.filter_map(
|prometheus_parse::Sample { metric, value, .. }| match value {
.filter_map(|prometheus_parse::Sample { metric, value, .. }| match value {
prometheus_parse::Value::Counter(value) => Some((metric, value as u64)),
prometheus_parse::Value::Gauge(value) => Some((metric, value as u64)),
prometheus_parse::Value::Untyped(value) => Some((metric, value as u64)),
_ => None,
},
)
})
.collect()
}

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-claims"
version = "0.2.4"
version = "0.2.2"
description = "Ghost balance and rank claims based on EVM actions"
license.workspace = true
authors.workspace = true

View File

@ -6,14 +6,14 @@ use frame_benchmarking::v2::*;
#[instance_benchmarks]
mod benchmarks {
use super::*;
use frame_support::dispatch::RawOrigin;
use pallet_ranked_collective::Pallet as Club;
use frame_support::dispatch::RawOrigin;
#[benchmark]
fn claim() {
let i = 1337u32;
let ethereum_secret_key =
libsecp256k1::SecretKey::parse(&keccak_256(&i.to_le_bytes())).unwrap();
let ethereum_secret_key = libsecp256k1::SecretKey::parse(
&keccak_256(&i.to_le_bytes())).unwrap();
let eth_address = crate::secp_utils::eth(&ethereum_secret_key);
let balance = CurrencyOf::<T, I>::minimum_balance();
@ -22,30 +22,23 @@ mod benchmarks {
Total::<T, I>::put(balance);
let pseudo_rank = 5u16;
let _ = Club::<T, I>::do_add_member_to_rank(pseudo_account.clone(), pseudo_rank, false);
let _ = Club::<T, I>::do_add_member_to_rank(
pseudo_account.clone(),
pseudo_rank,
false,
);
let user_account: T::AccountId = account("user", i, 0);
let signature =
crate::secp_utils::sig::<T, I>(&ethereum_secret_key, &user_account.encode());
let signature = crate::secp_utils::sig::<T, I>(&ethereum_secret_key, &user_account.encode());
let prev_balance = CurrencyOf::<T, I>::free_balance(&user_account);
let prev_rank = Club::<T, I>::rank_of(&user_account);
#[extrinsic_call]
claim(
RawOrigin::Signed(user_account.clone()),
eth_address,
signature,
);
claim(RawOrigin::Signed(user_account.clone()), eth_address, signature);
assert_eq!(
CurrencyOf::<T, I>::free_balance(&user_account),
prev_balance + balance
);
assert_eq!(
CurrencyOf::<T, I>::free_balance(&pseudo_account),
balance - balance
);
assert_eq!(CurrencyOf::<T, I>::free_balance(&user_account), prev_balance + balance);
assert_eq!(CurrencyOf::<T, I>::free_balance(&pseudo_account), balance - balance);
let rank = match prev_rank {
Some(current_rank) if pseudo_rank <= current_rank => Some(current_rank),
@ -55,5 +48,9 @@ mod benchmarks {
assert_eq!(Club::<T, I>::rank_of(&pseudo_account), None);
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test,);
impl_benchmark_test_suite!(
Pallet,
crate::mock::new_test_ext(),
crate::mock::Test,
);
}

View File

@ -1,33 +1,31 @@
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{
ensure,
pallet_prelude::*,
ensure, pallet_prelude::*,
traits::{
Currency, ExistenceRequirement, Get, RankedMembers, RankedMembersSwapHandler,
VestingSchedule,
Currency, ExistenceRequirement, Get, RankedMembers,
RankedMembersSwapHandler, VestingSchedule,
},
DefaultNoBound,
};
use frame_system::pallet_prelude::*;
pub use pallet::*;
use serde::{self, Deserialize, Deserializer, Serialize, Serializer};
pub use pallet::*;
use sp_io::{crypto::secp256k1_ecdsa_recover, hashing::keccak_256};
use sp_runtime::traits::{BlockNumberProvider, CheckedDiv, CheckedSub};
use sp_runtime::traits::{CheckedSub, CheckedDiv, BlockNumberProvider};
use sp_std::prelude::*;
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::{format, string::String};
mod weights;
pub mod weights;
pub use crate::weights::WeightInfo;
mod benchmarking;
mod mock;
mod secp_utils;
mod tests;
mod mock;
mod benchmarking;
mod secp_utils;
/// An ethereum address (i.e. 20 bytes, used to represent an Ethereum account).
///
@ -82,14 +80,15 @@ impl sp_std::fmt::Debug for EcdsaSignature {
}
type CurrencyOf<T, I> = <<T as Config<I>>::VestingSchedule as VestingSchedule<
<T as frame_system::Config>::AccountId,
<T as frame_system::Config>::AccountId
>>::Currency;
type BalanceOf<T, I> =
<CurrencyOf<T, I> as Currency<<T as frame_system::Config>::AccountId>>::Balance;
type BalanceOf<T, I> = <CurrencyOf<T, I> as Currency<
<T as frame_system::Config>::AccountId>
>::Balance;
type RankOf<T, I> = <pallet_ranked_collective::Pallet<T, I> as RankedMembers>::Rank;
type AccountIdOf<T, I> = <pallet_ranked_collective::Pallet<T, I> as RankedMembers>::AccountId;
type RankOf<T, I> = <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::Rank;
type AccountIdOf<T, I> = <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::AccountId;
#[frame_support::pallet]
pub mod pallet {
@ -100,11 +99,8 @@ pub mod pallet {
pub struct Pallet<T, I = ()>(_);
#[pallet::config]
pub trait Config<I: 'static = ()>:
frame_system::Config + pallet_ranked_collective::Config<I>
{
type RuntimeEvent: From<Event<Self, I>>
+ IsType<<Self as frame_system::Config>::RuntimeEvent>;
pub trait Config<I: 'static = ()>: frame_system::Config + pallet_ranked_collective::Config<I> {
type RuntimeEvent: From<Event<Self, I>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type VestingSchedule: VestingSchedule<Self::AccountId, Moment = BlockNumberFor<Self>>;
type BlockNumberProvider: BlockNumberProvider<BlockNumber = BlockNumberFor<Self>>;
@ -162,11 +158,7 @@ pub mod pallet {
.map(|(account_id, rank)| {
assert!(
pallet_ranked_collective::Pallet::<T, I>::do_add_member_to_rank(
account_id.clone(),
*rank,
false
)
.is_ok(),
account_id.clone(), *rank, false).is_ok(),
"error during adding and promotion"
);
account_id
@ -193,13 +185,13 @@ pub mod pallet {
) -> DispatchResult {
let who = ensure_signed(origin)?;
let data = who.using_encoded(to_ascii_hex);
let recovered_address = Self::recover_ethereum_address(&ethereum_signature, &data)
.ok_or(Error::<T, I>::InvalidEthereumSignature)?;
let recovered_address = Self::recover_ethereum_address(
&ethereum_signature,
&data,
).ok_or(Error::<T, I>::InvalidEthereumSignature)?;
ensure!(
recovered_address == ethereum_address,
Error::<T, I>::InvalidEthereumAddress
);
ensure!(recovered_address == ethereum_address,
Error::<T, I>::InvalidEthereumAddress);
Self::do_claim(who, ethereum_address)
}
@ -250,15 +242,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
}
fn do_claim(receiver: T::AccountId, ethereum_address: EthereumAddress) -> DispatchResult {
let donor = Self::into_account_id(ethereum_address)
.ok()
let donor = Self::into_account_id(ethereum_address).ok()
.ok_or(Error::<T, I>::AddressDecodingFailed)?;
let balance_due = CurrencyOf::<T, I>::free_balance(&donor);
ensure!(
balance_due >= CurrencyOf::<T, I>::minimum_balance(),
Error::<T, I>::NoBalanceToClaim
);
ensure!(balance_due >= CurrencyOf::<T, I>::minimum_balance(),
Error::<T, I>::NoBalanceToClaim);
let new_total = Total::<T, I>::get()
.checked_sub(&balance_due)
@ -290,32 +279,20 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
)?;
}
let rank = if let Some(rank) =
<pallet_ranked_collective::Pallet<T, I> as RankedMembers>::rank_of(&donor)
{
let rank = if let Some(rank) = <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::rank_of(&donor) {
pallet_ranked_collective::Pallet::<T, I>::do_remove_member_from_rank(&donor, rank)?;
let new_rank =
match <pallet_ranked_collective::Pallet<T, I> as RankedMembers>::rank_of(&receiver)
{
let new_rank = match <pallet_ranked_collective::Pallet::<T, I> as RankedMembers>::rank_of(&receiver) {
Some(current_rank) if current_rank >= rank => current_rank,
Some(current_rank) if current_rank < rank => {
for _ in 0..rank - current_rank {
pallet_ranked_collective::Pallet::<T, I>::do_promote_member(
receiver.clone(),
None,
false,
)?;
pallet_ranked_collective::Pallet::<T, I>::do_promote_member(receiver.clone(), None, false)?;
}
rank
}
},
_ => {
pallet_ranked_collective::Pallet::<T, I>::do_add_member_to_rank(
receiver.clone(),
rank,
false,
)?;
pallet_ranked_collective::Pallet::<T, I>::do_add_member_to_rank(receiver.clone(), rank, false)?;
rank
}
},
};
<T as pallet::Config<I>>::MemberSwappedHandler::swapped(&donor, &receiver, new_rank);
Some(new_rank)

View File

@ -4,113 +4,51 @@ use super::*;
pub use crate as ghost_claims;
use frame_support::{
derive_impl, parameter_types,
traits::{ConstU16, ConstU64, PollStatus, Polling, WithdrawReasons},
parameter_types, derive_impl,
traits::{PollStatus, Polling, WithdrawReasons, ConstU16, ConstU64},
};
use frame_system::EnsureRootWithSuccess;
pub use pallet_ranked_collective::{Rank, TallyOf};
use sp_runtime::{traits::Convert, BuildStorage};
use sp_runtime::{BuildStorage, traits::Convert};
pub use pallet_ranked_collective::{TallyOf, Rank};
pub mod eth_keys {
use crate::{mock::Test, EcdsaSignature, EthereumAddress};
use codec::Encode;
use crate::{
mock::Test,
EcdsaSignature, EthereumAddress,
};
use hex_literal::hex;
use codec::Encode;
pub fn total_claims() -> u64 {
10 + 100 + 1000
}
pub fn alice_account_id() -> <Test as frame_system::Config>::AccountId {
69
}
pub fn bob_account_id() -> <Test as frame_system::Config>::AccountId {
1337
}
pub fn total_claims() -> u64 { 10 + 100 + 1000 }
pub fn alice_account_id() -> <Test as frame_system::Config>::AccountId { 69 }
pub fn bob_account_id() -> <Test as frame_system::Config>::AccountId { 1337 }
pub fn first_eth_public_known() -> EthereumAddress {
EthereumAddress(hex!("1A69d2D5568D1878023EeB121a73d33B9116A760"))
}
pub fn second_eth_public_known() -> EthereumAddress {
EthereumAddress(hex!("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"))
}
pub fn third_eth_public_known() -> EthereumAddress {
EthereumAddress(hex!("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"))
}
pub fn fourth_eth_public_known() -> EthereumAddress {
EthereumAddress(hex!("827ee4ad9b259b6fa1390ed60921508c78befd63"))
}
pub fn first_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("1A69d2D5568D1878023EeB121a73d33B9116A760")) }
pub fn second_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12")) }
pub fn third_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("e83f67361Ac74D42A48E2DAfb6706eb047D8218D")) }
pub fn fourth_eth_public_known() -> EthereumAddress { EthereumAddress(hex!("827ee4ad9b259b6fa1390ed60921508c78befd63")) }
fn first_eth_private_key() -> libsecp256k1::SecretKey {
libsecp256k1::SecretKey::parse(&hex!(
"01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198"
))
.unwrap()
}
fn second_eth_private_key() -> libsecp256k1::SecretKey {
libsecp256k1::SecretKey::parse(&hex!(
"b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139"
))
.unwrap()
}
fn third_eth_private_key() -> libsecp256k1::SecretKey {
libsecp256k1::SecretKey::parse(&hex!(
"d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc"
))
.unwrap()
}
fn fourth_eth_private_key() -> libsecp256k1::SecretKey {
libsecp256k1::SecretKey::parse(&hex!(
"c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4"
))
.unwrap()
}
fn wrong_eth_private_key() -> libsecp256k1::SecretKey {
libsecp256k1::SecretKey::parse(&hex!(
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
))
.unwrap()
}
fn first_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198")).unwrap() }
fn second_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139")).unwrap() }
fn third_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc")).unwrap() }
fn fourth_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4")).unwrap() }
fn wrong_eth_private_key() -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::parse(&hex!("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef")).unwrap() }
pub fn first_eth_public_key() -> EthereumAddress {
crate::secp_utils::eth(&first_eth_private_key())
}
pub fn second_eth_public_key() -> EthereumAddress {
crate::secp_utils::eth(&second_eth_private_key())
}
pub fn third_eth_public_key() -> EthereumAddress {
crate::secp_utils::eth(&third_eth_private_key())
}
pub fn fourth_eth_public_key() -> EthereumAddress {
crate::secp_utils::eth(&fourth_eth_private_key())
}
pub fn first_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&first_eth_private_key()) }
pub fn second_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&second_eth_private_key()) }
pub fn third_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&third_eth_private_key()) }
pub fn fourth_eth_public_key() -> EthereumAddress { crate::secp_utils::eth(&fourth_eth_private_key()) }
pub fn first_account_id() -> <Test as frame_system::Config>::AccountId {
crate::secp_utils::into_account_id::<Test, ()>(first_eth_public_key())
}
pub fn second_account_id() -> <Test as frame_system::Config>::AccountId {
crate::secp_utils::into_account_id::<Test, ()>(second_eth_public_key())
}
pub fn third_account_id() -> <Test as frame_system::Config>::AccountId {
crate::secp_utils::into_account_id::<Test, ()>(third_eth_public_key())
}
pub fn fourth_account_id() -> <Test as frame_system::Config>::AccountId {
crate::secp_utils::into_account_id::<Test, ()>(fourth_eth_public_key())
}
pub fn first_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(first_eth_public_key()) }
pub fn second_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(second_eth_public_key()) }
pub fn third_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(third_eth_public_key()) }
pub fn fourth_account_id() -> <Test as frame_system::Config>::AccountId { crate::secp_utils::into_account_id::<Test, ()>(fourth_eth_public_key()) }
pub fn first_signature() -> EcdsaSignature {
crate::secp_utils::sig::<Test, ()>(&first_eth_private_key(), &alice_account_id().encode())
}
pub fn second_signature() -> EcdsaSignature {
crate::secp_utils::sig::<Test, ()>(&second_eth_private_key(), &alice_account_id().encode())
}
pub fn third_signature() -> EcdsaSignature {
crate::secp_utils::sig::<Test, ()>(&third_eth_private_key(), &alice_account_id().encode())
}
pub fn fourth_signature() -> EcdsaSignature {
crate::secp_utils::sig::<Test, ()>(&fourth_eth_private_key(), &bob_account_id().encode())
}
pub fn wrong_signature() -> EcdsaSignature {
crate::secp_utils::sig::<Test, ()>(&wrong_eth_private_key(), &alice_account_id().encode())
}
pub fn first_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&first_eth_private_key(), &alice_account_id().encode()) }
pub fn second_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&second_eth_private_key(), &alice_account_id().encode()) }
pub fn third_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&third_eth_private_key(), &alice_account_id().encode()) }
pub fn fourth_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&fourth_eth_private_key(), &bob_account_id().encode()) }
pub fn wrong_signature() -> EcdsaSignature { crate::secp_utils::sig::<Test, ()>(&wrong_eth_private_key(), &alice_account_id().encode()) }
}
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
@ -128,6 +66,7 @@ impl pallet_balances::Config for Test {
type AccountStore = System;
}
parameter_types! {
pub const MinVestedTransfer: u64 = 1;
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons =
@ -140,7 +79,8 @@ impl pallet_vesting::Config for Test {
type BlockNumberToBalance = sp_runtime::traits::ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
type UnvestedFundsAllowedWithdrawReasons =
UnvestedFundsAllowedWithdrawReasons;
type BlockNumberProvider = System;
const MAX_VESTING_SCHEDULES: u32 = 28;

View File

@ -8,8 +8,7 @@ pub fn public(secret: &libsecp256k1::SecretKey) -> libsecp256k1::PublicKey {
pub fn eth(secret: &libsecp256k1::SecretKey) -> EthereumAddress {
let mut res = EthereumAddress::default();
res.0
.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]);
res.0.copy_from_slice(&keccak_256(&public(secret).serialize()[1..65])[12..]);
res
}
@ -26,7 +25,10 @@ pub fn sig<T: Config<I>, I: 'static>(
&crate::to_ascii_hex(what)[..],
));
let (sig, recovery_id) = libsecp256k1::sign(&libsecp256k1::Message::parse(&msg), secret);
let (sig, recovery_id) = libsecp256k1::sign(
&libsecp256k1::Message::parse(&msg),
secret,
);
let mut r = [0u8; 65];
r[0..64].copy_from_slice(&sig.serialize()[..]);

View File

@ -1,19 +1,21 @@
#![cfg(test)]
use super::*;
use frame_support::{assert_err, assert_ok};
use hex_literal::hex;
use mock::{
new_test_ext, ghost_claims,
Test, System, Balances, Club, Vesting, Claims, RuntimeOrigin, RuntimeEvent,
eth_keys::{
alice_account_id, bob_account_id, first_account_id, first_eth_public_key,
first_eth_public_known, first_signature, fourth_account_id, fourth_eth_public_key,
fourth_eth_public_known, fourth_signature, second_account_id, second_eth_public_key,
second_eth_public_known, second_signature, third_account_id, third_eth_public_key,
third_eth_public_known, third_signature, total_claims, wrong_signature,
},
ghost_claims, new_test_ext, Balances, Claims, Club, RuntimeEvent, RuntimeOrigin, System, Test,
Vesting,
alice_account_id, total_claims, first_eth_public_known,
first_eth_public_key, first_account_id, first_signature,
second_eth_public_known, second_eth_public_key, second_account_id,
second_signature, third_eth_public_known, third_eth_public_key,
third_account_id, third_signature, fourth_eth_public_known,
fourth_eth_public_key, fourth_account_id, fourth_signature,
wrong_signature, bob_account_id,
}
};
use hex_literal::hex;
use frame_support::{assert_err, assert_ok};
use super::*;
#[test]
fn serde_works() {
@ -56,8 +58,7 @@ fn small_claiming_works() {
assert_ok!(Claims::claim(
RuntimeOrigin::signed(alice_account_id()),
first_eth_public_key(),
first_signature()
));
first_signature()));
assert_eq!(Balances::usable_balance(&alice_account_id()), 10);
assert_eq!(Balances::usable_balance(&first_account_id()), 0);
@ -112,15 +113,11 @@ fn big_claiming_works() {
assert_eq!(Club::rank_of(&third_account_id()), None);
assert_eq!(Vesting::vesting_balance(&alice_account_id()), Some(800));
assert_eq!(
ghost_claims::Total::<Test, ()>::get(),
total_claims() - 1000
);
assert_eq!(ghost_claims::Total::<Test, ()>::get(), total_claims() - 1000);
assert_ok!(Balances::transfer_allow_death(
RuntimeOrigin::signed(alice_account_id()),
bob_account_id(),
200
));
200));
})
}
@ -191,14 +188,11 @@ fn multiple_accounts_reverese_claiming_works() {
#[test]
fn cannot_claim_with_bad_signature() {
new_test_ext().execute_with(|| {
assert_err!(
Claims::claim(
assert_err!(Claims::claim(
RuntimeOrigin::signed(alice_account_id()),
first_eth_public_key(),
wrong_signature()
),
crate::Error::<Test>::InvalidEthereumAddress
);
wrong_signature()),
crate::Error::<Test>::InvalidEthereumAddress);
assert_eq!(Balances::usable_balance(&alice_account_id()), 0);
assert_eq!(Balances::usable_balance(&first_account_id()), 10);
@ -218,14 +212,11 @@ fn cannot_claim_with_bad_signature() {
#[test]
fn cannot_claim_with_wrong_address() {
new_test_ext().execute_with(|| {
assert_err!(
Claims::claim(
assert_err!(Claims::claim(
RuntimeOrigin::signed(bob_account_id()),
first_eth_public_key(),
first_signature()
),
crate::Error::<Test>::InvalidEthereumAddress
);
first_signature()),
crate::Error::<Test>::InvalidEthereumAddress);
assert_eq!(Balances::usable_balance(&bob_account_id()), 0);
assert_eq!(Balances::usable_balance(&alice_account_id()), 0);
@ -246,14 +237,11 @@ fn cannot_claim_with_wrong_address() {
#[test]
fn cannot_claim_nothing() {
new_test_ext().execute_with(|| {
assert_err!(
Claims::claim(
assert_err!(Claims::claim(
RuntimeOrigin::signed(bob_account_id()),
fourth_eth_public_key(),
fourth_signature()
),
crate::Error::<Test>::NoBalanceToClaim
);
fourth_signature()),
crate::Error::<Test>::NoBalanceToClaim);
assert_eq!(Balances::usable_balance(&bob_account_id()), 0);
assert_eq!(Balances::usable_balance(&fourth_account_id()), 0);
assert_eq!(Vesting::vesting_balance(&bob_account_id()), None);
@ -275,7 +263,8 @@ fn event_emitted_during_claim() {
third_eth_public_key(),
third_signature(),
));
System::assert_has_event(RuntimeEvent::Claims(crate::Event::Claimed {
System::assert_has_event(RuntimeEvent::Claims(
crate::Event::Claimed {
receiver: alice_account_id(),
donor: account,
amount,

View File

@ -1,77 +1,9 @@
// This file is part of Ghost Network.
use frame_support::weights::Weight;
// 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 {
fn claim() -> Weight;
}
impl WeightInfo for () {
/// 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))
}
fn claim() -> Weight { Weight::zero() }
}

14
pallets/networks/Cargo.toml Normal file → Executable file
View File

@ -1,8 +1,8 @@
[package]
name = "ghost-networks"
version = "0.1.26"
license.workspace = true
authors.workspace = true
version.workspace = true
edition.workspace = true
homepage.workspace = true
repository.workspace = true
@ -10,30 +10,24 @@ repository.workspace = true
[dependencies]
scale-info = { workspace = true, features = ["derive"] }
codec = { workspace = true, features = ["max-encoded-len"] }
num-traits = { workspace = true }
log = { workspace = true }
frame-benchmarking = { workspace = true, optional = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-staking = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
ghost-traits = { workspace = true }
[dev-dependencies]
primitives = { workspace = true }
sp-io = { workspace = true }
pallet-balances = { workspace = true }
pallet-staking-reward-curve = { workspace = true }
sp-io = { workspace = true }
[features]
default = ["std"]
std = [
"scale-info/std",
"codec/std",
"log/std",
"num-traits/std",
"frame-support/std",
"frame-system/std",
"frame-benchmarking?/std",
@ -41,7 +35,6 @@ std = [
"sp-std/std",
"sp-io/std",
"ghost-traits/std",
"pallet-staking/std",
"pallet-balances/std",
]
runtime-benchmarks = [
@ -49,11 +42,8 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"pallet-staking/try-runtime",
"pallet-balances/try-runtime",
]

118
pallets/networks/src/benchmarking.rs Normal file → Executable file
View File

@ -8,45 +8,31 @@ use sp_runtime::Saturating;
const MAX_NAME_LEN: u32 = 20;
const MAX_ENDPOINT_LEN: u32 = 150;
const MAX_ENDPOINT_NUMBER: u32 = 20;
fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {
frame_system::Pallet::<T>::assert_last_event(generic_event.into());
}
fn prepare_network<T: Config>(
n: u32,
m: u32,
k: u32,
n: u32, m: u32,
) -> (<T as module::Config>::NetworkId, NetworkData) {
let chain_id: <T as module::Config>::NetworkId = Default::default();
let chain_id = chain_id.saturating_add((n + m).into());
let mut gatekeeper = b"0x".to_vec();
for i in 0..40 {
gatekeeper.push(i);
}
for i in 0..40 { gatekeeper.push(i); }
let mut topic_name = b"0x".to_vec();
for i in 0..64 {
topic_name.push(i);
}
let mut default_endpoints = sp_std::vec![];
for _ in 0..(k as usize) {
default_endpoints.push(sp_std::vec![0x69; m as usize]);
}
for i in 0..64 { topic_name.push(i); }
let network = NetworkData {
chain_name: sp_std::vec![0x69; n as usize],
default_endpoints,
default_endpoint: sp_std::vec![0x69; m as usize],
gatekeeper,
topic_name,
finality_delay: Some(69),
release_delay: Some(69),
network_type: NetworkType::Evm,
avg_block_speed: 12,
finality_delay: 69,
rate_limit_delay: 69,
block_distance: 69,
incoming_fee: 0,
outgoing_fee: 0,
};
@ -64,11 +50,8 @@ fn create_network<T: Config>(
let authority = T::RegisterOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
GhostNetworks::<T>::register_network(
authority.clone(),
chain_id.clone(),
network.clone(),
)
.map_err(|_| BenchmarkError::Weightless)?;
authority.clone(), chain_id.clone(), network.clone()
).map_err(|_| BenchmarkError::Weightless)?;
network
}
};
@ -80,26 +63,23 @@ benchmarks! {
register_network {
let i in 1 .. MAX_NAME_LEN;
let j in 1 .. MAX_ENDPOINT_LEN;
let k in 1 .. MAX_ENDPOINT_NUMBER;
let (chain_id, network) = prepare_network::<T>(i, j, k);
let (chain_id, network) = prepare_network::<T>(i, j);
let authority = T::RegisterOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), None);
assert!(GhostNetworks::<T>::network_indexes().is_empty());
let prev_network = GhostNetworks::<T>::networks(chain_id.clone());
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), network.clone())
verify {
assert_last_event::<T>(Event::NetworkRegistered {
chain_id: chain_id.clone(), network: network.clone(),
chain_id: chain_id.clone(), network,
}.into());
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), Some(network));
assert_eq!(GhostNetworks::<T>::network_indexes(), vec![chain_id]);
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_network_name {
let n in 1 .. MAX_NAME_LEN;
let name = sp_std::vec![0x42; n as usize];
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -113,25 +93,22 @@ benchmarks! {
update_network_endpoint {
let n in 1 .. MAX_ENDPOINT_LEN;
let index_to_update = 0u32;
let endpoint = sp_std::vec![0x42; n as usize];
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), Some(index_to_update), Some(endpoint.clone()))
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), endpoint.clone())
verify {
assert_last_event::<T>(Event::NetworkEndpointUpdated {
chain_id: chain_id.clone(),
index: index_to_update,
endpoint,
chain_id: chain_id.clone(), default_endpoint: endpoint,
}.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_network_finality_delay {
let delay = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let delay = Some(1337);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -143,37 +120,23 @@ benchmarks! {
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_network_rate_limit_delay {
let rate_limit = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
update_network_release_delay {
let delay = Some(1337);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), rate_limit)
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), delay)
verify {
assert_last_event::<T>(Event::NetworkRateLimitDelayUpdated {
chain_id: chain_id.clone(), rate_limit_delay: rate_limit,
}.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_network_block_distance {
let block_distance = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), block_distance)
verify {
assert_last_event::<T>(Event::NetworkBlockDistanceUpdated {
chain_id: chain_id.clone(), block_distance,
assert_last_event::<T>(Event::NetworkReleaseDelayUpdated {
chain_id: chain_id.clone(), release_delay: delay,
}.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_network_type {
let network_type = NetworkType::Utxo;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -188,7 +151,7 @@ benchmarks! {
update_network_gatekeeper {
let mut gatekeeper = b"0x".to_vec();
for i in 0..40 { gatekeeper.push(i + 1); }
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -202,7 +165,7 @@ benchmarks! {
update_network_topic_name {
let topic_name = b"0x9876543219876543219876543219876543219876543219876543219876543219".to_vec();
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -216,7 +179,7 @@ benchmarks! {
update_incoming_network_fee {
let incoming_fee = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -230,7 +193,7 @@ benchmarks! {
update_outgoing_network_fee {
let outgoing_fee = 1337;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
@ -242,34 +205,17 @@ benchmarks! {
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
update_avg_block_speed {
let avg_block_speed = 420;
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let authority = T::UpdateOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone(), avg_block_speed)
verify {
assert_last_event::<T>(Event::NetworkAvgBlockSpeedUpdated {
chain_id: chain_id.clone(), avg_block_speed,
}.into());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), None);
}
remove_network {
let (chain_id, network) = prepare_network::<T>(1, 1, 1);
let (chain_id, network) = prepare_network::<T>(1, 1);
let authority = T::RemoveOrigin::try_successful_origin()
.map_err(|_| BenchmarkError::Weightless)?;
let _ = create_network::<T>(chain_id.clone(), network.clone())?;
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), Some(network));
assert_eq!(GhostNetworks::<T>::network_indexes(), vec![chain_id.clone()]);
let prev_network = create_network::<T>(chain_id.clone(), network.clone())?;
}: _<T::RuntimeOrigin>(authority, chain_id.clone())
verify {
assert_last_event::<T>(Event::NetworkRemoved {
chain_id: chain_id.clone(),
}.into());
assert_eq!(GhostNetworks::<T>::networks(chain_id.clone()), None);
assert!(GhostNetworks::<T>::network_indexes().is_empty());
assert_ne!(GhostNetworks::<T>::networks(chain_id.clone()), prev_network);
}
impl_benchmark_test_suite!(GhostNetworks, crate::mock::ExtBuilder::build(), crate::mock::Test);

538
pallets/networks/src/lib.rs Normal file → Executable file
View File

@ -4,28 +4,25 @@
use frame_support::{
pallet_prelude::*,
storage::PrefixIterator,
traits::{tokens::fungible::Inspect, EnsureOrigin},
storage::PrefixIterator, traits::EnsureOrigin,
};
use frame_system::pallet_prelude::*;
use scale_info::TypeInfo;
use sp_runtime::{
curve::PiecewiseLinear,
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Member, UniqueSaturatedInto},
traits::{AtLeast32BitUnsigned, Member},
DispatchResult,
};
use sp_std::{convert::TryInto, prelude::*};
use sp_std::prelude::*;
pub use ghost_traits::networks::{
NetworkDataBasicHandler, NetworkDataInspectHandler, NetworkDataMutateHandler,
NetworkDataBasicHandler, NetworkDataInspectHandler,
NetworkDataMutateHandler,
};
pub mod migrations;
mod weights;
pub use crate::weights::WeightInfo;
pub use module::*;
pub use crate::weights::WeightInfo;
#[cfg(any(feature = "runtime-benchmarks", test))]
mod benchmarking;
@ -34,12 +31,7 @@ mod mock;
#[cfg(all(feature = "std", test))]
mod tests;
const LOG_TARGET: &str = "runtime::ghost-networks";
pub type BalanceOf<T> =
<<T as Config>::Currency as Inspect<<T as frame_system::Config>::AccountId>>::Balance;
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)]
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub enum NetworkType {
Evm = 0,
Utxo = 1,
@ -47,95 +39,30 @@ pub enum NetworkType {
}
impl Default for NetworkType {
fn default() -> Self {
NetworkType::Evm
}
fn default() -> Self { NetworkType::Evm }
}
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct NetworkData {
pub chain_name: Vec<u8>,
pub default_endpoints: Vec<Vec<u8>>,
pub default_endpoint: Vec<u8>,
pub gatekeeper: Vec<u8>,
pub topic_name: Vec<u8>,
pub finality_delay: Option<u64>,
pub release_delay: Option<u64>,
pub network_type: NetworkType,
pub finality_delay: u64,
pub rate_limit_delay: u64,
pub block_distance: u64,
pub avg_block_speed: u64,
pub incoming_fee: u32,
pub outgoing_fee: u32,
}
#[derive(Default, Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug, TypeInfo)]
pub struct BridgeAdjustment<Balance> {
pub bridged_out: Balance,
pub bridged_in: Balance,
}
pub struct BridgedInflationCurve<RewardCurve, T>(core::marker::PhantomData<(RewardCurve, T)>);
impl<Balance, RewardCurve, T> pallet_staking::EraPayout<Balance>
for BridgedInflationCurve<RewardCurve, T>
where
Balance: Default
+ Copy
+ From<BalanceOf<T>>
+ AtLeast32BitUnsigned
+ num_traits::ops::wrapping::WrappingAdd
+ num_traits::ops::overflowing::OverflowingAdd
+ sp_std::ops::AddAssign
+ sp_std::ops::Not<Output = Balance>
+ sp_std::ops::Shl<Output = Balance>
+ sp_std::ops::Shr<Output = Balance>
+ sp_std::ops::BitAnd<Balance, Output = Balance>,
RewardCurve: Get<&'static PiecewiseLinear<'static>>,
T: Config,
{
fn era_payout(
total_staked: Balance,
total_issuance: Balance,
_era_duration_in_millis: u64,
) -> (Balance, Balance) {
let reward_curve = RewardCurve::get();
let bridged_imbalance = BridgedImbalance::<T>::take();
let accumulated_commission = AccumulatedCommission::<T>::take();
let accumulated_commission: Balance = accumulated_commission.into();
let adjusted_issuance: Balance = total_issuance
.saturating_add(bridged_imbalance.bridged_out.into())
.saturating_sub(bridged_imbalance.bridged_in.into());
let estimated_reward =
reward_curve.calculate_for_fraction_times_denominator(total_staked, adjusted_issuance);
let payout: Balance = sp_runtime::helpers_128bit::multiply_by_rational_with_rounding(
estimated_reward.unique_saturated_into(),
accumulated_commission.unique_saturated_into(),
adjusted_issuance.unique_saturated_into(),
sp_runtime::Rounding::NearestPrefUp,
)
.map(|result| result.unique_saturated_into())
.unwrap_or_default();
let rest_payout = accumulated_commission.saturating_sub(payout);
(payout, rest_payout)
}
}
#[frame_support::pallet]
pub mod module {
use super::*;
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
#[pallet::config]
pub trait Config: frame_system::Config {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The type used for the internal balance storage.
type Currency: Inspect<Self::AccountId>;
/// The type used as a unique network id.
type NetworkId: Parameter
+ Member
@ -155,9 +82,6 @@ pub mod module {
/// The origin required to remove network.
type RemoveOrigin: EnsureOrigin<Self::RuntimeOrigin>;
#[pallet::constant]
type MaxNetworks: Get<u32>;
/// Weight information for extrinsics in this module.
type WeightInfo: WeightInfo;
}
@ -172,102 +96,32 @@ pub mod module {
WrongGatekeeperAddress,
/// Topic name length not 66 or prefix `0x` missed.
WrongTopicName,
/// Could not store networks into bounded vector.
TooManyNetworks,
}
#[pallet::event]
#[pallet::generate_deposit(pub(crate) fn deposit_event)]
pub enum Event<T: Config> {
NetworkRegistered {
chain_id: T::NetworkId,
network: NetworkData,
},
NetworkNameUpdated {
chain_id: T::NetworkId,
chain_name: Vec<u8>,
},
NetworkEndpointUpdated {
chain_id: T::NetworkId,
index: u32,
endpoint: Vec<u8>,
},
NetworkEndpointRemoved {
chain_id: T::NetworkId,
index: u32,
},
NetworkEndpointAdded {
chain_id: T::NetworkId,
endpoint: Vec<u8>,
},
NetworkFinalityDelayUpdated {
chain_id: T::NetworkId,
finality_delay: u64,
},
NetworkRateLimitDelayUpdated {
chain_id: T::NetworkId,
rate_limit_delay: u64,
},
NetworkBlockDistanceUpdated {
chain_id: T::NetworkId,
block_distance: u64,
},
NetworkTypeUpdated {
chain_id: T::NetworkId,
network_type: NetworkType,
},
NetworkGatekeeperUpdated {
chain_id: T::NetworkId,
gatekeeper: Vec<u8>,
},
NetworkTopicNameUpdated {
chain_id: T::NetworkId,
topic_name: Vec<u8>,
},
NetworkIncomingFeeUpdated {
chain_id: T::NetworkId,
incoming_fee: u32,
},
NetworkOutgoingFeeUpdated {
chain_id: T::NetworkId,
outgoing_fee: u32,
},
NetworkAvgBlockSpeedUpdated {
chain_id: T::NetworkId,
avg_block_speed: u64,
},
NetworkRemoved {
chain_id: T::NetworkId,
},
NetworkRegistered { chain_id: T::NetworkId, network: NetworkData },
NetworkNameUpdated { chain_id: T::NetworkId, chain_name: Vec<u8> },
NetworkEndpointUpdated { chain_id: T::NetworkId, default_endpoint: Vec<u8> },
NetworkFinalityDelayUpdated { chain_id: T::NetworkId, finality_delay: Option<u64> },
NetworkReleaseDelayUpdated { chain_id: T::NetworkId, release_delay: Option<u64> },
NetworkTypeUpdated { chain_id: T::NetworkId, network_type: NetworkType },
NetworkGatekeeperUpdated { chain_id: T::NetworkId, gatekeeper: Vec<u8> },
NetworkTopicNameUpdated { chain_id: T::NetworkId, topic_name: Vec<u8> },
NetworkIncomingFeeUpdated { chain_id: T::NetworkId, incoming_fee: u32 },
NetworkOutgoingFeeUpdated { chain_id: T::NetworkId, outgoing_fee: u32 },
NetworkRemoved { chain_id: T::NetworkId },
}
#[pallet::storage]
#[pallet::getter(fn bridged_imbalance)]
pub type BridgedImbalance<T: Config> =
StorageValue<_, BridgeAdjustment<BalanceOf<T>>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn accumulated_commission)]
pub type AccumulatedCommission<T: Config> = StorageValue<_, BalanceOf<T>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn network_indexes)]
pub type NetworkIndexes<T: Config> =
StorageValue<_, BoundedVec<T::NetworkId, T::MaxNetworks>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn networks)]
pub type Networks<T: Config> =
StorageMap<_, Twox64Concat, T::NetworkId, NetworkData, OptionQuery>;
#[pallet::storage]
#[pallet::getter(fn gatekeeper_amount)]
pub type GatekeeperAmount<T: Config> =
StorageMap<_, Twox64Concat, T::NetworkId, BalanceOf<T>, ValueQuery>;
#[pallet::genesis_config]
pub struct GenesisConfig<T: Config> {
pub networks: Vec<(T::NetworkId, Vec<u8>, BalanceOf<T>)>,
pub networks: Vec<(T::NetworkId, Vec<u8>)>,
}
impl<T: Config> Default for GenesisConfig<T> {
@ -280,35 +134,30 @@ pub mod module {
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
if !self.networks.is_empty() {
self.networks
.iter()
.for_each(|(chain_id, network_metadata, gatekeeper_amount)| {
let network = NetworkData::decode(&mut &network_metadata[..])
self.networks.iter().for_each(|(chain_id, network_metadata)| {
let network =
NetworkData::decode(&mut &network_metadata[..])
.expect("Error decoding NetworkData");
Pallet::<T>::do_register_network(chain_id.clone(), network)
.expect("Error registering network");
GatekeeperAmount::<T>::insert(chain_id, gatekeeper_amount);
});
}
}
}
#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
#[pallet::without_storage_info]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::register_network(
network.chain_name.len() as u32,
network.default_endpoints
.iter()
.map(|endpoint| endpoint.len())
.max()
.unwrap_or_default() as u32,
network.default_endpoints.len() as u32,
network.default_endpoint.len() as u32,
))]
pub fn register_network(
origin: OriginFor<T>,
@ -329,24 +178,26 @@ pub mod module {
chain_name: Vec<u8>,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_name(chain_id, chain_name)
Self::do_update_network_name(
chain_id,
chain_name,
)
}
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::update_network_endpoint(
maybe_endpoint
.as_ref()
.map(|endpoint| endpoint.len())
.unwrap_or_default() as u32
default_endpoint.len() as u32
))]
pub fn update_network_endpoint(
origin: OriginFor<T>,
chain_id: T::NetworkId,
maybe_index: Option<u32>,
maybe_endpoint: Option<Vec<u8>>,
default_endpoint: Vec<u8>,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_endpoint(chain_id, maybe_index, maybe_endpoint)
Self::do_update_network_endpoint(
chain_id,
default_endpoint,
)
}
#[pallet::call_index(3)]
@ -354,35 +205,30 @@ pub mod module {
pub fn update_network_finality_delay(
origin: OriginFor<T>,
chain_id: T::NetworkId,
finality_delay: u64,
finality_delay: Option<u64>,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_finality_delay(chain_id, finality_delay)
Self::do_update_network_finality_delay(
chain_id,
finality_delay,
)
}
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::update_network_rate_limit_delay())]
pub fn update_network_rate_limit_delay(
#[pallet::weight(T::WeightInfo::update_network_release_delay())]
pub fn update_network_release_delay(
origin: OriginFor<T>,
chain_id: T::NetworkId,
rate_limit_delay: u64,
release_delay: Option<u64>,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_rate_limit_delay(chain_id, rate_limit_delay)
Self::do_update_network_release_delay(
chain_id,
release_delay,
)
}
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::update_network_block_distance())]
pub fn update_network_block_distance(
origin: OriginFor<T>,
chain_id: T::NetworkId,
block_distance: u64,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_block_distance(chain_id, block_distance)
}
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::update_network_type())]
pub fn update_network_type(
origin: OriginFor<T>,
@ -390,10 +236,13 @@ pub mod module {
network_type: NetworkType,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_type(chain_id, network_type)
Self::do_update_network_type(
chain_id,
network_type,
)
}
#[pallet::call_index(7)]
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::update_network_gatekeeper())]
pub fn update_network_gatekeeper(
origin: OriginFor<T>,
@ -401,10 +250,13 @@ pub mod module {
gatekeeper: Vec<u8>,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_gatekeeper(chain_id, gatekeeper)
Self::do_update_network_gatekeeper(
chain_id,
gatekeeper,
)
}
#[pallet::call_index(8)]
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::update_network_topic_name())]
pub fn update_network_topic_name(
origin: OriginFor<T>,
@ -412,10 +264,13 @@ pub mod module {
topic_name: Vec<u8>,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_network_topic_name(chain_id, topic_name)
Self::do_update_network_topic_name(
chain_id,
topic_name,
)
}
#[pallet::call_index(9)]
#[pallet::call_index(8)]
#[pallet::weight(T::WeightInfo::update_incoming_network_fee())]
pub fn update_incoming_network_fee(
origin: OriginFor<T>,
@ -423,10 +278,13 @@ pub mod module {
incoming_fee: u32,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_incoming_network_fee(chain_id, incoming_fee)
Self::do_update_incoming_network_fee(
chain_id,
incoming_fee,
)
}
#[pallet::call_index(10)]
#[pallet::call_index(9)]
#[pallet::weight(T::WeightInfo::update_outgoing_network_fee())]
pub fn update_outgoing_network_fee(
origin: OriginFor<T>,
@ -434,23 +292,18 @@ pub mod module {
outgoing_fee: u32,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_outgoing_network_fee(chain_id, outgoing_fee)
Self::do_update_outgoing_network_fee(
chain_id,
outgoing_fee,
)
}
#[pallet::call_index(11)]
#[pallet::weight(T::WeightInfo::update_avg_block_speed())]
pub fn update_avg_block_speed(
#[pallet::call_index(10)]
#[pallet::weight(T::WeightInfo::remove_network())]
pub fn remove_network(
origin: OriginFor<T>,
chain_id: T::NetworkId,
avg_block_speed: u64,
) -> DispatchResult {
T::UpdateOrigin::ensure_origin_or_root(origin)?;
Self::do_update_avg_block_speed(chain_id, avg_block_speed)
}
#[pallet::call_index(12)]
#[pallet::weight(T::WeightInfo::remove_network())]
pub fn remove_network(origin: OriginFor<T>, chain_id: T::NetworkId) -> DispatchResult {
T::RemoveOrigin::ensure_origin_or_root(origin)?;
Self::do_remove_network(chain_id)
}
@ -459,29 +312,22 @@ pub mod module {
impl<T: Config> Pallet<T> {
/// Register a new network.
pub fn do_register_network(chain_id: T::NetworkId, network: NetworkData) -> DispatchResult {
pub fn do_register_network(
chain_id: T::NetworkId,
network: NetworkData,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(
maybe_network.is_none(),
Error::<T>::NetworkAlreadyRegistered
);
ensure!(maybe_network.is_none(), Error::<T>::NetworkAlreadyRegistered);
*maybe_network = Some(network.clone());
Ok(())
})?;
NetworkIndexes::<T>::try_mutate(|ids| -> DispatchResult {
ids.try_push(chain_id)
.map_err(|_| Error::<T>::TooManyNetworks)?;
Ok(())
})?;
Self::deposit_event(Event::<T>::NetworkRegistered { chain_id, network });
Ok(())
}
/// Remove existent network.
pub fn do_remove_network(chain_id: T::NetworkId) -> DispatchResult {
NetworkIndexes::<T>::mutate(|ids| ids.retain(|id| id != &chain_id));
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
*maybe_network = None;
@ -493,7 +339,10 @@ impl<T: Config> Pallet<T> {
}
/// Update existent network name.
pub fn do_update_network_name(chain_id: T::NetworkId, chain_name: Vec<u8>) -> DispatchResult {
pub fn do_update_network_name(
chain_id: T::NetworkId,
chain_name: Vec<u8>,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
@ -512,45 +361,26 @@ impl<T: Config> Pallet<T> {
/// Update existent network default endpoint.
pub fn do_update_network_endpoint(
chain_id: T::NetworkId,
maybe_index: Option<u32>,
maybe_endpoint: Option<Vec<u8>>,
default_endpoint: Vec<u8>,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let updated_network = maybe_network.as_mut().unwrap();
match (maybe_index, maybe_endpoint) {
(Some(index), Some(endpoint)) => {
if let Some(previous_endpoint) =
updated_network.default_endpoints.get_mut(index as usize)
{
*previous_endpoint = endpoint.clone();
Self::deposit_event(Event::<T>::NetworkEndpointUpdated {
chain_id,
index,
endpoint,
});
}
}
(None, Some(endpoint)) => {
updated_network.default_endpoints.push(endpoint.clone());
Self::deposit_event(Event::<T>::NetworkEndpointAdded { chain_id, endpoint });
}
(Some(index), None) => {
updated_network.default_endpoints.remove(index as usize);
Self::deposit_event(Event::<T>::NetworkEndpointRemoved { chain_id, index });
}
(None, None) => {}
}
*maybe_network = Some(updated_network.clone());
let net = maybe_network.as_mut().unwrap();
net.default_endpoint = default_endpoint.clone();
*maybe_network = Some(net.clone());
Ok(())
})?;
Self::deposit_event(Event::<T>::NetworkEndpointUpdated {
chain_id,
default_endpoint,
});
Ok(())
}
/// Update existent network default finality delay.
/// Update existent network default endpoint.
pub fn do_update_network_finality_delay(
chain_id: T::NetworkId,
finality_delay: u64,
finality_delay: Option<u64>,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
@ -566,40 +396,21 @@ impl<T: Config> Pallet<T> {
Ok(())
}
/// Update existent network default rate limit delay.
pub fn do_update_network_rate_limit_delay(
/// Update existent network default endpoint.
pub fn do_update_network_release_delay(
chain_id: T::NetworkId,
rate_limit_delay: u64,
release_delay: Option<u64>,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
net.rate_limit_delay = rate_limit_delay;
net.release_delay = release_delay;
*maybe_network = Some(net.clone());
Ok(())
})?;
Self::deposit_event(Event::<T>::NetworkRateLimitDelayUpdated {
Self::deposit_event(Event::<T>::NetworkReleaseDelayUpdated {
chain_id,
rate_limit_delay,
});
Ok(())
}
/// Update existent network default max distance between blocks.
pub fn do_update_network_block_distance(
chain_id: T::NetworkId,
block_distance: u64,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
net.block_distance = block_distance;
*maybe_network = Some(net.clone());
Ok(())
})?;
Self::deposit_event(Event::<T>::NetworkBlockDistanceUpdated {
chain_id,
block_distance,
release_delay,
});
Ok(())
}
@ -612,7 +423,7 @@ impl<T: Config> Pallet<T> {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
net.network_type = network_type;
net.network_type = network_type.clone();
*maybe_network = Some(net.clone());
Ok(())
})?;
@ -628,10 +439,8 @@ impl<T: Config> Pallet<T> {
chain_id: T::NetworkId,
gatekeeper: Vec<u8>,
) -> DispatchResult {
ensure!(
gatekeeper.len() == 42 && gatekeeper[0] == 48 && gatekeeper[1] == 120,
Error::<T>::WrongGatekeeperAddress
);
ensure!(gatekeeper.len() == 42 && gatekeeper[0] == 48 && gatekeeper[1] == 120,
Error::<T>::WrongGatekeeperAddress);
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
@ -651,10 +460,8 @@ impl<T: Config> Pallet<T> {
chain_id: T::NetworkId,
topic_name: Vec<u8>,
) -> DispatchResult {
ensure!(
topic_name.len() == 66 && topic_name[0] == 48 && topic_name[1] == 120,
Error::<T>::WrongTopicName
);
ensure!(topic_name.len() == 66 && topic_name[0] == 48 && topic_name[1] == 120,
Error::<T>::WrongTopicName);
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
@ -676,7 +483,7 @@ impl<T: Config> Pallet<T> {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
net.incoming_fee = incoming_fee;
net.incoming_fee = incoming_fee.clone();
*maybe_network = Some(net.clone());
Ok(())
})?;
@ -694,7 +501,7 @@ impl<T: Config> Pallet<T> {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
net.outgoing_fee = outgoing_fee;
net.outgoing_fee = outgoing_fee.clone();
*maybe_network = Some(net.clone());
Ok(())
})?;
@ -704,24 +511,6 @@ impl<T: Config> Pallet<T> {
});
Ok(())
}
pub fn do_update_avg_block_speed(
chain_id: T::NetworkId,
avg_block_speed: u64,
) -> DispatchResult {
Networks::<T>::try_mutate(&chain_id, |maybe_network| -> DispatchResult {
ensure!(maybe_network.is_some(), Error::<T>::NetworkDoesNotExist);
let net = maybe_network.as_mut().unwrap();
net.avg_block_speed = avg_block_speed;
*maybe_network = Some(net.clone());
Ok(())
})?;
Self::deposit_event(Event::<T>::NetworkAvgBlockSpeedUpdated {
chain_id,
avg_block_speed,
});
Ok(())
}
}
impl<T: Config> NetworkDataBasicHandler for Pallet<T> {
@ -729,43 +518,16 @@ impl<T: Config> NetworkDataBasicHandler for Pallet<T> {
}
impl<T: Config> NetworkDataInspectHandler<NetworkData> for Pallet<T> {
fn count() -> u32 {
NetworkIndexes::<T>::decode_len()
.map(|len| len as u32)
.unwrap_or_default()
}
fn contains_key(n: &Self::NetworkId) -> bool {
Networks::<T>::contains_key(n)
}
fn get(n: &Self::NetworkId) -> Option<NetworkData> {
Networks::<T>::get(n)
}
fn network_for_block(block_number: impl Into<usize>) -> Option<(Self::NetworkId, NetworkData)> {
let network_indexes = NetworkIndexes::<T>::get();
block_number
.into()
.checked_rem(network_indexes.len())
.map(|id| {
network_indexes.get(id).copied().and_then(|network_id| {
Self::get(&network_id).map(|network_data| (network_id, network_data))
})
})
.flatten()
}
fn iter() -> PrefixIterator<(Self::NetworkId, NetworkData)> {
Networks::<T>::iter()
}
fn iter_indexes() -> impl Iterator<Item = Self::NetworkId> {
NetworkIndexes::<T>::get().into_iter()
}
}
impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T> {
impl<T: Config> NetworkDataMutateHandler<NetworkData> for Pallet<T> {
fn register(chain_id: Self::NetworkId, network: NetworkData) -> DispatchResult {
Self::do_register_network(chain_id, network)
}
@ -773,80 +535,4 @@ impl<T: Config> NetworkDataMutateHandler<NetworkData, BalanceOf<T>> for Pallet<T
fn remove(chain_id: Self::NetworkId) -> DispatchResult {
Self::do_remove_network(chain_id)
}
fn increase_gatekeeper_amount(
network_id: &T::NetworkId,
amount: &BalanceOf<T>,
) -> Result<BalanceOf<T>, ()> {
let new_gatekeeper_amount =
GatekeeperAmount::<T>::mutate(network_id, |gatekeeper_amount| match gatekeeper_amount
.checked_add(amount)
{
Some(value) => {
*gatekeeper_amount = value;
Ok(value)
}
None => Err(()),
})?;
Ok(new_gatekeeper_amount)
}
fn decrease_gatekeeper_amount(
network_id: &T::NetworkId,
amount: &BalanceOf<T>,
) -> Result<BalanceOf<T>, ()> {
let new_gatekeeper_amount =
GatekeeperAmount::<T>::mutate(network_id, |gatekeeper_amount| match gatekeeper_amount
.checked_sub(amount)
{
Some(value) => {
*gatekeeper_amount = value;
Ok(value)
}
None => Err(()),
})?;
Ok(new_gatekeeper_amount)
}
fn accumulate_outgoing_imbalance(amount: &BalanceOf<T>) -> Result<BalanceOf<T>, ()> {
let new_bridged_out_amount = BridgedImbalance::<T>::mutate(|bridged_imbalance| {
match bridged_imbalance.bridged_out.checked_add(amount) {
Some(value) => {
(*bridged_imbalance).bridged_out = value;
Ok(value)
}
None => Err(()),
}
})?;
Ok(new_bridged_out_amount)
}
fn accumulate_incoming_imbalance(amount: &BalanceOf<T>) -> Result<BalanceOf<T>, ()> {
let new_bridged_in_amount = BridgedImbalance::<T>::mutate(|bridged_imbalance| {
match bridged_imbalance.bridged_in.checked_add(amount) {
Some(value) => {
(*bridged_imbalance).bridged_in = value;
Ok(value)
}
None => Err(()),
}
})?;
Ok(new_bridged_in_amount)
}
fn accumulate_commission(commission: &BalanceOf<T>) -> Result<BalanceOf<T>, ()> {
AccumulatedCommission::<T>::mutate(|accumulated| {
match accumulated.checked_add(commission) {
Some(value) => {
*accumulated = value;
Ok(value)
}
None => Err(()),
}
})
}
}

View File

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

View File

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

47
pallets/networks/src/mock.rs Normal file → Executable file
View File

@ -1,24 +1,19 @@
use crate::{self as ghost_networks};
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU128, ConstU32, Everything},
};
use crate as ghost_networks;
use frame_system::EnsureSignedBy;
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types, traits::{ConstU128, ConstU32, Everything}
};
pub use primitives::{
AccountId, Balance, BlockNumber, FreezeIdentifier, Hash, Nonce, ReserveIdentifier,
AccountId, Balance, Nonce, BlockNumber, Hash,
ReserveIdentifier, FreezeIdentifier,
};
use sp_runtime::{
curve::PiecewiseLinear,
traits::{AccountIdLookup, BlakeTwo256},
traits::{BlakeTwo256, AccountIdLookup},
BuildStorage,
};
parameter_types! {
pub const BlockHashCount: BlockNumber = 250;
pub static SlashDeferDuration: u32 = 0;
pub static Period: BlockNumber = 5;
pub static Offset: BlockNumber = 0;
pub static MaxControllersInDeprecationBatch: u32 = 5_000;
}
impl frame_system::Config for Test {
@ -69,22 +64,6 @@ impl pallet_balances::Config for Test {
type MaxFreezes = ConstU32<50>;
}
pallet_staking_reward_curve::build! {
const REWARD_CURVE: PiecewiseLinear<'static> = curve!(
min_inflation: 0_006_900,
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! {
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNetworks: u32 = 3;
}
ord_parameter_types! {
pub const RegistererAccount: AccountId = AccountId::from([1u8; 32]);
pub const UpdaterAccount: AccountId = AccountId::from([2u8; 32]);
@ -94,16 +73,14 @@ ord_parameter_types! {
impl ghost_networks::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type NetworkId = u32;
type RegisterOrigin = EnsureSignedBy<RegistererAccount, AccountId>;
type UpdateOrigin = EnsureSignedBy<UpdaterAccount, AccountId>;
type RemoveOrigin = EnsureSignedBy<RemoverAccount, AccountId>;
type MaxNetworks = MaxNetworks;
type WeightInfo = ();
type RegisterOrigin = EnsureSignedBy::<RegistererAccount, AccountId>;
type UpdateOrigin = EnsureSignedBy::<UpdaterAccount, AccountId>;
type RemoveOrigin = EnsureSignedBy::<RemoverAccount, AccountId>;
type WeightInfo = crate::weights::SubstrateWeight<Test>;
}
type Block = frame_system::mocking::MockBlock<Test>;
type Block = frame_system::mocking::MockBlockU32<Test>;
construct_runtime!(
pub enum Test {

1711
pallets/networks/src/tests.rs Normal file → Executable file

File diff suppressed because it is too large Load Diff

387
pallets/networks/src/weights.rs Normal file → Executable file
View File

@ -15,14 +15,14 @@
//! Autogenerated weights for `ghost_networks`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-11-29, 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
//! HOSTNAME: `ghost`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("casper-dev"), DB CACHE: 1024
// Executed Command:
// ./target/release/ghost
// ./target/production/ghost
// benchmark
// pallet
// --chain=casper-dev
@ -30,7 +30,8 @@
// --repeat=20
// --pallet=ghost_networks
// --extrinsic=*
// --heap-pages=4096
// --execution=wasm
// --wasm-execution=compiled
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_networks.rs
@ -48,191 +49,277 @@ use sp_std::marker::PhantomData;
/// Weight functions needed for ghost_networks
pub trait WeightInfo {
fn register_network(i: u32, j: u32, k: u32, ) -> Weight;
fn register_network(n: u32, m: u32, ) -> Weight;
fn update_network_name(n: u32, ) -> Weight;
fn update_network_endpoint(n: u32, ) -> Weight;
fn update_network_finality_delay() -> Weight;
fn update_network_rate_limit_delay() -> Weight;
fn update_network_block_distance() -> Weight;
fn update_network_release_delay() -> Weight;
fn update_network_type() -> Weight;
fn update_network_gatekeeper() -> Weight;
fn update_network_topic_name() -> Weight;
fn update_incoming_network_fee() -> Weight;
fn update_outgoing_network_fee() -> Weight;
fn update_avg_block_speed() -> Weight;
fn remove_network() -> Weight;
}
impl WeightInfo for () {
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `i` is `[1, 20]`.
/// The range of component `j` is `[1, 150]`.
/// The range of component `k` is `[1, 20]`.
fn register_network(_i: u32, j: u32, k: u32, ) -> Weight {
/// Weight for ghost_networks using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
/// The range of component `n` is `[1, 20]`.
/// The range of component `m` is `[1, 150]`.
fn register_network(_n: u32, _m: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 48_419_000 picoseconds.
Weight::from_parts(35_655_823, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 1_212
.saturating_add(Weight::from_parts(96_762, 0).saturating_mul(j.into()))
// Standard Error: 9_235
.saturating_add(Weight::from_parts(1_460_410, 0).saturating_mul(k.into()))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(2))
// Measured: `76`
// Estimated: `2551`
// Minimum execution time: 32_086 nanoseconds.
Weight::from_parts(33_092_855, 2551)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
/// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_422_000 picoseconds.
Weight::from_parts(49_987_541, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_496 nanoseconds.
Weight::from_parts(35_728_230, 2616)
// Standard Error: 2_591
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
/// 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:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_651_000 picoseconds.
Weight::from_parts(50_776_912, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Standard Error: 1_062
.saturating_add(Weight::from_parts(838, 0).saturating_mul(n.into()))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_666 nanoseconds.
Weight::from_parts(35_959_961, 2616)
// Standard Error: 381
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_080_000 picoseconds.
Weight::from_parts(51_781_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 33_860 nanoseconds.
Weight::from_parts(34_995_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_rate_limit_delay() -> Weight {
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_release_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_950_000 picoseconds.
Weight::from_parts(48_925_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 33_860 nanoseconds.
Weight::from_parts(34_995_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_324_000 picoseconds.
Weight::from_parts(50_801_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_type() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 46_962_000 picoseconds.
Weight::from_parts(47_729_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_976 nanoseconds.
Weight::from_parts(36_182_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_728_000 picoseconds.
Weight::from_parts(53_054_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_632_000 picoseconds.
Weight::from_parts(49_954_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_660_000 picoseconds.
Weight::from_parts(53_763_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_164_000 picoseconds.
Weight::from_parts(48_953_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_avg_block_speed() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_789_000 picoseconds.
Weight::from_parts(52_131_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn remove_network() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 49_720_000 picoseconds.
Weight::from_parts(50_526_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(RocksDbWeight::get().writes(2))
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 33_336 nanoseconds.
Weight::from_parts(34_609_000, 2616)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
impl WeightInfo for () {
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
/// The range of component `n` is `[1, 20]`.
/// The range of component `m` is `[1, 150]`.
fn register_network(_n: u32, _m: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `2551`
// Minimum execution time: 32_086 nanoseconds.
Weight::from_parts(33_092_855, 2551)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
/// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_496 nanoseconds.
Weight::from_parts(35_728_230, 2616)
// Standard Error: 2_591
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
/// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(_n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_666 nanoseconds.
Weight::from_parts(35_959_961, 2616)
// Standard Error: 381
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 33_860 nanoseconds.
Weight::from_parts(34_995_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_release_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 33_860 nanoseconds.
Weight::from_parts(34_995_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_type() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_976 nanoseconds.
Weight::from_parts(36_182_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 34_768 nanoseconds.
Weight::from_parts(35_580_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: GhostNetworks Networks (r:1 w:1)
/// Proof Skipped: GhostNetworks Networks (max_values: None, max_size: None, mode: Measured)
fn remove_network() -> Weight {
// Proof Size summary in bytes:
// Measured: `141`
// Estimated: `2616`
// Minimum execution time: 33_336 nanoseconds.
Weight::from_parts(34_609_000, 2616)
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
}

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

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

View File

@ -4,6 +4,12 @@ use super::*;
use frame_benchmarking::v1::*;
use frame_system::RawOrigin;
use frame_support::traits::fungible::{Inspect, Mutate};
use crate::Pallet as SlowClap;
const MAX_CLAPS: u32 = 100;
const MAX_COMPANIONS: u32 = 20;
pub fn create_account<T: Config>() -> T::AccountId {
let account_bytes = Vec::from([1u8; 32]);
@ -11,134 +17,184 @@ pub fn create_account<T: Config>() -> T::AccountId {
.expect("32 bytes always construct an AccountId32")
}
pub fn prepare_evm_network<T: Config>(network_id: NetworkIdOf<T>) {
let network_data = NetworkData {
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_endpoints: vec![b"https://other.endpoint.network.com".to_vec()],
finality_delay: 69,
avg_block_speed: 69,
rate_limit_delay: 69,
block_distance: 69,
network_type: ghost_networks::NetworkType::Evm,
gatekeeper: b"0x4d224452801ACEd8B2F0aebE155379bb5D594381".to_vec(),
topic_name: b"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".to_vec(),
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::NetworkDataHandler::register(network_id, network_data.clone());
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! {
slow_clap {
let network_id = NetworkIdOf::<T>::default();
prepare_evm_network::<T>(network_id);
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 receiver = create_account::<T>();
let amount = minimum_balance + minimum_balance;
let total_amount = (minimum_balance + minimum_balance).saturating_mul(j.into());
}
let session_index = T::ValidatorSet::session_index();
let transaction_hash = H256::repeat_byte(1u8);
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>::set(&session_index, bounded_authorities);
let authority_index = 0u32;
let clap = Clap {
session_index,
authority_index,
transaction_hash,
block_number: 69,
removed: false,
network_id,
receiver: receiver.clone(),
amount,
propose_companion {
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();
// T::NetworkDataHandler::register(network_id.into(), NetworkData {
// chain_name: "Ethereum".into(),
// // https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7/
// default_endpoint:
// "https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14/".into(),
// finality_delay: Some(50),
// release_delay: Some(100),
// 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 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 args_hash = Pallet::<T>::generate_unique_hash(&clap);
let authority_id = authorities
.get(authority_index as usize)
.expect("first authority should exist");
let signature = authority_id.sign(&clap.encode())
.ok_or("couldn't make signature")?;
let empty_bitmap = BitMap::new(1);
DisabledAuthorityIndexes::<T>::insert(session_index, empty_bitmap);
assert_eq!(ApplauseDetails::<T>::get(&session_index, &args_hash).is_none(), true);
}: _(RawOrigin::None, clap, signature)
let _ = <<T as pallet::Config>::Currency>::mint_into(&user_account, balance);
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id);
}: _(RawOrigin::Signed(user_account), network_id.into(), companion)
verify {
assert_eq!(ApplauseDetails::<T>::get(&session_index, &args_hash).is_some(), true);
assert_eq!(<<T as pallet::Config>::Currency>::total_balance(&receiver), amount);
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id + 1);
}
commit_block {
let session_index = T::ValidatorSet::session_index();
let network_id = NetworkIdOf::<T>::default();
prepare_evm_network::<T>(network_id);
release_companion {
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 companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?;
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());
}
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>::set(&session_index, bounded_authorities);
let authority_index = 0u32;
let block_commitment = BlockCommitment {
session_index,
authority_index,
kill_companion {
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 companion_id = create_companions::<T>(1, network_id, user_account.clone(), fee, receiver)?;
SlowClap::<T>::release_companion(
RawOrigin::Signed(user_account.clone()).into(),
network_id,
last_stored_block: 69,
};
let authority_id = authorities
.get(authority_index as usize)
.expect("first authority should exist");
let signature = authority_id.sign(&block_commitment.encode())
.ok_or("couldn't make signature")?;
}: _(RawOrigin::None, block_commitment, signature)
companion_id,
)?;
let block_shift =
<<T as pallet::Config>::NetworkDataHandler as NetworkDataInspectHandler<NetworkData>>::get(&network_id)
.unwrap()
.release_delay
.unwrap();
frame_system::Pallet::<T>::set_block_number((block_shift + 1).saturated_into());
}: _(RawOrigin::Signed(user_account), network_id.into(), companion_id)
verify {
let current_block_number = <Pallet<T> as BlockNumberProvider>::current_block_number();
let stored_commitment = BlockCommitments::<T>::get(&network_id)
.get(&authority_index)
.cloned()
.unwrap_or_default();
assert_eq!(stored_commitment.last_stored_block, 69);
assert_eq!(stored_commitment.commits, 1);
assert_eq!(stored_commitment.last_updated, current_block_number);
}
try_offend_validators {
let n in 1 .. T::MaxAuthorities::get();
let d in 0 .. T::MaxAuthorities::get();
let session_index = T::ValidatorSet::session_index();
let mut validators_vec = Vec::new();
for i in 0..T::MaxAuthorities::get() {
let v = account("validator", i, 0);
validators_vec.push(v);
}
let validators = WeakBoundedVec::<ValidatorId<T>, T::MaxAuthorities>::try_from(validators_vec)
.expect("weak bounded vec should be constructed; qed");
let offence_type = OffenceType::CommitmentOffence;
let disabled_bitmap = BitMap::new(T::MaxAuthorities::get());
let mut offence_bitmap = BitMap::new(T::MaxAuthorities::get());
for i in 0..d {
offence_bitmap.set(i);
}
}: {
let _ = Pallet::<T>::try_offend_validators(
&session_index,
&validators,
offence_bitmap,
disabled_bitmap,
offence_type
);
assert_eq!(SlowClap::<T>::companions(network_id, companion_id), None);
assert_eq!(SlowClap::<T>::companion_details(companion_id), None);
assert_eq!(SlowClap::<T>::current_companion_id(), companion_id + 1);
}
impl_benchmark_test_suite!(

View File

@ -1,117 +0,0 @@
use codec::{Decode, Encode};
use scale_info::TypeInfo;
use sp_core::RuntimeDebug;
use sp_std::collections::btree_map::BTreeMap;
use crate::AuthIndex;
pub type BucketId = u32;
pub type Bucket = u64;
#[derive(Clone, PartialEq, Encode, Decode, RuntimeDebug, TypeInfo)]
pub struct BitMap {
buckets: BTreeMap<BucketId, Bucket>,
max_length: u32,
max_value: u32,
}
impl BitMap {
pub fn new(max_value: u32) -> Self {
let mut buckets: BTreeMap<BucketId, Bucket> = Default::default();
let max_length = (max_value >> Self::size_of_bucket()) + 1;
for bucket_id in 0..(max_length) {
buckets.insert(bucket_id, 0);
}
BitMap {
buckets,
max_length,
max_value,
}
}
pub fn size_of_bucket() -> u32 {
(core::mem::size_of::<Bucket>() * 8).trailing_zeros()
}
pub fn iter_buckets(&self) -> impl Iterator<Item = (&BucketId, &Bucket)> {
self.buckets.iter()
}
pub fn exists(&self, index: &AuthIndex) -> bool {
let (bucket_id, bit_position) = self.bitmap_positions(index);
self.buckets
.get(&bucket_id)
.map(|bucket| (bucket >> bit_position) & 1 == 1)
.unwrap_or_default()
}
pub fn set(&mut self, index: AuthIndex) {
let (bucket_id, bit_position) = self.bitmap_positions(&index);
if bucket_id < self.max_length {
let bucket = self.buckets.entry(bucket_id).or_insert(0);
*bucket |= 1 << bit_position;
}
}
pub fn unset(&mut self, index: AuthIndex) {
let (bucket_id, bit_position) = self.bitmap_positions(&index);
if let Some(bucket) = self.buckets.get_mut(&bucket_id) {
*bucket &= !(1 << bit_position);
if *bucket == 0 {
self.buckets.remove(&bucket_id);
}
}
}
pub fn get_bucket(&self, bucket_id: &BucketId) -> Bucket {
self.buckets.get(bucket_id).copied().unwrap_or_default()
}
pub fn count_ones(&self) -> u32 {
let zeros: u32 = self
.iter_buckets()
.map(|(_, bucket)| bucket.count_zeros())
.sum();
let total_bits = self.total_bits();
total_bits.saturating_sub(zeros)
}
pub fn bitor(self, rhs: Self) -> Self {
let (mut base, to_merge) = if self.buckets.len() < rhs.buckets.len() {
(rhs, self)
} else {
(self, rhs)
};
for (key, rhs_value) in to_merge.buckets {
base.buckets
.entry(key)
.and_modify(|lhs_value| *lhs_value |= rhs_value)
.or_insert(rhs_value);
}
base
}
pub fn max_value(&self) -> u32 {
self.max_value
}
fn total_bits(&self) -> u32 {
let size_of_bucket = Self::size_of_bucket();
let bucket_length: u32 = 1 << size_of_bucket;
self.max_length.saturating_mul(bucket_length)
}
fn bitmap_positions(&self, index: &AuthIndex) -> (u32, u32) {
let size_of_bucket = Self::size_of_bucket();
let bucket_length = 1 << size_of_bucket;
let bucket_id = index >> size_of_bucket;
let bit_position = index % bucket_length;
(bucket_id, bit_position)
}
}

View File

@ -1,57 +0,0 @@
use crate::{Deserialize, Deserializer, Vec, H256};
pub fn de_string_to_bytes<'de, D>(de: D) -> Result<Option<Vec<u8>>, D::Error>
where
D: Deserializer<'de>,
{
let s: &str = Deserialize::deserialize(de)?;
Ok(Some(s.as_bytes().to_vec()))
}
pub fn de_string_to_block_number<'de, D>(de: D) -> Result<Option<u64>, D::Error>
where
D: Deserializer<'de>,
{
let s: &str = Deserialize::deserialize(de)?;
let s = if s.starts_with("0x") { &s[2..] } else { &s };
Ok(u64::from_str_radix(s, 16).ok())
}
pub fn de_string_to_block_number_pure<'de, D>(de: D) -> Result<u64, D::Error>
where
D: Deserializer<'de>,
{
let s: &str = Deserialize::deserialize(de)?;
let s = if s.starts_with("0x") { &s[2..] } else { &s };
Ok(u64::from_str_radix(s, 16).unwrap_or_default())
}
pub fn de_string_to_h256<'de, D>(de: D) -> Result<Option<H256>, D::Error>
where
D: Deserializer<'de>,
{
let s: &str = Deserialize::deserialize(de)?;
let start_index = if s.starts_with("0x") { 2 } else { 0 };
let h256: Vec<_> = (start_index..s.len())
.step_by(2)
.map(|i| u8::from_str_radix(&s[i..i + 2], 16).expect("valid u8 symbol; qed"))
.collect();
Ok(Some(H256::from_slice(&h256)))
}
pub fn de_string_to_vec_of_bytes<'de, D>(de: D) -> Result<Vec<Vec<u8>>, D::Error>
where
D: Deserializer<'de>,
{
let strings: Vec<&str> = Deserialize::deserialize(de)?;
Ok(strings
.iter()
.map(|s| {
let start_index = if s.starts_with("0x") { 2 } else { 0 };
(start_index..s.len())
.step_by(2)
.map(|i| u8::from_str_radix(&s[i..i + 2], 16).expect("valid u8 symbol; qed"))
.collect::<Vec<u8>>()
})
.collect::<Vec<Vec<u8>>>())
}

View File

@ -1,244 +0,0 @@
use sp_runtime::{traits::UniqueSaturatedInto, SaturatedConversion, Saturating};
use sp_staking::SessionIndex;
use crate::{
deserialisations::{
de_string_to_block_number, de_string_to_block_number_pure, de_string_to_bytes,
de_string_to_h256, de_string_to_vec_of_bytes,
},
AuthIndex, BalanceOf, BlockCommitment, BlockCommitments, BlockNumberFor, Call, Clap, Config,
Decode, Deserialize, Encode, ExternalBlockNumber, NetworkIdOf, RuntimeAppPublic, RuntimeDebug,
SubmitTransaction, Vec, BLOCK_COMMITMENT_DELAY, H256, LOG_TARGET,
};
const NUMBER_OF_TOPICS: usize = 3;
#[derive(RuntimeDebug, Clone, PartialEq, Deserialize, Encode, Decode)]
pub struct EvmResponse {
#[serde(default)]
id: Option<u32>,
#[serde(default, deserialize_with = "de_string_to_bytes")]
jsonrpc: Option<Vec<u8>>,
#[serde(default, deserialize_with = "de_string_to_bytes")]
pub error: Option<Vec<u8>>,
#[serde(default)]
pub result: Option<EvmResponseType>,
}
#[derive(RuntimeDebug, Clone, PartialEq, Deserialize, Encode, Decode)]
#[serde(untagged)]
pub enum EvmResponseType {
#[serde(deserialize_with = "de_string_to_block_number_pure")]
BlockNumber(ExternalBlockNumber),
TransactionLogs(Vec<Log>),
}
#[derive(RuntimeDebug, Clone, Eq, PartialEq, Ord, PartialOrd, Deserialize, Encode, Decode)]
#[serde(rename_all = "camelCase")]
pub struct Log {
#[serde(default, deserialize_with = "de_string_to_h256")]
pub transaction_hash: Option<H256>,
#[serde(default, deserialize_with = "de_string_to_block_number")]
pub block_number: Option<ExternalBlockNumber>,
#[serde(default, deserialize_with = "de_string_to_vec_of_bytes")]
pub topics: Vec<Vec<u8>>,
pub removed: bool,
}
impl EvmResponseType {
fn prepare_clap<T: Config>(
&self,
authority_index: AuthIndex,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
log: &Log,
) -> Clap<T::AccountId, NetworkIdOf<T>, BalanceOf<T>> {
Clap {
authority_index,
session_index,
network_id,
removed: log.removed,
receiver: T::AccountId::decode(&mut &log.topics[1][0..32])
.expect("32 bytes always construct an AccountId32"),
amount: u128::from_be_bytes(
log.topics[2][16..32]
.try_into()
.expect("amount is valid hex; qed"),
)
.saturated_into::<BalanceOf<T>>(),
transaction_hash: log.transaction_hash.clone().expect("tx hash exists; qed"),
block_number: log.block_number.expect("block number exists; qed"),
}
}
fn iter_claps_from_logs<T: Config>(
&self,
authority_index: AuthIndex,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
) -> Vec<Clap<T::AccountId, NetworkIdOf<T>, BalanceOf<T>>> {
match self {
EvmResponseType::TransactionLogs(evm_logs) => evm_logs
.iter()
.filter_map(move |log| {
log.is_sufficient().then(|| {
self.prepare_clap::<T>(authority_index, session_index, network_id, log)
})
})
.collect(),
EvmResponseType::BlockNumber(_) => Vec::new(),
}
}
fn sign_and_submit_claps<T: Config>(
&self,
authority_index: AuthIndex,
authority_key: T::AuthorityId,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
) {
let claps = self.iter_claps_from_logs::<T>(authority_index, session_index, network_id);
let claps_len = claps.len();
log::info!(
target: LOG_TARGET,
"👻 Found {:?} claps for network {:?}",
claps_len,
network_id,
);
for (clap_index, clap) in claps.iter().enumerate() {
let signature = match authority_key.sign(&clap.encode()) {
Some(signature) => signature,
None => {
log::info!(
target: LOG_TARGET,
"👻 Clap #{} signing failed from authority #{:?} for network {:?}",
clap_index,
authority_index,
network_id,
);
return;
}
};
let call = Call::slow_clap {
clap: clap.clone(),
signature,
};
if let Err(e) =
SubmitTransaction::<T, Call<T>>::submit_unsigned_transaction(call.into())
{
log::info!(
target: LOG_TARGET,
"👻 Failed to submit clap #{} from authority #{:?} for network {:?}: {:?}",
clap_index,
authority_index,
network_id,
e,
);
}
}
}
fn sign_and_submit_block_commitment<T: Config>(
&self,
block_now: BlockNumberFor<T>,
from_block: ExternalBlockNumber,
authority_index: AuthIndex,
authority_key: T::AuthorityId,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
) {
let block_commitment = BlockCommitment {
session_index,
authority_index,
network_id,
last_stored_block: from_block,
};
let stored_last_updated = BlockCommitments::<T>::get(&network_id)
.get(&authority_index)
.map(|details| {
details
.last_updated
.saturating_add(BLOCK_COMMITMENT_DELAY.unique_saturated_into())
})
.unwrap_or_default();
if block_now < stored_last_updated {
return;
}
log::info!(
target: LOG_TARGET,
"👻 New block commitment from authority #{:?} for network {:?}",
authority_index,
network_id,
);
let signature = match authority_key.sign(&block_commitment.encode()) {
Some(signature) => signature,
None => {
log::info!(
target: LOG_TARGET,
"👻 Block commitment signing failed from authority #{:?} for network {:?}",
authority_index,
network_id,
);
return;
}
};
let call = Call::commit_block {
block_commitment,
signature,
};
if let Err(e) = SubmitTransaction::<T, Call<T>>::submit_unsigned_transaction(call.into()) {
log::info!(
target: LOG_TARGET,
"👻 Failed to submit block commitment from authority #{:?} for network {:?}: {:?}",
authority_index,
network_id,
e,
);
}
}
pub fn sign_and_submit<T: Config>(
&self,
block_now: BlockNumberFor<T>,
from_block: ExternalBlockNumber,
authority_index: AuthIndex,
authority_key: T::AuthorityId,
session_index: SessionIndex,
network_id: NetworkIdOf<T>,
) {
match self {
EvmResponseType::TransactionLogs(_) => self.sign_and_submit_claps::<T>(
authority_index,
authority_key,
session_index,
network_id,
),
EvmResponseType::BlockNumber(_) => self.sign_and_submit_block_commitment::<T>(
block_now,
from_block,
authority_index,
authority_key,
session_index,
network_id,
),
}
}
}
impl Log {
pub fn is_sufficient(&self) -> bool {
self.transaction_hash.is_some()
&& self.block_number.is_some()
&& self.topics.len() == NUMBER_OF_TOPICS
}
}

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -3,24 +3,23 @@
use frame_support::{
derive_impl, parameter_types,
traits::{ConstU32, ConstU64},
weights::Weight,
PalletId,
};
use frame_system::EnsureRoot;
use pallet_session::historical as pallet_session_historical;
use sp_runtime::{
curve::PiecewiseLinear,
testing::{TestXt, UintAuthorityId},
traits::{AtLeast32BitUnsigned, ConvertInto},
Permill,
traits::ConvertInto,
BuildStorage, Permill,
};
use sp_staking::{
offence::{OffenceError, ReportOffence},
SessionIndex,
};
use sp_runtime::BuildStorage;
use crate::{self as slow_clap};
use crate::{Config, ExposureListener};
use crate as slow_clap;
use crate::Config;
type Block = frame_system::mocking::MockBlock<Runtime>;
@ -36,13 +35,17 @@ frame_support::construct_runtime!(
);
parameter_types! {
pub static FixedValidators: Vec<u64> = vec![0, 1, 2, 3];
pub static Validators: Option<Vec<u64>> = Some(vec![
1,
2,
3,
]);
}
pub struct TestSessionManager;
impl pallet_session::SessionManager<u64> for TestSessionManager {
fn new_session(_new_index: SessionIndex) -> Option<Vec<u64>> {
Some(FixedValidators::get())
Validators::mutate(|l| l.take())
}
fn end_session(_: SessionIndex) {}
fn start_session(_: SessionIndex) {}
@ -50,14 +53,20 @@ impl pallet_session::SessionManager<u64> for TestSessionManager {
impl pallet_session::historical::SessionManager<u64, u64> for TestSessionManager {
fn new_session(_new_index: SessionIndex) -> Option<Vec<(u64, u64)>> {
Some(FixedValidators::get().iter().map(|l| (*l, *l)).collect())
Validators::mutate(|l| l
.take()
.map(|validators| validators
.iter()
.map(|v| (*v, *v))
.collect())
)
}
fn end_session(_: SessionIndex) {}
fn start_session(_: SessionIndex) {}
}
type IdentificationTuple = (u64, u64);
type Offence = crate::SlowClapOffence<IdentificationTuple>;
type Offence = crate::ThrottlingOffence<IdentificationTuple>;
parameter_types! {
pub static Offences: Vec<(Vec<u64>, Offence)> = vec![];
@ -75,21 +84,24 @@ 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 {
let t = frame_system::GenesisConfig::<Runtime>::default()
let mut t = frame_system::GenesisConfig::<Runtime>::default()
.build_storage()
.unwrap();
pallet_balances::GenesisConfig::<Runtime> {
balances: vec![ (alice_account_id(), 100) ],
}
.assimilate_storage(&mut t)
.unwrap();
let mut result = sp_io::TestExternalities::new(t);
result.execute_with(|| {
for i in 0..=3 {
System::inc_providers(&i);
assert_eq!(
Session::set_keys(RuntimeOrigin::signed(i), i.into(), vec![],),
Ok(())
);
}
System::set_block_number(1);
});
result
@ -130,36 +142,41 @@ parameter_types! {
parameter_types! {
pub static MockAverageSessionLength: Option<u64> = None;
pub const MaxNetworks: u32 = 5;
}
pub struct TestNextSessionRotation;
impl frame_support::traits::EstimateNextSessionRotation<u64> for TestNextSessionRotation {
fn average_session_length() -> u64 {
let mock = MockAverageSessionLength::mutate(|p| p.take());
mock.unwrap_or(pallet_session::PeriodicSessions::<Period, Offset>::average_session_length())
}
fn estimate_current_session_progress(now: u64) -> (Option<Permill>, Weight) {
let (estimate, weight) =
pallet_session::PeriodicSessions::<Period, Offset>::estimate_current_session_progress(
now,
);
let mock = MockCurrentSessionProgress::mutate(|p| p.take());
(mock.unwrap_or(estimate), weight)
}
fn estimate_next_session_rotation(now: u64) -> (Option<u64>, Weight) {
pallet_session::PeriodicSessions::<Period, Offset>::estimate_next_session_rotation(now)
}
}
impl ghost_networks::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type NetworkId = u32;
type RegisterOrigin = EnsureRoot<Self::AccountId>;
type UpdateOrigin = EnsureRoot<Self::AccountId>;
type RemoveOrigin = EnsureRoot<Self::AccountId>;
type MaxNetworks = MaxNetworks;
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! {
pub static ExistentialDeposit: u64 = 2;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const HistoryDepth: u32 = 10;
pub const EpochDuration: u64 = 80;
pub const TreasuryPalletId: PalletId = PalletId(*b"mck/test");
}
#[derive_impl(pallet_balances::config_preludes::TestDefaultConfig)]
@ -170,66 +187,35 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = ();
}
type Balance = u64;
pub struct TestExposureListener;
impl ExposureListener<Balance, u64> for TestExposureListener
where
Balance: AtLeast32BitUnsigned + From<u64>,
{
fn get_accounts_by_indexes(
indexes_iterator: impl Iterator<Item = usize>,
) -> sp_std::prelude::Vec<u64> {
let all_validators = FixedValidators::get();
indexes_iterator
.filter_map(|i| all_validators.get(i).copied())
.collect()
}
fn get_account_by_index(index: usize) -> Option<u64> {
FixedValidators::get().get(index).copied()
}
fn get_total_exposure() -> Balance {
1_000_000_000u64.into()
}
fn get_validator_exposure(validator: &u64) -> Balance {
match validator {
0 => 250_000_000u64,
1 => 200_000_000u64,
2 => 250_000_000u64,
3 => 300_000_000u64,
_ => 0,
}
.into()
}
}
impl Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = UintAuthorityId;
type NextSessionRotation = TestNextSessionRotation;
type ValidatorSet = Historical;
type Currency = Balances;
type NetworkDataHandler = Networks;
type BlockNumberProvider = System;
type ReportUnresponsiveness = OffenceHandler;
type DisabledValidators = Session;
type ExposureListener = TestExposureListener;
type MaxAuthorities = ConstU32<5>;
type ApplauseThreshold = ConstU32<500_000_000>;
type MaxNumberOfClaps = ConstU32<100>;
type ApplauseThreshold = ConstU32<0>;
type MaxAuthorityInfoInSession = ConstU32<5_000>;
type OffenceThreshold = ConstU32<40>;
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
type HistoryDepth = HistoryDepth;
type MinAuthoritiesNumber = ConstU32<1>;
type EpochDuration = EpochDuration;
type TreasuryPalletId = TreasuryPalletId;
type WeightInfo = ();
}
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
where
RuntimeCall: From<LocalCall>,
@ -238,11 +224,30 @@ where
type Extrinsic = Extrinsic;
}
pub fn advance_session() {
let now = System::block_number().max(1);
System::set_block_number(now + 1);
Session::rotate_session();
// impl<LocalCall> frame_system::offchain::CreateSignedTransaction<LocalCall> for Runtime
// where
// RuntimeCall: From<LocalCall>,
// {
// fn create_transaction<C: frame_system::offchain::AppCrypto<Self::Public, Self::Signature>>(
// call: Self::OverarchingCall,
// _public: Self::Public,
// _account: Self::AccountId,
// nonce: Self::Nonce,
// ) -> Option<(RuntimeCall, <Extrinsic as ExtrinsicT>::SignaturePayload)> {
// Some((call, (nonce.into(), ())))
// }
// }
let session_index = Session::current_index();
assert_eq!(session_index, (now / Period::get()) as u32);
}
// pub fn advance_session() {
// let now = System::block_number().max(1);
// System::set_block_number(now + 1);
// Session::rotate_session();
//
// let authorities = Session::validators()
// .into_iter()
// .map(UintAuthorityId)
// .collect();
//
// SlowClap::set_authorities(authorities);
// assert_eq!(Session::current_index(), (now / Period::get()) as u32);
// }

File diff suppressed because it is too large Load Diff

View File

@ -1,150 +1,18 @@
// 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: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/release/ghost
// benchmark
// pallet
// --chain=casper-dev
// --steps=50
// --repeat=20
// --pallet=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;
use frame_support::weights::Weight;
pub trait WeightInfo {
fn slow_clap() -> Weight;
fn commit_block()-> Weight;
fn try_offend_validators(validators_len: u32, offenders_len: u32) -> Weight;
fn slow_clap(claps_len: u32, companions_len: u32) -> Weight;
fn propose_companion() -> Weight;
fn release_companion() -> Weight;
fn kill_companion() -> Weight;
}
impl WeightInfo for () {
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:1)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplauseDetails` (r:1 w:1)
/// Proof: `GhostSlowClaps::ApplauseDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
/// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::DisabledAuthorityIndexes` (r:1 w:0)
/// Proof: `GhostSlowClaps::DisabledAuthorityIndexes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::TotalExposure` (r:1 w:0)
/// Proof: `GhostSlowClaps::TotalExposure` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:1 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `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: `1417`
// Estimated: `4882`
// Minimum execution time: 305_397_000 picoseconds.
Weight::from_parts(310_207_000, 0)
.saturating_add(Weight::from_parts(0, 4882))
.saturating_add(RocksDbWeight::get().reads(13))
.saturating_add(RocksDbWeight::get().writes(6))
}
/// Storage: `Session::CurrentIndex` (r:1 w:0)
/// Proof: `Session::CurrentIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:0)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::BlockCommitments` (r:1 w:1)
/// Proof: `GhostSlowClaps::BlockCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn commit_block() -> Weight {
// Proof Size summary in bytes:
// Measured: `701`
// Estimated: `4166`
// Minimum execution time: 88_007_000 picoseconds.
Weight::from_parts(89_662_000, 0)
.saturating_add(Weight::from_parts(0, 4166))
.saturating_add(RocksDbWeight::get().reads(4))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `Staking::ActiveEra` (r:1 w:0)
/// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:100000 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakers` (r:100000 w:0)
/// Proof: `Staking::ErasStakers` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Offences::ConcurrentReportsIndex` (r:1 w:1)
/// Proof: `Offences::ConcurrentReportsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Offences::Reports` (r:97959 w:97959)
/// Proof: `Offences::Reports` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashRewardFraction` (r:1 w:0)
/// Proof: `Staking::SlashRewardFraction` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `Staking::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `Staking::Invulnerables` (r:1 w:0)
/// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashingSpans` (r:97959 w:97959)
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::DisabledValidators` (r:1 w:1)
/// Proof: `Staking::DisabledValidators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 100000]`.
/// The range of component `d` is `[0, 100000]`.
fn try_offend_validators(n: u32, d: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `674`
// Estimated: `1886 + d * (2567 ±0)`
// Minimum execution time: 13_294_008_000 picoseconds.
Weight::from_parts(13_307_595_000, 0)
.saturating_add(Weight::from_parts(0, 1886))
// Standard Error: 1_146_439
.saturating_add(Weight::from_parts(29_632_292, 0).saturating_mul(n.into()))
// Standard Error: 1_146_441
.saturating_add(Weight::from_parts(14_654_685, 0).saturating_mul(d.into()))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(RocksDbWeight::get().reads((2_u64).saturating_mul(d.into())))
.saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2567).saturating_mul(d.into()))
}
fn slow_clap(
_claps_len: u32,
_companions_len: u32,
) -> Weight { Weight::zero() }
fn propose_companion() -> Weight { Weight::zero() }
fn release_companion() -> Weight { Weight::zero() }
fn kill_companion() -> Weight { Weight::zero() }
}

View File

@ -1,45 +0,0 @@
[package]
name = "ghost-sudo"
version = "0.0.2"
description = "Port of the sudo pallet because of dependencies issue"
license.workspace = true
authors.workspace = true
edition.workspace = true
homepage.workspace = true
repository.workspace = true
[dependencies]
docify = "0.2.8"
codec = { workspace = true, features = ["derive"] }
frame-benchmarking = { workspace = true, optional = true }
scale-info = { workspace = true, features = ["derive"] }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }
[features]
default = ["std"]
std = [
"codec/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"scale-info/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
]

View File

@ -1,77 +0,0 @@
use super::*;
use crate::Pallet;
use frame_benchmarking::v2::*;
use frame_system::RawOrigin;
fn assert_last_event<T: Config>(generic_event: crate::Event<T>) {
let re: <T as Config>::RuntimeEvent = generic_event.into();
frame_system::Pallet::<T>::assert_last_event(re.into());
}
#[benchmarks(where <T as Config>::RuntimeCall: From<frame_system::Call<T>>)]
mod benchmarks {
use super::*;
#[benchmark]
fn set_key() {
let caller: T::AccountId = whitelisted_caller();
Key::<T>::put(&caller);
let new_sudoer: T::AccountId = account("sudoer", 0, 0);
let new_sudoer_lookup = T::Lookup::unlookup(new_sudoer.clone());
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), new_sudoer_lookup);
assert_last_event::<T>(Event::KeyChanged {
old: Some(caller),
new: new_sudoer,
});
}
#[benchmark]
fn sudo() {
let caller: T::AccountId = whitelisted_caller();
Key::<T>::put(&caller);
let call = frame_system::Call::remark { remark: vec![] }.into();
#[extrinsic_call]
_(RawOrigin::Signed(caller), Box::new(call));
assert_last_event::<T>(Event::Sudid {
sudo_result: Ok(()),
})
}
#[benchmark]
fn sudo_as() {
let caller: T::AccountId = whitelisted_caller();
Key::<T>::put(caller.clone());
let call = frame_system::Call::remark { remark: vec![] }.into();
let who: T::AccountId = account("as", 0, 0);
let who_lookup = T::Lookup::unlookup(who);
#[extrinsic_call]
_(RawOrigin::Signed(caller), who_lookup, Box::new(call));
assert_last_event::<T>(Event::SudoAsDone {
sudo_result: Ok(()),
})
}
#[benchmark]
fn remove_key() {
let caller: T::AccountId = whitelisted_caller();
Key::<T>::put(&caller);
#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()));
assert_last_event::<T>(Event::KeyRemoved {});
}
impl_benchmark_test_suite!(Pallet, crate::mock::new_bench_ext(), crate::mock::Test);
}

View File

@ -1,82 +0,0 @@
use crate::{Config, Key};
use codec::{Decode, Encode};
use frame_support::{dispatch::DispatchInfo, ensure};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{DispatchInfoOf, Dispatchable, SignedExtension},
transaction_validity::{
InvalidTransaction, TransactionPriority, TransactionValidity, TransactionValidityError,
UnknownTransaction, ValidTransaction,
},
};
use sp_std::{fmt, marker::PhantomData};
#[derive(Clone, Eq, PartialEq, Encode, Decode, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct CheckOnlySudoAccount<T: Config + Send + Sync>(PhantomData<T>);
impl<T: Config + Send + Sync> Default for CheckOnlySudoAccount<T> {
fn default() -> Self {
Self(Default::default())
}
}
impl<T: Config + Send + Sync> fmt::Debug for CheckOnlySudoAccount<T> {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "CheckOnlySudoAccount")
}
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
Ok(())
}
}
impl<T: Config + Send + Sync> CheckOnlySudoAccount<T> {
/// Creates new `SignedExtension` to check sudo key.
pub fn new() -> Self {
Self::default()
}
}
impl<T: Config + Send + Sync> SignedExtension for CheckOnlySudoAccount<T>
where
<T as Config>::RuntimeCall: Dispatchable<Info = DispatchInfo>,
{
const IDENTIFIER: &'static str = "CheckOnlySudoAccount";
type AccountId = T::AccountId;
type Call = <T as Config>::RuntimeCall;
type AdditionalSigned = ();
type Pre = ();
fn additional_signed(&self) -> Result<Self::AdditionalSigned, TransactionValidityError> {
Ok(())
}
fn validate(
&self,
who: &Self::AccountId,
_call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
_len: usize,
) -> TransactionValidity {
let sudo_key: T::AccountId = Key::<T>::get().ok_or(UnknownTransaction::CannotLookup)?;
ensure!(*who == sudo_key, InvalidTransaction::BadSigner);
Ok(ValidTransaction {
priority: info.weight.ref_time() as TransactionPriority,
..Default::default()
})
}
fn pre_dispatch(
self,
who: &Self::AccountId,
call: &Self::Call,
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> Result<Self::Pre, TransactionValidityError> {
self.validate(who, call, info, len).map(|_| ())
}
}

View File

@ -1,212 +0,0 @@
#![cfg_attr(not(feature = "std"), no_std)]
use sp_runtime::{traits::StaticLookup, DispatchResult};
use sp_std::prelude::*;
use frame_support::{dispatch::GetDispatchInfo, traits::UnfilteredDispatchable};
mod extension;
#[cfg(test)]
mod mock;
#[cfg(test)]
mod tests;
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
pub mod weights;
pub use weights::WeightInfo;
pub use extension::CheckOnlySudoAccount;
pub use pallet::*;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
#[frame_support::pallet]
pub mod pallet {
use super::{DispatchResult, *};
use frame_support::pallet_prelude::*;
use frame_system::{pallet_prelude::*, RawOrigin};
pub mod config_preludes {
use super::*;
use frame_support::derive_impl;
pub struct TestDefaultConfig;
#[derive_impl(frame_system::config_preludes::TestDefaultConfig, no_aggregated_types)]
impl frame_system::DefaultConfig for TestDefaultConfig {}
#[frame_support::register_default_impl(TestDefaultConfig)]
impl DefaultConfig for TestDefaultConfig {
type WeightInfo = ();
#[inject_runtime_type]
type RuntimeEvent = ();
#[inject_runtime_type]
type RuntimeCall = ();
}
}
#[pallet::config(with_default)]
pub trait Config: frame_system::Config {
#[pallet::no_default_bounds]
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
#[pallet::no_default_bounds]
type RuntimeCall: Parameter
+ UnfilteredDispatchable<RuntimeOrigin = Self::RuntimeOrigin>
+ GetDispatchInfo;
type WeightInfo: WeightInfo;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight({
let dispatch_info = call.get_dispatch_info();
(
T::WeightInfo::sudo().saturating_add(dispatch_info.weight),
dispatch_info.class
)
})]
pub fn sudo(
origin: OriginFor<T>,
call: Box<<T as Config>::RuntimeCall>,
) -> DispatchResultWithPostInfo {
Self::ensure_sudo(origin)?;
let res = call.dispatch_bypass_filter(RawOrigin::Root.into());
Self::deposit_event(Event::Sudid {
sudo_result: res.map(|_| ()).map_err(|e| e.error),
});
Ok(Pays::No.into())
}
#[pallet::call_index(1)]
#[pallet::weight((*weight, call.get_dispatch_info().class))]
pub fn sudo_unchecked_weight(
origin: OriginFor<T>,
call: Box<<T as Config>::RuntimeCall>,
weight: Weight,
) -> DispatchResultWithPostInfo {
Self::ensure_sudo(origin)?;
let _ = weight;
let res = call.dispatch_bypass_filter(RawOrigin::Root.into());
Self::deposit_event(Event::Sudid {
sudo_result: res.map(|_| ()).map_err(|e| e.error),
});
Ok(Pays::No.into())
}
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::set_key())]
pub fn set_key(
origin: OriginFor<T>,
new: AccountIdLookupOf<T>,
) -> DispatchResultWithPostInfo {
Self::ensure_sudo(origin)?;
let new = T::Lookup::lookup(new)?;
Self::deposit_event(Event::KeyChanged {
old: Key::<T>::get(),
new: new.clone(),
});
Key::<T>::put(new);
Ok(Pays::No.into())
}
#[pallet::call_index(3)]
#[pallet::weight({
let dispatch_info = call.get_dispatch_info();
(
T::WeightInfo::sudo_as().saturating_add(dispatch_info.weight),
dispatch_info.class,
)
})]
pub fn sudo_as(
origin: OriginFor<T>,
who: AccountIdLookupOf<T>,
call: Box<<T as Config>::RuntimeCall>,
) -> DispatchResultWithPostInfo {
Self::ensure_sudo(origin)?;
let who = T::Lookup::lookup(who)?;
let res = call.dispatch_bypass_filter(RawOrigin::Signed(who).into());
Self::deposit_event(Event::SudoAsDone {
sudo_result: res.map(|_| ()).map_err(|e| e.error),
});
Ok(Pays::No.into())
}
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::remove_key())]
pub fn remove_key(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
Self::ensure_sudo(origin)?;
Self::deposit_event(Event::KeyRemoved {});
Key::<T>::kill();
Ok(Pays::No.into())
}
}
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
Sudid {
sudo_result: DispatchResult,
},
KeyChanged {
old: Option<T::AccountId>,
new: T::AccountId,
},
KeyRemoved,
SudoAsDone {
sudo_result: DispatchResult,
},
}
#[pallet::error]
pub enum Error<T> {
RequireSudo,
}
#[pallet::storage]
pub(super) type Key<T: Config> = StorageValue<_, T::AccountId, OptionQuery>;
#[pallet::genesis_config]
#[derive(frame_support::DefaultNoBound)]
pub struct GenesisConfig<T: Config> {
pub key: Option<T::AccountId>,
}
#[pallet::genesis_build]
impl<T: Config> BuildGenesisConfig for GenesisConfig<T> {
fn build(&self) {
Key::<T>::set(self.key.clone());
}
}
impl<T: Config> Pallet<T> {
pub(crate) fn ensure_sudo(origin: OriginFor<T>) -> DispatchResult {
let sender = ensure_signed_or_root(origin)?;
if let Some(sender) = sender {
if Key::<T>::get().map_or(false, |k| k == sender) {
Ok(())
} else {
Err(Error::<T>::RequireSudo.into())
}
} else {
Ok(())
}
}
}
}

View File

@ -1,127 +0,0 @@
use super::*;
use crate as sudo;
use frame_support::derive_impl;
use sp_io;
use sp_runtime::BuildStorage;
#[frame_support::pallet]
pub mod logger {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
#[pallet::config]
pub trait Config: frame_system::Config {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(*weight)]
pub fn privileged_i32_log(
origin: OriginFor<T>,
i: i32,
weight: Weight,
) -> DispatchResultWithPostInfo {
ensure_root(origin)?;
<I32Log<T>>::try_append(i).map_err(|_| "could not append")?;
Self::deposit_event(Event::AppendI32 { value: i, weight });
Ok(().into())
}
#[pallet::call_index(1)]
#[pallet::weight(*weight)]
pub fn non_privileged_log(
origin: OriginFor<T>,
i: i32,
weight: Weight,
) -> DispatchResultWithPostInfo {
let sender = ensure_signed(origin)?;
<I32Log<T>>::try_append(i).map_err(|_| "could not append")?;
<AccountLog<T>>::try_append(sender.clone()).map_err(|_| "could not append")?;
Self::deposit_event(Event::AppendI32AndAccount {
sender,
value: i,
weight,
});
Ok(().into())
}
}
#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
AppendI32 {
value: i32,
weight: Weight,
},
AppendI32AndAccount {
sender: T::AccountId,
value: i32,
weight: Weight,
},
}
#[pallet::storage]
#[pallet::getter(fn account_log)]
pub(super) type AccountLog<T: Config> =
StorageValue<_, BoundedVec<T::AccountId, ConstU32<1_000>>, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn i32_log)]
pub(super) type I32Log<T> = StorageValue<_, BoundedVec<i32, ConstU32<1_000>>, ValueQuery>;
}
type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test
{
System: frame_system,
Sudo: sudo,
Logger: logger,
}
);
#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Test {
type Block = Block;
}
impl logger::Config for Test {
type RuntimeEvent = RuntimeEvent;
}
impl Config for Test {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = ();
}
pub type SudoCall = sudo::Call<Test>;
pub type LoggerCall = logger::Call<Test>;
pub fn new_test_ext(root_key: u64) -> sp_io::TestExternalities {
let mut t = frame_system::GenesisConfig::<Test>::default()
.build_storage()
.unwrap();
sudo::GenesisConfig::<Test> {
key: Some(root_key),
}
.assimilate_storage(&mut t)
.unwrap();
let mut ext: sp_io::TestExternalities = t.into();
ext.execute_with(|| System::set_block_number(1));
ext
}
#[cfg(feature = "runtime-benchmarks")]
pub fn new_bench_ext() -> sp_io::TestExternalities {
frame_system::GenesisConfig::<Test>::default()
.build_storage()
.unwrap()
.into()
}

View File

@ -1,217 +0,0 @@
use super::*;
use frame_support::{assert_noop, assert_ok, weights::Weight};
use mock::{
new_test_ext, Logger, LoggerCall, RuntimeCall, RuntimeEvent as TestEvent, RuntimeOrigin, Sudo,
SudoCall, System, Test,
};
#[test]
fn test_setup_works() {
new_test_ext(1).execute_with(|| {
assert_eq!(Key::<Test>::get(), Some(1u64));
assert!(Logger::i32_log().is_empty());
assert!(Logger::account_log().is_empty());
});
}
#[docify::export]
#[test]
fn sudo_basics() {
new_test_ext(1).execute_with(|| {
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1_000, 0),
}));
assert_ok!(Sudo::sudo(RuntimeOrigin::signed(1), call));
assert_eq!(Logger::i32_log(), vec![42i32]);
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1_000, 0),
}));
assert_noop!(
Sudo::sudo(RuntimeOrigin::signed(2), call),
Error::<Test>::RequireSudo
);
});
}
#[test]
fn sudo_emits_events_correctly() {
new_test_ext(1).execute_with(|| {
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1, 0),
}));
assert_ok!(Sudo::sudo(RuntimeOrigin::signed(1), call));
System::assert_has_event(TestEvent::Sudo(Event::Sudid {
sudo_result: Ok(()),
}));
})
}
#[test]
fn sudo_unchecked_weight_basics() {
new_test_ext(1).execute_with(|| {
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1_000, 0),
}));
assert_ok!(Sudo::sudo_unchecked_weight(
RuntimeOrigin::signed(1),
call,
Weight::from_parts(1_000, 0)
));
assert_eq!(Logger::i32_log(), vec![42i32]);
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1_000, 0),
}));
assert_noop!(
Sudo::sudo_unchecked_weight(
RuntimeOrigin::signed(2),
call,
Weight::from_parts(1_000, 0)
),
Error::<Test>::RequireSudo,
);
assert_eq!(Logger::i32_log(), vec![42i32]);
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1, 0),
}));
let sudo_unchecked_weight_call = SudoCall::sudo_unchecked_weight {
call,
weight: Weight::from_parts(1_000, 0),
};
let info = sudo_unchecked_weight_call.get_dispatch_info();
assert_eq!(info.weight, Weight::from_parts(1_000, 0));
});
}
#[test]
fn sudo_unchecked_weight_emits_events_correctly() {
new_test_ext(1).execute_with(|| {
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1, 0),
}));
assert_ok!(Sudo::sudo_unchecked_weight(
RuntimeOrigin::signed(1),
call,
Weight::from_parts(1_000, 0)
));
System::assert_has_event(TestEvent::Sudo(Event::Sudid {
sudo_result: Ok(()),
}));
})
}
#[docify::export]
#[test]
fn set_key_basics() {
new_test_ext(1).execute_with(|| {
assert_ok!(Sudo::set_key(RuntimeOrigin::signed(1), 2));
assert_eq!(Key::<Test>::get(), Some(2u64));
});
new_test_ext(1).execute_with(|| {
assert_noop!(
Sudo::set_key(RuntimeOrigin::signed(2), 3),
Error::<Test>::RequireSudo
);
});
}
#[test]
fn set_key_emits_events_correctly() {
new_test_ext(1).execute_with(|| {
assert_ok!(Sudo::set_key(RuntimeOrigin::signed(1), 2));
System::assert_has_event(TestEvent::Sudo(Event::KeyChanged {
old: Some(1),
new: 2,
}));
assert_ok!(Sudo::set_key(RuntimeOrigin::signed(2), 4));
System::assert_has_event(TestEvent::Sudo(Event::KeyChanged {
old: Some(2),
new: 4,
}));
});
}
#[test]
fn remove_key_works() {
new_test_ext(1).execute_with(|| {
assert_ok!(Sudo::remove_key(RuntimeOrigin::signed(1)));
assert!(Key::<Test>::get().is_none());
System::assert_has_event(TestEvent::Sudo(Event::KeyRemoved {}));
assert_noop!(
Sudo::remove_key(RuntimeOrigin::signed(1)),
Error::<Test>::RequireSudo
);
assert_noop!(
Sudo::set_key(RuntimeOrigin::signed(1), 1),
Error::<Test>::RequireSudo
);
});
}
#[test]
fn using_root_origin_works() {
new_test_ext(1).execute_with(|| {
assert_ok!(Sudo::remove_key(RuntimeOrigin::root()));
assert!(Key::<Test>::get().is_none());
System::assert_has_event(TestEvent::Sudo(Event::KeyRemoved {}));
assert_ok!(Sudo::set_key(RuntimeOrigin::root(), 1));
assert_eq!(Some(1), Key::<Test>::get());
});
}
#[test]
fn sudo_as_basics() {
new_test_ext(1).execute_with(|| {
let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log {
i: 42,
weight: Weight::from_parts(1_000, 0),
}));
assert_ok!(Sudo::sudo_as(RuntimeOrigin::signed(1), 2, call));
assert!(Logger::i32_log().is_empty());
assert!(Logger::account_log().is_empty());
let call = Box::new(RuntimeCall::Logger(LoggerCall::non_privileged_log {
i: 42,
weight: Weight::from_parts(1, 0),
}));
assert_noop!(
Sudo::sudo_as(RuntimeOrigin::signed(3), 2, call),
Error::<Test>::RequireSudo
);
let call = Box::new(RuntimeCall::Logger(LoggerCall::non_privileged_log {
i: 42,
weight: Weight::from_parts(1, 0),
}));
assert_ok!(Sudo::sudo_as(RuntimeOrigin::signed(1), 2, call));
assert_eq!(Logger::i32_log(), vec![42i32]);
assert_eq!(Logger::account_log(), vec![2]);
});
}
#[docify::export]
#[test]
fn sudo_as_emits_events_correctly() {
new_test_ext(1).execute_with(|| {
let call = Box::new(RuntimeCall::Logger(LoggerCall::non_privileged_log {
i: 42,
weight: Weight::from_parts(1, 0),
}));
assert_ok!(Sudo::sudo_as(RuntimeOrigin::signed(1), 2, call));
System::assert_has_event(TestEvent::Sudo(Event::SudoAsDone {
sudo_result: Ok(()),
}));
});
}

View File

@ -1,156 +0,0 @@
// This file is part of Ghost Network.
// Ghost Network is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Ghost Network. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `ghost_sudo`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-07-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/release/ghost
// benchmark
// pallet
// --chain=casper-dev
// --steps=50
// --repeat=20
// --pallet=ghost-sudo
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_sudo.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 `pallet_sudo`.
pub trait WeightInfo {
fn set_key() -> Weight;
fn sudo() -> Weight;
fn sudo_as() -> Weight;
fn remove_key() -> Weight;
}
/// Weight functions for `ghost_sudo`.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// Storage: `GhostSudo::Key` (r:1 w:1)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn set_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 40_014_000 picoseconds.
Weight::from_parts(40_856_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:0)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn sudo() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 44_086_000 picoseconds.
Weight::from_parts(45_920_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:0)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn sudo_as() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 44_106_000 picoseconds.
Weight::from_parts(44_650_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:1)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn remove_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 36_416_000 picoseconds.
Weight::from_parts(37_373_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}
// For backwards compatibility and tests.
impl WeightInfo for () {
/// Storage: `GhostSudo::Key` (r:1 w:1)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn set_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 40_014_000 picoseconds.
Weight::from_parts(40_856_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:0)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn sudo() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 44_086_000 picoseconds.
Weight::from_parts(45_920_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(RocksDbWeight::get().reads(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:0)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn sudo_as() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 44_106_000 picoseconds.
Weight::from_parts(44_650_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(RocksDbWeight::get().reads(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:1)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn remove_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 36_416_000 picoseconds.
Weight::from_parts(37_373_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(RocksDbWeight::get().reads(1))
.saturating_add(RocksDbWeight::get().writes(1))
}
}

4
pallets/traits/Cargo.toml Normal file → Executable file
View File

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

View File

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

1
pallets/traits/src/lib.rs Normal file → Executable file
View File

@ -1,4 +1,3 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub mod exposure;
pub mod networks;

26
pallets/traits/src/networks.rs Normal file → Executable file
View File

@ -1,7 +1,10 @@
use frame_support::{pallet_prelude::*, storage::PrefixIterator};
use frame_support::{
pallet_prelude::*,
storage::PrefixIterator,
};
use sp_runtime::{
traits::{AtLeast32BitUnsigned, Member},
DispatchResult,
traits::{AtLeast32BitUnsigned, Member},
};
pub trait NetworkDataBasicHandler {
@ -16,28 +19,11 @@ pub trait NetworkDataBasicHandler {
}
pub trait NetworkDataInspectHandler<Network>: NetworkDataBasicHandler {
fn count() -> u32;
fn contains_key(n: &Self::NetworkId) -> bool;
fn network_for_block(b: impl Into<usize>) -> Option<(Self::NetworkId, Network)>;
fn get(n: &Self::NetworkId) -> Option<Network>;
fn iter() -> PrefixIterator<(Self::NetworkId, Network)>;
fn iter_indexes() -> impl Iterator<Item = Self::NetworkId>;
}
pub trait NetworkDataMutateHandler<Network, Balance>: NetworkDataInspectHandler<Network> {
pub trait NetworkDataMutateHandler<Network>: NetworkDataInspectHandler<Network> {
fn register(chain_id: Self::NetworkId, network: Network) -> DispatchResult;
fn remove(chain_id: Self::NetworkId) -> DispatchResult;
fn increase_gatekeeper_amount(
chain_id: &Self::NetworkId,
amount: &Balance,
) -> Result<Balance, ()>;
fn decrease_gatekeeper_amount(
chain_id: &Self::NetworkId,
amount: &Balance,
) -> Result<Balance, ()>;
fn accumulate_outgoing_imbalance(amount: &Balance) -> Result<Balance, ()>;
fn accumulate_incoming_imbalance(amount: &Balance) -> Result<Balance, ()>;
fn accumulate_commission(commission: &Balance) -> Result<Balance, ()>;
}

0
rpc/Cargo.toml Normal file → Executable file
View File

56
rpc/src/lib.rs Normal file → Executable file
View File

@ -1,15 +1,17 @@
use std::sync::Arc;
use babe_primitives::BabeApi;
use block_builder_api::BlockBuilder;
use consensus_common::SelectChain;
use grandpa::FinalityProofProvider;
use jsonrpsee::RpcModule;
use primitives::{AccountId, Balance, Block, BlockNumber, Hash, Nonce};
use primitives::{
AccountId, Balance, Block, BlockNumber, Hash, Nonce,
};
use sc_client_api::AuxStore;
use grandpa::FinalityProofProvider;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
use sp_api::ProvideRuntimeApi;
use block_builder_api::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
use consensus_common::SelectChain;
use babe_primitives::BabeApi;
use sp_keystore::KeystorePtr;
use tx_pool_api::TransactionPool;
@ -59,16 +61,7 @@ pub struct FullDeps<C, P, SC, B> {
}
pub fn create_full_rpc<C, P, SC, B>(
FullDeps {
client,
pool,
select_chain,
chain_spec,
deny_unsafe,
babe,
grandpa,
backend,
}: FullDeps<C, P, SC, B>,
FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, backend } : FullDeps<C, P, SC, B>,
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block>
@ -87,19 +80,20 @@ where
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
B::State: sc_client_api::StateBackend<sp_runtime::traits::HashingFor<Block>>,
{
use babe_rpc::{Babe, BabeApiServer};
use frame_rpc_system::{System, SystemApiServer};
use pallet_transaction_payment_rpc::{
TransactionPayment, TransactionPaymentApiServer,
};
use babe_rpc::{Babe, BabeApiServer};
use grandpa_rpc::{Grandpa, GrandpaApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer};
use sc_sync_state_rpc::{SyncState, SyncStateApiServer};
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
use substrate_state_trie_migration_rpc::{
StateMigration, StateMigrationApiServer,
};
let mut io = RpcModule::new(());
let BabeDeps {
babe_worker_handle,
keystore,
} = babe;
let BabeDeps { babe_worker_handle, keystore } = babe;
let GrandpaDeps {
shared_voter_state,
shared_authority_set,
@ -109,13 +103,10 @@ where
} = grandpa;
let chain_name = chain_spec.name().to_string();
let genesis_hash = client
.hash(0)
.ok()
.flatten()
.expect("Genesis block exists; qed;");
let genesis_hash = client.hash(0).ok().flatten().expect("Genesis block exists; qed;");
let properties = chain_spec.properties();
io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?;
io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?;
io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
@ -128,8 +119,7 @@ where
keystore,
select_chain,
deny_unsafe,
)
.into_rpc(),
).into_rpc()
)?;
io.merge(
@ -139,8 +129,7 @@ where
shared_voter_state,
justification_stream,
finality_provider,
)
.into_rpc(),
).into_rpc(),
)?;
io.merge(
@ -148,9 +137,8 @@ where
chain_spec,
client.clone(),
shared_authority_set,
babe_worker_handle,
)?
.into_rpc(),
babe_worker_handle
)?.into_rpc(),
)?;
Ok(io)

7
runtime/casper/Cargo.toml Normal file → Executable file
View File

@ -1,6 +1,6 @@
[package]
name = "casper-runtime"
version = "3.5.41"
version = "3.5.20"
build = "build.rs"
description = "Runtime of the Casper Network"
edition.workspace = true
@ -87,8 +87,6 @@ pallet-whitelist = { workspace = true }
ghost-networks = { workspace = true }
ghost-claims = { workspace = true }
ghost-slow-clap = { workspace = true }
ghost-sudo = { workspace = true }
ghost-traits = { workspace = true }
casper-runtime-constants = { workspace = true }
runtime-common = { workspace = true }
primitives = { workspace = true }
@ -207,7 +205,6 @@ std = [
"ghost-networks/std",
"ghost-claims/std",
"ghost-slow-clap/std",
"ghost-sudo/std",
"casper-runtime-constants/std",
"runtime-common/std",
"primitives/std",
@ -255,7 +252,6 @@ runtime-benchmarks = [
"ghost-networks/runtime-benchmarks",
"ghost-claims/runtime-benchmarks",
"ghost-slow-clap/runtime-benchmarks",
"ghost-sudo/runtime-benchmarks",
"runtime-common/runtime-benchmarks",
]
try-runtime = [
@ -301,6 +297,5 @@ try-runtime = [
"ghost-networks/try-runtime",
"ghost-claims/try-runtime",
"ghost-slow-clap/try-runtime",
"ghost-sudo/try-runtime",
"runtime-common/try-runtime",
]

0
runtime/casper/build.rs Normal file → Executable file
View File

3
runtime/casper/constants/Cargo.toml Normal file → Executable file
View File

@ -28,6 +28,3 @@ std = [
"sp-runtime/std",
"sp-weights/std",
]
# Set timing constants (e.g session period) to faster versions to speed up testing.
fast-runtime = []

2
runtime/casper/constants/src/lib.rs Normal file → Executable file
View File

@ -86,7 +86,7 @@ pub mod fee {
#[cfg(test)]
mod tests {
use super::{
currency::{CSPR, STNK, STRH},
currency::{STNK, STRH, CSPR},
fee::WeightToFee,
};
use crate::weights::ExtrinsicBaseWeight;

View File

@ -1,9 +1,9 @@
pub mod block_weights;
pub mod extrinsic_weights;
pub mod paritydb_weights;
pub mod rocksdb_weights;
pub mod paritydb_weights;
pub use block_weights::BlockExecutionWeight;
pub use extrinsic_weights::ExtrinsicBaseWeight;
pub use paritydb_weights::constants::ParityDbWeight;
pub use rocksdb_weights::constants::RocksDbWeight;
pub use paritydb_weights::constants::ParityDbWeight;

View File

@ -1,3 +1,4 @@
//! Autogenerated bag thresholds.
//!
//! Generated on 2024-06-30T17:36:29.986756974+00:00

48
runtime/casper/src/cult/mod.rs Normal file → Executable file
View File

@ -2,34 +2,25 @@ use super::*;
use frame_support::{
parameter_types,
traits::{
tokens::pay::PayFromAccount, EitherOf, EitherOfDiverse, MapSuccess, OriginTrait,
TryWithMorphedArg,
EitherOf, EitherOfDiverse, MapSuccess, OriginTrait, TryWithMorphedArg,
tokens::pay::PayFromAccount,
},
};
use frame_system::EnsureRootWithSuccess;
use pallet_ranked_collective::EnsureOfRank;
use sp_core::{ConstU128, ConstU32};
use sp_runtime::traits::{ConstU16, TakeFirst};
use pallet_ranked_collective::EnsureOfRank;
use crate::{
AccountId,
Balance,
Balances,
Preimage,
Runtime,
// weights,
RuntimeCall,
RuntimeEvent,
Scheduler,
TreasuryAccount,
CSPR,
DAYS,
RuntimeCall, RuntimeEvent, Scheduler, DAYS, CSPR, AccountId, Balance,
TreasuryAccount, Balances, Preimage, Runtime,
};
mod origins;
pub use origins::{
pallet_cult_origins, CultTreasurySpender, Degens, EnsureCanPromoteTo, EnsureCanRetainAt,
EnsureCult, Geniuses, Ghosts, Skeletons, ToVoice, Zombies,
pallet_cult_origins, Geniuses, Degens, Zombies, Skeletons, Ghosts,
EnsureCanRetainAt, EnsureCanPromoteTo, EnsureCult, ToVoice, CultTreasurySpender,
};
mod tracks;
@ -54,10 +45,14 @@ parameter_types! {
impl pallet_whitelist::Config for Runtime {
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WhitelistOrigin =
EitherOfDiverse<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Skeletons>;
type DispatchWhitelistedOrigin =
EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Geniuses>;
type WhitelistOrigin = EitherOfDiverse<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Skeletons,
>;
type DispatchWhitelistedOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Geniuses,
>;
type Preimages = Preimage;
type WeightInfo = weights::pallet_whitelist::WeightInfo<Runtime>;
}
@ -70,7 +65,7 @@ parameter_types! {
pub type CultReferendaInstance = pallet_referenda::Instance1;
impl pallet_referenda::Config<CultReferendaInstance> for Runtime {
type WeightInfo = weights::pallet_referenda::WeightInfo<Runtime>;
type WeightInfo = ();
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
@ -86,7 +81,7 @@ impl pallet_referenda::Config<CultReferendaInstance> for Runtime {
(AccountId, u16),
>,
TakeFirst,
>,
>
>;
type CancelOrigin = Skeletons;
type KillOrigin = Ghosts;
@ -140,13 +135,10 @@ impl pallet_core_fellowship::Config<CultCoreInstance> for Runtime {
type Members = pallet_ranked_collective::Pallet<Runtime, CultCollectiveInstance>;
type Balance = Balance;
type ParamsOrigin =
EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Skeletons>;
type ParamsOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Skeletons>;
type InductOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
type ApproveOrigin =
EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureCanRetainAt>;
type PromoteOrigin =
EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureCanPromoteTo>;
type ApproveOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureCanRetainAt>;
type PromoteOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, EnsureCanPromoteTo>;
type EvidenceSize = ConstU32<65536>;
}

2
runtime/casper/src/cult/origins.rs Normal file → Executable file
View File

@ -5,8 +5,8 @@ pub use pallet_cult_origins::*;
#[frame_support::pallet]
pub mod pallet_cult_origins {
use super::ranks;
use crate::{Balance, CSPR};
use super::ranks;
use frame_support::pallet_prelude::*;
use pallet_ranked_collective::Rank;

5
runtime/casper/src/cult/tracks.rs Normal file → Executable file
View File

@ -1,4 +1,4 @@
use crate::{Balance, BlockNumber, RuntimeOrigin, CSPR, DAYS, HOURS, MINUTES};
use crate::{Balance, BlockNumber, RuntimeOrigin, DAYS, CSPR, HOURS, MINUTES};
use pallet_ranked_collective::Rank;
use sp_runtime::{traits::Convert, Perbill};
@ -255,6 +255,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 15
min_support: RETAIN_MIN_SUPPORT,
},
),
(
constants::PROMOTE_TO_GENIUSES,
pallet_referenda::TrackInfo {
@ -346,7 +347,7 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
// It is important that this is NOT availiable in production!
let root: Self::RuntimeOrigin = frame_system::RawOrigin::Root.into();
if &root == id {
return Ok(tracks::GHOSTS);
return Ok(tracks::GHOSTS)
}
}

View File

@ -3,20 +3,20 @@ use pallet_staking::Forcing;
use sp_staking::StakerStatus;
use crate::{opaque::SessionKeys, BABE_GENESIS_EPOCH_CONFIG};
use casper_runtime_constants::currency::CSPR;
use primitives::{AccountId, AccountPublic};
use casper_runtime_constants::currency::CSPR;
use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use babe_primitives::AuthorityId as BabeId;
use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
use grandpa_primitives::AuthorityId as GrandpaId;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::{traits::IdentifyAccount, Perbill};
#[cfg(not(feature = "std"))]
use sp_std::alloc::format;
use sp_std::prelude::*;
use sp_std::vec::Vec;
use sp_std::prelude::*;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::{Perbill, traits::IdentifyAccount};
#[derive(Encode, Clone)]
struct PreparedNetworkData {
@ -84,69 +84,40 @@ fn casper_testnet_accounts() -> Vec<AccountId> {
fn casper_testnet_evm_accounts() -> Vec<(AccountId, u128, u8)> {
vec![
// 01c928771aea942a1e7ac06adf2b73dfbc9a25d9eaa516e3673116af7f345198
(
get_account_id_from_seed::<sr25519::Public>("1A69d2D5568D1878023EeB121a73d33B9116A760"),
1337 * CSPR,
1,
),
(get_account_id_from_seed::<sr25519::Public>("1A69d2D5568D1878023EeB121a73d33B9116A760"), 1337 * CSPR, 1),
// b19a435901872f817185f7234a1484eae837613f9d10cf21927a23c2d8cb9139
(
get_account_id_from_seed::<sr25519::Public>("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"),
1337 * CSPR,
2,
),
(get_account_id_from_seed::<sr25519::Public>("2f86cfBED3fbc1eCf2989B9aE5fc019a837A9C12"), 1337 * CSPR, 2),
// d3baf57b74d65719b2dc33f5a464176022d0cc5edbca002234229f3e733875fc
(
get_account_id_from_seed::<sr25519::Public>("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"),
69 * CSPR,
3,
),
(get_account_id_from_seed::<sr25519::Public>("e83f67361Ac74D42A48E2DAfb6706eb047D8218D"), 69 * CSPR, 3),
// c4683d566436af6b58b4a59c8f501319226e85b21869bf93d5eeb4596d4791d4
(
get_account_id_from_seed::<sr25519::Public>("827ee4ad9b259b6fa1390ed60921508c78befd63"),
69 * CSPR,
4,
),
(get_account_id_from_seed::<sr25519::Public>("827ee4ad9b259b6fa1390ed60921508c78befd63"), 69 * CSPR, 4),
]
}
fn casper_testnet_evm_networks() -> Vec<(u32, Vec<u8>)> {
vec![
(
1,
PreparedNetworkData {
(1, PreparedNetworkData {
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(40),
release_delay: Some(80),
network_type: Default::default(),
gatekeeper: "0x4d224452801aced8b2f0aebe155379bb5d594381".into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
.into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(),
incoming_fee: 0,
outgoing_fee: 0,
}
.encode(),
),
(
56,
PreparedNetworkData {
}.encode()),
(56, PreparedNetworkData {
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(20),
release_delay: Some(40),
network_type: Default::default(),
gatekeeper: "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82".into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
.into(),
topic_name: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef".into(),
incoming_fee: 0,
outgoing_fee: 0,
}
.encode(),
),
}.encode())
]
}
@ -156,12 +127,7 @@ fn casper_session_keys(
authority_discovery: AuthorityDiscoveryId,
slow_clap: SlowClapId,
) -> SessionKeys {
SessionKeys {
babe,
grandpa,
authority_discovery,
slow_clap,
}
SessionKeys { babe, grandpa, authority_discovery, slow_clap }
}
fn testnet_config_genesis(
@ -177,7 +143,8 @@ fn testnet_config_genesis(
ghost_accounts: Option<Vec<(AccountId, u128, u8)>>,
evm_networks: Option<Vec<(u32, Vec<u8>)>>,
) -> serde_json::Value {
let endowed_accounts: Vec<AccountId> = endowed_accounts.unwrap_or_else(casper_testnet_accounts);
let endowed_accounts: Vec<AccountId> =
endowed_accounts.unwrap_or_else(casper_testnet_accounts);
let ghost_accounts: Vec<(AccountId, u128, u8)> =
ghost_accounts.unwrap_or_else(casper_testnet_evm_accounts);
@ -251,9 +218,7 @@ fn testnet_config_genesis(
fn casper_development_config_genesis() -> serde_json::Value {
testnet_config_genesis(
vec![get_authority_keys_from_seed("Alice")],
None,
None,
None,
None, None, None,
)
}
@ -264,9 +229,7 @@ fn casper_local_config_genesis() -> serde_json::Value {
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
None,
None,
None,
None, None, None,
)
}
@ -277,11 +240,9 @@ pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<
Ok("local_testnet") => casper_local_config_genesis(),
_ => return None,
};
Some(
serde_json::to_string(&patch)
Some(serde_json::to_string(&patch)
.expect("serialization to json is expected to work; qed")
.into_bytes(),
)
.into_bytes())
}
/// Returns a list of identifiers for available builtin `RuntimeGenesisConfig` presets.

View File

@ -1,8 +1,9 @@
use super::*;
use frame_support::{dispatch::DispatchResultWithPostInfo, traits::PrivilegeCmp};
use ghost_traits::exposure::ExposureListener;
use frame_support::{
dispatch::DispatchResultWithPostInfo,
traits::PrivilegeCmp,
};
use pallet_alliance::{ProposalIndex, ProposalProvider};
use primitives::Balance;
use sp_runtime::DispatchError;
use sp_std::{cmp::Ordering, marker::PhantomData};
@ -13,8 +14,7 @@ type HashOf<T> = <T as frame_system::Config>::Hash;
/// Proposal provider for alliance pallet.
/// Adapter from collective pallet to alliance proposal provider trait.
pub struct AllianceProposalProvider<T, I = ()>(PhantomData<(T, I)>);
impl<T, I> ProposalProvider<AccountIdOf<T>, HashOf<T>, ProposalOf<T, I>>
for AllianceProposalProvider<T, I>
impl <T, I> ProposalProvider<AccountIdOf<T>, HashOf<T>, ProposalOf<T, I>> for AllianceProposalProvider<T, I>
where
T: pallet_collective::Config<I> + frame_system::Config,
I: 'static,
@ -25,12 +25,7 @@ where
proposal: Box<ProposalOf<T, I>>,
length_bound: u32,
) -> Result<(u32, u32), DispatchError> {
pallet_collective::Pallet::<T, I>::do_propose_proposed(
who,
threshold,
proposal,
length_bound,
)
pallet_collective::Pallet::<T, I>::do_propose_proposed(who, threshold, proposal, length_bound)
}
fn vote_proposal(
@ -66,7 +61,7 @@ pub struct EqualOrGreatestRootCmp;
impl PrivilegeCmp<OriginCaller> for EqualOrGreatestRootCmp {
fn cmp_privilege(left: &OriginCaller, right: &OriginCaller) -> Option<Ordering> {
if left == right {
return Some(Ordering::Equal);
return Some(Ordering::Equal)
}
match (left, right) {
@ -78,50 +73,6 @@ impl PrivilegeCmp<OriginCaller> for EqualOrGreatestRootCmp {
}
}
/// Used to get the exposure information out of staking pallet directly.
pub struct StakingExposureListener<T>(PhantomData<T>);
impl<T> ExposureListener<Balance, AccountIdOf<T>> for StakingExposureListener<T>
where
T: pallet_session::Config + pallet_staking::Config + frame_system::Config,
u128: From<T::CurrencyBalance>,
AccountIdOf<T>: From<<T as pallet_session::Config>::ValidatorId>,
{
fn get_accounts_by_indexes(
indexes_iterator: impl Iterator<Item = usize>,
) -> sp_std::prelude::Vec<AccountIdOf<T>> {
let all_validators = pallet_session::Pallet::<T>::validators();
indexes_iterator
.filter_map(|index| {
all_validators.get(index).map(|validator| {
let account_id: AccountIdOf<T> = validator.clone().into();
account_id
})
})
.collect()
}
fn get_account_by_index(index: usize) -> Option<AccountIdOf<T>> {
pallet_session::Pallet::<T>::validators()
.get(index)
.map(|validator| {
let account_id: AccountIdOf<T> = validator.clone().into();
account_id
})
}
fn get_total_exposure() -> Balance {
let era = pallet_staking::Pallet::<T>::current_era().unwrap_or_default();
pallet_staking::Pallet::<T>::eras_total_stake(era).into()
}
fn get_validator_exposure(validator: &AccountIdOf<T>) -> Balance {
let era = pallet_staking::Pallet::<T>::current_era().unwrap_or_default();
pallet_staking::EraInfo::<T>::get_full_exposure(era, validator)
.total
.into()
}
}
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarks {
use super::*;

435
runtime/casper/src/lib.rs Normal file → Executable file
View File

@ -1,60 +1,63 @@
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase
// the limit to 256
#![recursion_limit = "256"]
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use frame_election_provider_support::{
bounds::ElectionBoundsBuilder, generate_solution_type, onchain, SequentialPhragmen,
};
use frame_support::{
construct_runtime,
genesis_builder_helper::{build_state, get_preset},
parameter_types,
traits::{
fungible::HoldConsideration, tokens::UnityAssetBalanceConversion, ConstU128, ConstU32,
EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice,
WithdrawReasons,
},
weights::ConstantMultiplier,
PalletId,
};
use frame_system::{EnsureRoot, EnsureRootWithSuccess};
use runtime_common::{
impl_runtime_weights, impls::DealWithFees, prod_or_fast, BlockHashCount, BlockLength,
CurrencyToVote, SlowAdjustingFeeUpdate,
impls::DealWithFees, BlockHashCount, BlockLength, CurrencyToVote,
SlowAdjustingFeeUpdate, impl_runtime_weights, prod_or_fast,
};
use authority_discovery_primitives::AuthorityId as AuthorityDiscoveryId;
use frame_election_provider_support::{
generate_solution_type, onchain, SequentialPhragmen,
bounds::ElectionBoundsBuilder,
};
use frame_support::{
construct_runtime, parameter_types,
genesis_builder_helper::{build_state, get_preset},
traits::{
fungible::HoldConsideration,
tokens::UnityAssetBalanceConversion,
ConstU128, ConstU32, EitherOf, EitherOfDiverse, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, WithdrawReasons,
},
weights::ConstantMultiplier, PalletId
};
#[cfg(not(feature = "runtime-benchmarks"))]
use frame_support::traits::tokens::pay::PayFromAccount;
#[cfg(feature = "runtime-benchmarks")]
use runtime_common::benchmarking::{BenchmarkTreasuryHelper, BenchmarkTreasuryPaymaster};
use runtime_common::benchmarking::BenchmarkTreasuryHelper;
use frame_support::traits::tokens::pay::PayFromAccount;
use codec::{Decode, Encode, MaxEncodedLen};
use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
use pallet_transaction_payment::FungibleAdapter;
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_identity::legacy::IdentityInfo;
use ghost_slow_clap::sr25519::AuthorityId as SlowClapId;
use pallet_session::historical as session_historical;
use pallet_transaction_payment::FungibleAdapter;
use pallet_transaction_payment::{FeeDetails, RuntimeDispatchInfo};
use codec::{Decode, Encode, MaxEncodedLen};
use primitives::{
AccountId, AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce, ReserveIdentifier,
Signature,
AccountId, AccountIndex, Balance, BlockNumber, Hash, Moment, Nonce,
Signature, ReserveIdentifier,
};
use sp_core::OpaqueMetadata;
use sp_genesis_builder::PresetId;
use sp_runtime::{
create_runtime_str,
create_runtime_str, generic, impl_opaque_keys, FixedU128,
curve::PiecewiseLinear,
generic, impl_opaque_keys,
traits::{
AccountIdLookup, BlakeTwo256, Block as BlockT, ConstU16, ConvertInto,
Extrinsic as ExtrinsicT, IdentityLookup, OpaqueKeys, SaturatedConversion, Verify,
AccountIdLookup, BlakeTwo256, Block as BlockT, Extrinsic as ExtrinsicT,
OpaqueKeys, SaturatedConversion, Verify, IdentityLookup, ConvertInto,
ConstU16,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug,
transaction_validity::{
TransactionPriority, TransactionSource, TransactionValidity,
},
ApplyExtrinsicResult, KeyTypeId, Perbill, Percent, Permill,
RuntimeDebug,
};
use sp_genesis_builder::PresetId;
use sp_std::prelude::*;
#[cfg(any(feature = "std", test))]
use sp_version::NativeVersion;
@ -72,21 +75,20 @@ pub use pallet_timestamp::Call as TimestampCall;
pub use sp_runtime::BuildStorage;
/// Constant values used within the runtime.
use casper_runtime_constants::{currency::*, fee::*, time::*};
use casper_runtime_constants::{currency::*, time::*, fee::*};
mod bag_thresholds;
mod genesis_config_presets;
mod impls;
mod weights;
mod bag_thresholds;
mod impls;
mod genesis_config_presets;
pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp, StakingExposureListener};
pub use impls::{AllianceProposalProvider, EqualOrGreatestRootCmp};
// Governance configuration.
pub mod cult;
#[cfg(not(feature = "runtime-benchmarks"))]
use cult::CultTreasurySpender;
use cult::{
pallet_cult_origins, CultCollectiveInstance, Degens, Geniuses, Ghosts, Skeletons, Zombies,
pallet_cult_origins, CultCollectiveInstance, CultTreasurySpender,
Geniuses, Degens, Zombies, Skeletons, Ghosts,
};
pub const LOG_TARGET: &str = "runtime::casper";
@ -119,11 +121,11 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("casper"),
impl_name: create_runtime_str!("casper-svengali"),
authoring_version: 0,
spec_version: 6,
impl_version: 4,
spec_version: 1,
impl_version : 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
state_version: 1,
state_version: 0,
};
/// The BABE epoch configuration at genesis.
@ -172,7 +174,7 @@ impl frame_system::Config for Runtime {
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
type SS58Prefix = SS58Prefix;
type OnSetCode = ();
type MaxConsumers = ConstU32<16>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
@ -220,7 +222,10 @@ impl pallet_preimage::Config for Runtime {
}
parameter_types! {
pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64;
pub const EpochDuration: u64 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS as u64,
2 * MINUTES as u64
);
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
pub const ReportLongevity: u64 =
BondingDuration::get() as u64 *
@ -236,7 +241,7 @@ impl pallet_babe::Config for Runtime {
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
type WeightInfo = weights::pallet_babe::WeightInfo<Runtime>;
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxNominators;
@ -331,8 +336,14 @@ impl pallet_session::historical::Config for Runtime {
}
parameter_types! {
pub SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
pub UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
pub SignedPhase: u32 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS / 4,
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
);
pub UnsignedPhase: u32 = prod_or_fast!(
EPOCH_DURATION_IN_SLOTS / 4,
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2)
);
// signed config
pub const SignedMaxSubmissions: u32 = 16;
@ -411,12 +422,10 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedMaxRefunds = SignedMaxRefunds;
type SignedRewardBase = SignedRewardBase;
type SignedDepositBase =
GeometricDepositBase<Balance, SignedFixedDeposit, SignedDepositIncreaseFactor>;
type SignedDepositBase = GeometricDepositBase<Balance, SignedFixedDeposit, SignedDepositIncreaseFactor>;
type SignedDepositByte = SignedDepositByte;
type SignedDepositWeight = ();
type SignedMaxWeight =
<Self::MinerConfig as pallet_election_provider_multi_phase::MinerConfig>::MaxWeight;
type SignedMaxWeight = <Self::MinerConfig as pallet_election_provider_multi_phase::MinerConfig>::MaxWeight;
type MinerConfig = Self;
type SlashHandler = ();
type RewardHandler= ();
@ -440,7 +449,10 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
(),
>;
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
type ForceOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
type ForceOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Zombies,
>;
type MaxWinners = MaxActiveValidators;
type ElectionBounds = ElectionBounds;
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Runtime>;
@ -480,8 +492,6 @@ parameter_types! {
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
pub const MaxNominations: 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 {
@ -496,9 +506,12 @@ impl pallet_staking::Config for Runtime {
type SessionsPerEra = SessionsPerEra;
type BondingDuration = BondingDuration;
type SlashDeferDuration = SlashDeferDuration;
type AdminOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Skeletons>;
type AdminOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Skeletons,
>;
type SessionInterface = Self;
type EraPayout = ghost_networks::BridgedInflationCurve<RewardCurve, Self>;
type EraPayout = pallet_staking::ConvertCurve<RewardCurve>;
type MaxExposurePageSize = MaxExposurePageSize;
type DisablingStrategy = pallet_staking::UpToLimitDisablingStrategy;
type NextNewSession = Session;
@ -507,8 +520,8 @@ impl pallet_staking::Config for Runtime {
type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>;
type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
type MaxUnlockingChunks = MaxUnlockingChunks;
type HistoryDepth = StakingHistoryDepth;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
type MaxControllersInDeprecationBatch = ConstU32<5314>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type EventListeners = NominationPools;
@ -520,7 +533,10 @@ impl pallet_fast_unstake::Config for Runtime {
type Currency = Balances;
type BatchSize = frame_support::traits::ConstU32<16>;
type Deposit = ConstU128<{ STRH }>;
type ControlOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
type ControlOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Zombies,
>;
type Staking = Staking;
type MaxErasToCheckPerBlock = ConstU32<1>;
type WeightInfo = weights::pallet_fast_unstake::WeightInfo<Runtime>;
@ -560,30 +576,19 @@ impl pallet_identity::Config for Runtime {
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 10 * CSPR;
pub const ProposalBondMaximum: Balance = 50 * CSPR;
pub const SpendPeriod: BlockNumber = 24 * DAYS;
pub const Burn: Permill = Permill::from_percent(0);
pub const MaxBalance: Balance = Balance::MAX;
pub const PayoutPeriod: BlockNumber = 30 * DAYS;
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const DataDepositPerByte: Balance = 1 * STRH;
pub const MaxApprovals: u32 = 1000;
pub const MaxApprovals: u32 = 100;
pub const MaxAuthorities: u32 = 100_000;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const ProposalBondMinimum: Balance = 10 * CSPR;
pub const ProposalBondMaximum: Balance = 50 * CSPR;
pub const SpendPeriod: BlockNumber = 6 * DAYS;
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const ProposalBondMinimum: Balance = ExistentialDeposit::get() * 100;
pub const ProposalBondMaximum: Balance = ExistentialDeposit::get() * 500;
pub const SpendPeriod: BlockNumber = 1;
}
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = Balances;
@ -592,35 +597,42 @@ impl pallet_treasury::Config for Runtime {
type ApproveOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
#[cfg(feature = "runtime-benchmarks")]
type ApproveOrigin = EnsureRoot<Self::AccountId>;
type RejectOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Degens>;
type RejectOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Degens,
>;
type RuntimeEvent = RuntimeEvent;
type OnSlash = Treasury;
type ProposalBond = ProposalBond;
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ProposalBondMaximum;
type SpendPeriod = SpendPeriod;
#[cfg(feature = "runtime-benchmarks")]
type ProposalBondMinimum = ConstU128<{ ExistentialDeposit::get() * 100 }>;
#[cfg(not(feature = "runtime-benchmarks"))]
type ProposalBondMaximum = ProposalBondMaximum;
#[cfg(feature = "runtime-benchmarks")]
type ProposalBondMaximum = ConstU128<{ ExistentialDeposit::get() * 500 }>;
type SpendPeriod = SpendPeriod;
type Burn = Burn;
type BurnDestination = ();
type SpendFunds = Bounties;
type MaxApprovals = MaxApprovals;
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
type WeightInfo = ();
#[cfg(not(feature = "runtime-benchmarks"))]
type SpendOrigin = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, CultTreasurySpender>;
#[cfg(feature = "runtime-benchmarks")]
type SpendOrigin = EnsureRootWithSuccess<AccountId, MaxBalance>;
type SpendOrigin = EitherOf<
EnsureRootWithSuccess<AccountId, MaxBalance>,
CultTreasurySpender
>;
type AssetKind = ();
type Beneficiary = AccountId;
type BeneficiaryLookup = IdentityLookup<Self::Beneficiary>;
#[cfg(not(feature = "runtime-benchmarks"))]
type Paymaster = PayFromAccount<Balances, TreasuryAccount>;
#[cfg(feature = "runtime-benchmarks")]
type Paymaster = BenchmarkTreasuryPaymaster;
type BalanceConverter = UnityAssetBalanceConversion;
type PayoutPeriod = PayoutPeriod;
@ -628,43 +640,30 @@ impl pallet_treasury::Config for Runtime {
type BenchmarkHelper = BenchmarkTreasuryHelper;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const BountyValueMinimum: Balance = 1 * STRH;
pub const CuratorDepositMin: Balance = 10 * CSPR;
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const BountyValueMinimum: Balance = ExistentialDeposit::get() * 10;
pub const CuratorDepositMin: Balance = ExistentialDeposit::get();
}
parameter_types! {
pub const BountyDepositBase: Balance = 10 * CSPR;
pub const BountyDepositPayoutDelay: BlockNumber = DAYS;
pub const BountyUpdatePeriod: BlockNumber = 2 * WEEKS;
pub const MaximumReasonLength: u32 = 16_384;
pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50);
pub const CuratorDepositMin: Balance = 10 * CSPR;
pub const CuratorDepositMax: Balance = 200 * CSPR;
pub const BountyValueMinimum: Balance = 10 * CSPR;
}
impl pallet_bounties::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type BountyDepositBase = BountyDepositBase;
type CuratorDepositMin = CuratorDepositMin;
type DataDepositPerByte = DataDepositPerByte;
type BountyValueMinimum = BountyValueMinimum;
type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
type BountyUpdatePeriod = BountyUpdatePeriod;
type CuratorDepositMultiplier = CuratorDepositMultiplier;
type CuratorDepositMin = CuratorDepositMin;
type CuratorDepositMax = CuratorDepositMax;
type BountyValueMinimum = BountyValueMinimum;
type ChildBountyManager = ChildBounties;
type DataDepositPerByte = DataDepositPerByte;
type MaximumReasonLength = MaximumReasonLength;
type WeightInfo = weights::pallet_bounties::WeightInfo<Runtime>;
type WeightInfo = ();
}
parameter_types! {
@ -676,7 +675,7 @@ impl pallet_child_bounties::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type MaxActiveChildBountyCount = MaxActiveChildBountyCount;
type ChildBountyValueMinimum = ChildBountyValueMinimum;
type WeightInfo = weights::pallet_child_bounties::WeightInfo<Runtime>;
type WeightInfo = ();
}
impl pallet_offences::Config for Runtime {
@ -701,13 +700,14 @@ parameter_types! {
impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_grandpa::WeightInfo<Runtime>;
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = MaxNominators;
type MaxSetIdSessionEntries = MaxSetIdSessionEntries;
type KeyOwnerProof = <Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type KeyOwnerProof =
<Historical as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
type EquivocationReportSystem =
pallet_grandpa::EquivocationReportSystem<Self, Offences, Historical, ReportLongevity>;
@ -724,17 +724,13 @@ where
public: <Signature as Verify>::Signer,
account: AccountId,
nonce: <Runtime as frame_system::Config>::Nonce,
) -> Option<(
RuntimeCall,
<UncheckedExtrinsic as ExtrinsicT>::SignaturePayload,
)> {
) -> Option<(RuntimeCall, <UncheckedExtrinsic as ExtrinsicT>::SignaturePayload)> {
use sp_runtime::traits::StaticLookup;
// take the biggest period possible
let period = BlockHashCount::get()
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2) as u64;
.map(|c| c / 2).unwrap_or(2) as u64;
let current_block = System::block_number()
.saturated_into::<u64>()
@ -748,10 +744,9 @@ where
frame_system::CheckSpecVersion::<Runtime>::new(),
frame_system::CheckTxVersion::<Runtime>::new(),
frame_system::CheckGenesis::<Runtime>::new(),
frame_system::CheckMortality::<Runtime>::from(generic::Era::mortal(
period,
current_block,
)),
frame_system::CheckMortality::<Runtime>::from(
generic::Era::mortal(period, current_block),
),
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
@ -833,17 +828,8 @@ parameter_types! {
/// The type used to represent the kinds of proxying allowed.
#[derive(
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
RuntimeDebug,
MaxEncodedLen,
scale_info::TypeInfo,
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode,
Decode, RuntimeDebug, MaxEncodedLen, scale_info::TypeInfo,
)]
pub enum ProxyType {
Any = 0,
@ -868,40 +854,42 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
ProxyType::NonTransfer => matches!(c, RuntimeCall::Balances { .. }),
ProxyType::Governance => matches!(
c,
RuntimeCall::Bounties { .. }
| RuntimeCall::Utility { .. }
| RuntimeCall::ChildBounties { .. }
| RuntimeCall::CultReferenda { .. }
| RuntimeCall::CultCollective { .. }
| RuntimeCall::Whitelist { .. }
| RuntimeCall::AllianceMotion { .. }
| RuntimeCall::Alliance { .. }
| RuntimeCall::Multisig { .. }
RuntimeCall::Bounties { .. } |
RuntimeCall::Utility { .. } |
RuntimeCall::ChildBounties { .. } |
RuntimeCall::CultReferenda { .. } |
RuntimeCall::CultCollective { .. } |
RuntimeCall::Whitelist { .. } |
RuntimeCall::AllianceMotion { .. } |
RuntimeCall::Alliance { .. } |
RuntimeCall::Multisig { .. }
),
ProxyType::Staking => matches!(
c,
RuntimeCall::Staking { .. }
| RuntimeCall::Session { .. }
| RuntimeCall::Utility { .. }
| RuntimeCall::FastUnstake { .. }
| RuntimeCall::VoterList { .. }
| RuntimeCall::NominationPools { .. }
RuntimeCall::Staking { .. } |
RuntimeCall::Session { .. } |
RuntimeCall::Utility { .. } |
RuntimeCall::FastUnstake { .. } |
RuntimeCall::VoterList { .. } |
RuntimeCall::NominationPools { .. }
),
ProxyType::IdentityJudgement => matches!(
c,
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. })
| RuntimeCall::Utility { .. }
RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) |
RuntimeCall::Utility { .. }
),
ProxyType::CancelProxy => matches!(
c,
RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })
| RuntimeCall::Utility { .. }
| RuntimeCall::Multisig { .. }
RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
RuntimeCall::Utility { .. } |
RuntimeCall::Multisig { .. }
),
ProxyType::NominationPools => matches!(
c,
RuntimeCall::NominationPools { .. } | RuntimeCall::Utility { .. }
RuntimeCall::NominationPools { .. } |
RuntimeCall::Utility { .. }
),
}
}
@ -950,7 +938,10 @@ impl pallet_nomination_pools::Config for Runtime {
type MaxUnbonding = <Self as pallet_staking::Config>::MaxUnlockingChunks;
type PalletId = PoolsPalletId;
type MaxPointsToBalance = MaxPointsToBalance;
type AdminOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
type AdminOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Zombies,
>;
type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Runtime>;
}
@ -994,7 +985,7 @@ impl pallet_collective::Config<AllianceCollective> for Runtime {
type MaxProposals = ConstU32<ALLIANCE_MAX_PROPOSALS>;
type MaxMembers = ConstU32<ALLIANCE_MAX_MEMBERS>;
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<Self::AccountId>;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposalWeight = MaxProposalWeight;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}
@ -1044,13 +1035,19 @@ impl pallet_alliance::Config for Runtime {
impl ghost_networks::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type NetworkId = u64;
type Currency = Balances;
type MaxNetworks = ConstU32<30>;
type RegisterOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Ghosts>;
type UpdateOrigin = EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Zombies>;
type RemoveOrigin =
EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Skeletons>;
type RegisterOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Ghosts,
>;
type UpdateOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Zombies,
>;
type RemoveOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
Skeletons,
>;
type WeightInfo = weights::ghost_networks::WeightInfo<Runtime>;
}
@ -1061,6 +1058,7 @@ parameter_types! {
pub VestingBlocks: u32 = 10 * WEEKS;
}
impl ghost_claims::Config<CultCollectiveInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type VestingSchedule = Vesting;
@ -1075,51 +1073,39 @@ impl ghost_claims::Config<CultCollectiveInstance> for Runtime {
}
parameter_types! {
pub const MinAuthoritiesNumber: u32 = 5;
pub const SlowClapUnsignedPriority: TransactionPriority = TransactionPriority::MAX;
pub const SlowClapHistoryDepth: sp_staking::SessionIndex =
StakingHistoryDepth::get() * SessionsPerEra::get();
}
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub const ApplauseThreshold: u32 = 0;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const ApplauseThreshold: u32 = 500_000_000;
// maximum number of claps in one tx
pub MaxNumberOfClaps: u32 = 5;
// will be used in `Perbill::from_percent()`
pub ApplauseThreshold: u32 = 70;
// will be used in `Perbill::from_percent()`
pub OffenceThreshold: u32 = 40;
pub const SlowClapUnsignedPriority: TransactionPriority =
TransactionPriority::max_value();
}
impl ghost_slow_clap::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AuthorityId = SlowClapId;
type NextSessionRotation = Babe;
type ValidatorSet = Historical;
type Currency = Balances;
type NetworkDataHandler = GhostNetworks;
type BlockNumberProvider = System;
type ReportUnresponsiveness = Offences;
type DisabledValidators = Session;
type ExposureListener = StakingExposureListener<Runtime>;
type ApplauseThreshold = ApplauseThreshold;
type MaxAuthorities = MaxAuthorities;
type MaxNumberOfClaps = MaxNumberOfClaps;
type ApplauseThreshold = ApplauseThreshold;
type MaxAuthorityInfoInSession = MaxAuthorities;
type OffenceThreshold = OffenceThreshold;
type UnsignedPriority = SlowClapUnsignedPriority;
type HistoryDepth = SlowClapHistoryDepth;
type MinAuthoritiesNumber = MinAuthoritiesNumber;
type EpochDuration = EpochDuration;
type TreasuryPalletId = TreasuryPalletId;
type WeightInfo = weights::ghost_slow_clap::WeightInfo<Runtime>;
}
impl ghost_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type WeightInfo = weights::ghost_sudo::WeightInfo<Runtime>;
}
construct_runtime! {
pub enum Runtime
{
@ -1147,7 +1133,6 @@ construct_runtime! {
Session: pallet_session = 9,
Grandpa: pallet_grandpa = 11,
AuthorityDiscovery: pallet_authority_discovery = 12,
GhostSudo: ghost_sudo = 13,
// Governance stuff.
Treasury: pallet_treasury = 19,
@ -1212,10 +1197,7 @@ pub type SignedExtra = (
/// All migrations that will run on the next runtime upgrade.
/// Should be cleared after release.
pub type Migrations = (
ghost_networks::migrations::MigrateV0ToV1<Runtime>,
ghost_slow_clap::migrations::MigrateV2ToV3<Runtime>,
);
pub type Migrations = ();
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
@ -1279,7 +1261,6 @@ mod benches {
[ghost_networks, GhostNetworks]
[ghost_claims, GhostClaims]
[ghost_slow_clap, GhostSlowClaps]
[ghost_sudo, GhostSudo]
);
}
@ -1586,7 +1567,6 @@ sp_api::impl_runtime_apis! {
(list, storage_info)
}
#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig,
) -> Result<
@ -1726,10 +1706,7 @@ mod test_fees {
test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_00u128));
test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_000u128));
test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_000_000u128));
test_with_multiplier(Multiplier::saturating_from_rational(
1u128,
1_000_000_000u128,
));
test_with_multiplier(Multiplier::saturating_from_rational(1u128, 1_000_000_000u128));
}
#[test]
@ -1751,21 +1728,14 @@ mod test_fees {
};
let mut active = target_voters;
while weight_with(active).all_lte(OffchainSolutionWeightLimit::get())
|| active == target_voters
while weight_with(active).all_lte(OffchainSolutionWeightLimit::get()) ||
active == target_voters
{
active += 1;
}
println!(
"can support {} nominators to yield a weight of {}",
active,
weight_with(active)
);
assert!(
active > target_voters,
"we need to reevaluate the weight of the election system"
);
println!("can support {} nominators to yield a weight of {}", active, weight_with(active));
assert!(active > target_voters, "we need to reevaluate the weight of the election system");
}
#[test]
@ -1794,25 +1764,15 @@ mod test {
.collect();
// Block number
assert!(
whitelist.contains("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac")
);
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac"));
// Total issuance
assert!(
whitelist.contains("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80")
);
assert!(whitelist.contains("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80"));
// Execution phase
assert!(
whitelist.contains("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a")
);
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a"));
// Event count
assert!(
whitelist.contains("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850")
);
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850"));
// System events
assert!(
whitelist.contains("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7")
);
assert!(whitelist.contains("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7"));
}
#[test]
@ -1849,21 +1809,13 @@ mod multiplier_tests {
#[test]
fn multiplier_can_grow_from_zero() {
let minimum_multiplier = MinimumMultiplier::get();
let target = TargetBlockFullness::get()
* BlockWeights::get()
.get(DispatchClass::Normal)
.max_total
.unwrap();
let target = TargetBlockFullness::get() *
BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap();
// if the min is too small, then this will not change, and we are doomed forever.
// the weight is 1/100th bigger than target.
run_with_system_weight(target.saturating_mul(101) / 100, || {
let next = SlowAdjustingFeeUpdate::<Runtime>::convert(minimum_multiplier);
assert!(
next > minimum_multiplier,
"{:?} !>= {:?}",
next,
minimum_multiplier
);
assert!(next > minimum_multiplier, "{:?} !>= {:?}", next, minimum_multiplier);
})
}
@ -1876,10 +1828,7 @@ mod multiplier_tests {
<Runtime as pallet_fast_unstake::Config>::BatchSize::get(),
)
.ref_time() as f32;
println!(
"ratio of block weight for full batch fast-unstake {}",
on_idle / block_time
);
println!("ratio of block weight for full batch fast-unstake {}", on_idle / block_time);
assert!(on_idle / block_time <= 0.5f32)
}
@ -1889,18 +1838,12 @@ mod multiplier_tests {
// assume the multiplier is initially set to its minimum. We update it with values twice the
//target (target is 25%, thus 50%) and we see at which point it reaches 1.
let mut multiplier = MinimumMultiplier::get();
let block_weight = BlockWeights::get()
.get(DispatchClass::Normal)
.max_total
.unwrap();
let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap();
let mut blocks = 0;
let mut fees_paid = 0;
frame_system::Pallet::<Runtime>::set_block_consumed_resources(Weight::MAX, 0);
let info = DispatchInfo {
weight: Weight::MAX,
..Default::default()
};
let info = DispatchInfo { weight: Weight::MAX, ..Default::default() };
let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default()
.build_storage::<Runtime>()

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `frame_benchmarking::baseline`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -51,8 +51,8 @@ impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 621_000 picoseconds.
Weight::from_parts(690_940, 0)
// Minimum execution time: 581_000 picoseconds.
Weight::from_parts(630_062, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 1000000]`.
@ -60,8 +60,8 @@ impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 606_000 picoseconds.
Weight::from_parts(677_607, 0)
// Minimum execution time: 577_000 picoseconds.
Weight::from_parts(639_502, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 1000000]`.
@ -69,8 +69,8 @@ impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 598_000 picoseconds.
Weight::from_parts(659_128, 0)
// Minimum execution time: 588_000 picoseconds.
Weight::from_parts(643_988, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 1000000]`.
@ -78,16 +78,16 @@ impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 605_000 picoseconds.
Weight::from_parts(673_448, 0)
// Minimum execution time: 587_000 picoseconds.
Weight::from_parts(646_411, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn hashing() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 95_407_728_000 picoseconds.
Weight::from_parts(96_344_808_000, 0)
// Minimum execution time: 86_383_930_000 picoseconds.
Weight::from_parts(86_405_327_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 100]`.
@ -95,10 +95,10 @@ impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for Weigh
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 685_000 picoseconds.
Weight::from_parts(12_791_754, 0)
// Minimum execution time: 617_000 picoseconds.
Weight::from_parts(9_197_912, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 7_688
.saturating_add(Weight::from_parts(133_376_480, 0).saturating_mul(i.into()))
// Standard Error: 11_936
.saturating_add(Weight::from_parts(134_040_960, 0).saturating_mul(i.into()))
}
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `frame_election_provider_support`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -53,13 +53,13 @@ impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for We
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 30_317_999_000 picoseconds.
Weight::from_parts(30_380_201_000, 0)
// Minimum execution time: 25_492_475_000 picoseconds.
Weight::from_parts(25_652_778_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 774_739
.saturating_add(Weight::from_parts(31_260_177, 0).saturating_mul(v.into()))
// Standard Error: 79_206_569
.saturating_add(Weight::from_parts(8_117_014_928, 0).saturating_mul(d.into()))
// Standard Error: 610_576
.saturating_add(Weight::from_parts(26_134_836, 0).saturating_mul(v.into()))
// Standard Error: 62_423_156
.saturating_add(Weight::from_parts(6_191_776_057, 0).saturating_mul(d.into()))
}
/// The range of component `v` is `[1000, 2000]`.
/// The range of component `t` is `[500, 1000]`.
@ -68,12 +68,12 @@ impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for We
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_925_013_000 picoseconds.
Weight::from_parts(19_106_763_000, 0)
// Minimum execution time: 17_311_486_000 picoseconds.
Weight::from_parts(17_425_500_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 587_998
.saturating_add(Weight::from_parts(23_371_104, 0).saturating_mul(v.into()))
// Standard Error: 60_114_827
.saturating_add(Weight::from_parts(6_301_306_614, 0).saturating_mul(d.into()))
// Standard Error: 525_907
.saturating_add(Weight::from_parts(21_191_580, 0).saturating_mul(v.into()))
// Standard Error: 53_766_908
.saturating_add(Weight::from_parts(5_509_535_886, 0).saturating_mul(d.into()))
}
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `frame_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -51,22 +51,22 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_939_000 picoseconds.
Weight::from_parts(9_016_000, 0)
// Minimum execution time: 10_130_000 picoseconds.
Weight::from_parts(10_233_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 0
.saturating_add(Weight::from_parts(1_078, 0).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(1_073, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 23_333_000 picoseconds.
Weight::from_parts(290_549_964, 0)
// Minimum execution time: 24_295_000 picoseconds.
Weight::from_parts(25_129_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 10
.saturating_add(Weight::from_parts(4_566, 0).saturating_mul(b.into()))
// Standard Error: 61
.saturating_add(Weight::from_parts(6_128, 0).saturating_mul(b.into()))
}
/// Storage: `System::Digest` (r:1 w:1)
/// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
@ -76,8 +76,8 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 15_355_000 picoseconds.
Weight::from_parts(15_790_000, 0)
// Minimum execution time: 17_361_000 picoseconds.
Weight::from_parts(18_127_000, 0)
.saturating_add(Weight::from_parts(0, 1485))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
@ -90,8 +90,8 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `1485`
// Minimum execution time: 255_524_601_000 picoseconds.
Weight::from_parts(258_199_712_000, 0)
// Minimum execution time: 276_621_374_000 picoseconds.
Weight::from_parts(465_333_875_000, 0)
.saturating_add(Weight::from_parts(0, 1485))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
@ -103,11 +103,11 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 9_215_000 picoseconds.
Weight::from_parts(9_318_000, 0)
// Minimum execution time: 10_235_000 picoseconds.
Weight::from_parts(216_405_157, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 5_031
.saturating_add(Weight::from_parts(2_103_210, 0).saturating_mul(i.into()))
// Standard Error: 33_989
.saturating_add(Weight::from_parts(2_132_990, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: `Skipped::Metadata` (r:0 w:0)
@ -117,11 +117,11 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 9_322_000 picoseconds.
Weight::from_parts(9_388_000, 0)
// Minimum execution time: 10_172_000 picoseconds.
Weight::from_parts(10_294_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 2_220
.saturating_add(Weight::from_parts(1_532_586, 0).saturating_mul(i.into()))
// Standard Error: 2_842
.saturating_add(Weight::from_parts(1_680_628, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: `Skipped::Metadata` (r:0 w:0)
@ -129,13 +129,13 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
/// The range of component `p` is `[0, 1000]`.
fn kill_prefix(p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `94 + p * (69 ±0)`
// Estimated: `106 + p * (70 ±0)`
// Minimum execution time: 17_579_000 picoseconds.
Weight::from_parts(17_948_000, 0)
.saturating_add(Weight::from_parts(0, 106))
// Standard Error: 3_830
.saturating_add(Weight::from_parts(3_108_241, 0).saturating_mul(p.into()))
// Measured: `88 + p * (69 ±0)`
// Estimated: `102 + p * (70 ±0)`
// Minimum execution time: 19_692_000 picoseconds.
Weight::from_parts(19_817_000, 0)
.saturating_add(Weight::from_parts(0, 102))
// Standard Error: 5_183
.saturating_add(Weight::from_parts(3_138_053, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into()))
@ -146,8 +146,8 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 39_762_000 picoseconds.
Weight::from_parts(40_602_000, 0)
// Minimum execution time: 41_596_000 picoseconds.
Weight::from_parts(42_415_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -161,8 +161,8 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `22`
// Estimated: `1518`
// Minimum execution time: 272_767_859_000 picoseconds.
Weight::from_parts(274_769_560_000, 0)
// Minimum execution time: 281_871_139_000 picoseconds.
Weight::from_parts(288_412_158_000, 0)
.saturating_add(Weight::from_parts(0, 1518))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_claims`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! 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
@ -62,8 +62,8 @@ impl<T: frame_system::Config> ghost_claims::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `896`
// Estimated: `16164`
// Minimum execution time: 745_301_000 picoseconds.
Weight::from_parts(758_040_000, 0)
// 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))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_networks`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -30,6 +30,7 @@
// --repeat=20
// --pallet=ghost_networks
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_networks.rs
@ -47,35 +48,32 @@ pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `i` is `[1, 20]`.
/// The range of component `j` is `[1, 150]`.
/// The range of component `k` is `[1, 20]`.
fn register_network(_i: u32, j: u32, k: u32, ) -> Weight {
fn register_network(i: u32, j: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `109`
// Estimated: `3574`
// Minimum execution time: 48_419_000 picoseconds.
Weight::from_parts(35_655_823, 0)
// Minimum execution time: 44_464_000 picoseconds.
Weight::from_parts(44_802_179, 0)
.saturating_add(Weight::from_parts(0, 3574))
// Standard Error: 1_212
.saturating_add(Weight::from_parts(96_762, 0).saturating_mul(j.into()))
// Standard Error: 9_235
.saturating_add(Weight::from_parts(1_460_410, 0).saturating_mul(k.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
// Standard Error: 11_381
.saturating_add(Weight::from_parts(42_872, 0).saturating_mul(i.into()))
// Standard Error: 1_492
.saturating_add(Weight::from_parts(8_794, 0).saturating_mul(j.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 20]`.
fn update_network_name(_n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_422_000 picoseconds.
Weight::from_parts(49_987_541, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 50_224_000 picoseconds.
Weight::from_parts(54_405_362, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -84,13 +82,13 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// The range of component `n` is `[1, 150]`.
fn update_network_endpoint(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_651_000 picoseconds.
Weight::from_parts(50_776_912, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Standard Error: 1_062
.saturating_add(Weight::from_parts(838, 0).saturating_mul(n.into()))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 50_598_000 picoseconds.
Weight::from_parts(54_951_352, 0)
.saturating_add(Weight::from_parts(0, 3760))
// Standard Error: 10_596
.saturating_add(Weight::from_parts(11_691, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -98,35 +96,23 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_finality_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_080_000 picoseconds.
Weight::from_parts(51_781_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 49_089_000 picoseconds.
Weight::from_parts(50_797_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_rate_limit_delay() -> Weight {
fn update_network_release_delay() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_950_000 picoseconds.
Weight::from_parts(48_925_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_network_block_distance() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_324_000 picoseconds.
Weight::from_parts(50_801_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 49_606_000 picoseconds.
Weight::from_parts(50_371_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -134,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`)
fn update_network_type() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 46_962_000 picoseconds.
Weight::from_parts(47_729_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 48_135_000 picoseconds.
Weight::from_parts(48_619_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -146,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`)
fn update_network_gatekeeper() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_728_000 picoseconds.
Weight::from_parts(53_054_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 50_027_000 picoseconds.
Weight::from_parts(51_212_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -158,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`)
fn update_network_topic_name() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_632_000 picoseconds.
Weight::from_parts(49_954_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 50_686_000 picoseconds.
Weight::from_parts(52_276_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -170,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`)
fn update_incoming_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_660_000 picoseconds.
Weight::from_parts(53_763_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 48_485_000 picoseconds.
Weight::from_parts(49_672_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -182,38 +168,24 @@ impl<T: frame_system::Config> ghost_networks::WeightInfo for WeightInfo<T> {
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_outgoing_network_fee() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 48_164_000 picoseconds.
Weight::from_parts(48_953_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 48_926_000 picoseconds.
Weight::from_parts(49_482_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn update_avg_block_speed() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 47_789_000 picoseconds.
Weight::from_parts(52_131_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostNetworks::NetworkIndexes` (r:1 w:1)
/// Proof: `GhostNetworks::NetworkIndexes` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostNetworks::Networks` (r:1 w:1)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn remove_network() -> Weight {
// Proof Size summary in bytes:
// Measured: `339`
// Estimated: `3804`
// Minimum execution time: 49_720_000 picoseconds.
Weight::from_parts(50_526_000, 0)
.saturating_add(Weight::from_parts(0, 3804))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
// Measured: `295`
// Estimated: `3760`
// Minimum execution time: 45_163_000 picoseconds.
Weight::from_parts(45_822_000, 0)
.saturating_add(Weight::from_parts(0, 3760))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `ghost_slow_clap`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2026-02-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 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
@ -46,98 +46,80 @@ use core::marker::PhantomData;
/// Weight functions for `ghost_slow_clap`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_slow_clap::WeightInfo for WeightInfo<T> {
/// Storage: `GhostNetworks::Networks` (r:1 w:0)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:1)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplauseDetails` (r:1 w:1)
/// Proof: `GhostSlowClaps::ApplauseDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::Authorities` (r:1 w:0)
/// Proof: `GhostSlowClaps::Authorities` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::DisabledAuthorityIndexes` (r:1 w:0)
/// Proof: `GhostSlowClaps::DisabledAuthorityIndexes` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::TotalExposure` (r:1 w:0)
/// Proof: `GhostSlowClaps::TotalExposure` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::CurrentEra` (r:1 w:0)
/// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:1 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `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: `GhostSlowClaps::Authorities` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::AuthorityInfoInSession` (r:1 w:0)
/// Proof: `GhostSlowClaps::AuthorityInfoInSession` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ApplausesForTransaction` (r:1 w:0)
/// Proof: `GhostSlowClaps::ApplausesForTransaction` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::ReceivedClaps` (r:1 w:0)
/// Proof: `GhostSlowClaps::ReceivedClaps` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// The range of component `k` is `[1, 100]`.
/// The range of component `j` is `[1, 20]`.
fn slow_clap(k: u32, j: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `1417`
// Estimated: `4882`
// Minimum execution time: 305_397_000 picoseconds.
Weight::from_parts(310_207_000, 0)
.saturating_add(Weight::from_parts(0, 4882))
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(6))
// Measured: `372 + j * (19 ±0)`
// Estimated: `3853 + j * (19 ±0)`
// 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: `Session::CurrentIndex` (r:1 w:0)
/// Proof: `Session::CurrentIndex` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::LatestExecutedBlock` (r:1 w:0)
/// Proof: `GhostSlowClaps::LatestExecutedBlock` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `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)
/// Proof: `GhostNetworks::Networks` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::BlockCommitments` (r:1 w:1)
/// Proof: `GhostSlowClaps::BlockCommitments` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn commit_block() -> Weight {
/// Storage: `GhostSlowClaps::Companions` (r:0 w:1)
/// Proof: `GhostSlowClaps::Companions` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `GhostSlowClaps::CompanionDetails` (r:0 w:1)
/// Proof: `GhostSlowClaps::CompanionDetails` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn propose_companion() -> Weight {
// Proof Size summary in bytes:
// Measured: `701`
// Estimated: `4166`
// Minimum execution time: 88_007_000 picoseconds.
Weight::from_parts(89_662_000, 0)
.saturating_add(Weight::from_parts(0, 4166))
.saturating_add(T::DbWeight::get().reads(4))
// Measured: `634`
// Estimated: `4099`
// Minimum execution time: 167_770_000 picoseconds.
Weight::from_parts(168_826_000, 0)
.saturating_add(Weight::from_parts(0, 4099))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
}
/// 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: `Staking::ActiveEra` (r:1 w:0)
/// Proof: `Staking::ActiveEra` (`max_values`: Some(1), `max_size`: Some(13), added: 508, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakersOverview` (r:100000 w:0)
/// Proof: `Staking::ErasStakersOverview` (`max_values`: None, `max_size`: Some(92), added: 2567, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStakers` (r:100000 w:0)
/// Proof: `Staking::ErasStakers` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Session::Validators` (r:1 w:0)
/// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Offences::ConcurrentReportsIndex` (r:1 w:1)
/// Proof: `Offences::ConcurrentReportsIndex` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Offences::Reports` (r:97959 w:97959)
/// Proof: `Offences::Reports` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashRewardFraction` (r:1 w:0)
/// Proof: `Staking::SlashRewardFraction` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
/// Storage: `Staking::ErasStartSessionIndex` (r:1 w:0)
/// Proof: `Staking::ErasStartSessionIndex` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)
/// Storage: `Staking::Invulnerables` (r:1 w:0)
/// Proof: `Staking::Invulnerables` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Staking::SlashingSpans` (r:97959 w:97959)
/// Proof: `Staking::SlashingSpans` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Staking::DisabledValidators` (r:1 w:1)
/// Proof: `Staking::DisabledValidators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// The range of component `n` is `[1, 100000]`.
/// The range of component `d` is `[0, 100000]`.
fn try_offend_validators(n: u32, d: u32, ) -> Weight {
/// 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: `674`
// Estimated: `1886 + d * (2567 ±0)`
// Minimum execution time: 13_294_008_000 picoseconds.
Weight::from_parts(13_307_595_000, 0)
.saturating_add(Weight::from_parts(0, 1886))
// Standard Error: 1_146_439
.saturating_add(Weight::from_parts(29_632_292, 0).saturating_mul(n.into()))
// Standard Error: 1_146_441
.saturating_add(Weight::from_parts(14_654_685, 0).saturating_mul(d.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().reads((2_u64).saturating_mul(d.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2567).saturating_mul(d.into()))
// 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

@ -1,95 +0,0 @@
// This file is part of Ghost Network.
// Ghost Network is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Ghost Network is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Ghost Network. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `ghost_sudo`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
// Executed Command:
// ./target/release/ghost
// benchmark
// pallet
// --chain=casper-dev
// --steps=50
// --repeat=20
// --pallet=ghost_sudo
// --extrinsic=*
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/casper/src/weights/ghost_sudo.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]
use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;
/// Weight functions for `ghost_sudo`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> ghost_sudo::WeightInfo for WeightInfo<T> {
/// Storage: `GhostSudo::Key` (r:1 w:1)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn set_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 39_580_000 picoseconds.
Weight::from_parts(40_417_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:0)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn sudo() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 43_268_000 picoseconds.
Weight::from_parts(44_283_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:0)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn sudo_as() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 43_238_000 picoseconds.
Weight::from_parts(44_176_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `GhostSudo::Key` (r:1 w:1)
/// Proof: `GhostSudo::Key` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
fn remove_key() -> Weight {
// Proof Size summary in bytes:
// Measured: `165`
// Estimated: `1517`
// Minimum execution time: 35_626_000 picoseconds.
Weight::from_parts(36_888_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
}

View File

@ -3,18 +3,13 @@ pub mod frame_system;
pub mod ghost_claims;
pub mod ghost_networks;
pub mod ghost_slow_clap;
pub mod ghost_sudo;
pub mod pallet_alliance;
pub mod pallet_babe;
pub mod pallet_bags_list;
pub mod pallet_balances;
pub mod pallet_bounties;
pub mod pallet_child_bounties;
pub mod pallet_collective;
pub mod pallet_core_fellowship;
pub mod pallet_election_provider_multi_phase;
pub mod pallet_fast_unstake;
pub mod pallet_grandpa;
pub mod pallet_identity;
pub mod pallet_indices;
pub mod pallet_multisig;
@ -22,13 +17,12 @@ pub mod pallet_nomination_pools;
pub mod pallet_preimage;
pub mod pallet_proxy;
pub mod pallet_ranked_collective;
pub mod pallet_referenda;
// pub mod pallet_referenda;
pub mod pallet_salary;
pub mod pallet_scheduler;
pub mod pallet_session;
pub mod pallet_staking;
pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_utility;
pub mod pallet_vesting;
pub mod pallet_whitelist;

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_alliance`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -63,15 +63,15 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `471 + m * (32 ±0) + p * (36 ±0)`
// Estimated: `6676 + m * (33 ±0) + p * (36 ±0)`
// Minimum execution time: 96_210_000 picoseconds.
Weight::from_parts(97_061_700, 0)
// Minimum execution time: 97_002_000 picoseconds.
Weight::from_parts(98_453_208, 0)
.saturating_add(Weight::from_parts(0, 6676))
// Standard Error: 317
.saturating_add(Weight::from_parts(2_338, 0).saturating_mul(b.into()))
// Standard Error: 3_321
.saturating_add(Weight::from_parts(96_631, 0).saturating_mul(m.into()))
// Standard Error: 3_279
.saturating_add(Weight::from_parts(515_320, 0).saturating_mul(p.into()))
// Standard Error: 326
.saturating_add(Weight::from_parts(1_861, 0).saturating_mul(b.into()))
// Standard Error: 3_409
.saturating_add(Weight::from_parts(104_553, 0).saturating_mul(m.into()))
// Standard Error: 3_366
.saturating_add(Weight::from_parts(554_928, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into()))
@ -86,11 +86,11 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `944 + m * (64 ±0)`
// Estimated: `6676 + m * (64 ±0)`
// Minimum execution time: 83_783_000 picoseconds.
Weight::from_parts(86_525_237, 0)
// Minimum execution time: 83_771_000 picoseconds.
Weight::from_parts(86_230_346, 0)
.saturating_add(Weight::from_parts(0, 6676))
// Standard Error: 2_551
.saturating_add(Weight::from_parts(124_191, 0).saturating_mul(m.into()))
// Standard Error: 2_403
.saturating_add(Weight::from_parts(129_802, 0).saturating_mul(m.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into()))
@ -111,13 +111,13 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `429 + m * (96 ±0) + p * (36 ±0)`
// Estimated: `6676 + m * (97 ±0) + p * (36 ±0)`
// Minimum execution time: 111_922_000 picoseconds.
Weight::from_parts(106_948_472, 0)
// Minimum execution time: 113_902_000 picoseconds.
Weight::from_parts(107_712_061, 0)
.saturating_add(Weight::from_parts(0, 6676))
// Standard Error: 4_455
.saturating_add(Weight::from_parts(163_787, 0).saturating_mul(m.into()))
// Standard Error: 4_344
.saturating_add(Weight::from_parts(576_592, 0).saturating_mul(p.into()))
// Standard Error: 4_237
.saturating_add(Weight::from_parts(184_456, 0).saturating_mul(m.into()))
// Standard Error: 4_132
.saturating_add(Weight::from_parts(590_832, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into()))
@ -140,15 +140,15 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `679 + m * (96 ±0) + p * (42 ±0)`
// Estimated: `6676 + m * (98 ±0) + p * (41 ±0)`
// Minimum execution time: 157_617_000 picoseconds.
Weight::from_parts(153_717_351, 0)
// Minimum execution time: 161_378_000 picoseconds.
Weight::from_parts(156_939_196, 0)
.saturating_add(Weight::from_parts(0, 6676))
// Standard Error: 401
.saturating_add(Weight::from_parts(3_604, 0).saturating_mul(b.into()))
// Standard Error: 4_247
.saturating_add(Weight::from_parts(117_750, 0).saturating_mul(m.into()))
// Standard Error: 4_140
.saturating_add(Weight::from_parts(561_157, 0).saturating_mul(p.into()))
// Standard Error: 327
.saturating_add(Weight::from_parts(3_093, 0).saturating_mul(b.into()))
// Standard Error: 3_460
.saturating_add(Weight::from_parts(142_907, 0).saturating_mul(m.into()))
// Standard Error: 3_373
.saturating_add(Weight::from_parts(574_727, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 98).saturating_mul(m.into()))
@ -174,13 +174,13 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `647 + m * (96 ±0) + p * (41 ±0)`
// Estimated: `6676 + m * (109 ±0) + p * (43 ±0)`
// Minimum execution time: 159_933_000 picoseconds.
Weight::from_parts(147_914_184, 0)
// Minimum execution time: 163_874_000 picoseconds.
Weight::from_parts(155_209_353, 0)
.saturating_add(Weight::from_parts(0, 6676))
// Standard Error: 12_990
.saturating_add(Weight::from_parts(334_224, 0).saturating_mul(m.into()))
// Standard Error: 12_831
.saturating_add(Weight::from_parts(648_247, 0).saturating_mul(p.into()))
// Standard Error: 12_962
.saturating_add(Weight::from_parts(325_062, 0).saturating_mul(m.into()))
// Standard Error: 12_804
.saturating_add(Weight::from_parts(638_122, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(Weight::from_parts(0, 109).saturating_mul(m.into()))
@ -205,15 +205,15 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `428 + m * (96 ±0) + p * (37 ±0)`
// Estimated: `6676 + m * (97 ±0) + p * (36 ±0)`
// Minimum execution time: 114_894_000 picoseconds.
Weight::from_parts(111_420_664, 0)
// Minimum execution time: 117_142_000 picoseconds.
Weight::from_parts(110_028_926, 0)
.saturating_add(Weight::from_parts(0, 6676))
// Standard Error: 400
.saturating_add(Weight::from_parts(1_009, 0).saturating_mul(b.into()))
// Standard Error: 4_280
.saturating_add(Weight::from_parts(157_690, 0).saturating_mul(m.into()))
// Standard Error: 4_126
.saturating_add(Weight::from_parts(558_773, 0).saturating_mul(p.into()))
// Standard Error: 331
.saturating_add(Weight::from_parts(2_288, 0).saturating_mul(b.into()))
// Standard Error: 3_551
.saturating_add(Weight::from_parts(172_027, 0).saturating_mul(m.into()))
// Standard Error: 3_423
.saturating_add(Weight::from_parts(582_787, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 97).saturating_mul(m.into()))
@ -229,13 +229,13 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `115`
// Estimated: `12362`
// Minimum execution time: 90_267_000 picoseconds.
Weight::from_parts(62_422_118, 0)
// Minimum execution time: 94_196_000 picoseconds.
Weight::from_parts(65_225_469, 0)
.saturating_add(Weight::from_parts(0, 12362))
// Standard Error: 3_761
.saturating_add(Weight::from_parts(338_560, 0).saturating_mul(m.into()))
// Standard Error: 3_716
.saturating_add(Weight::from_parts(310_453, 0).saturating_mul(z.into()))
// Standard Error: 3_118
.saturating_add(Weight::from_parts(383_319, 0).saturating_mul(m.into()))
// Standard Error: 3_081
.saturating_add(Weight::from_parts(322_848, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
@ -256,17 +256,17 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
/// The range of component `z` is `[0, 50]`.
fn disband(x: u32, y: u32, z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0 + x * (49 ±0) + y * (51 ±0) + z * (250 ±0)`
// Measured: `0 + x * (48 ±0) + y * (51 ±0) + z * (251 ±0)`
// Estimated: `12362 + x * (2539 ±0) + y * (2539 ±0) + z * (2603 ±1)`
// Minimum execution time: 1_255_117_000 picoseconds.
Weight::from_parts(1_259_045_000, 0)
// Minimum execution time: 1_234_256_000 picoseconds.
Weight::from_parts(16_239_078, 0)
.saturating_add(Weight::from_parts(0, 12362))
// Standard Error: 95_692
.saturating_add(Weight::from_parts(1_972_665, 0).saturating_mul(x.into()))
// Standard Error: 95_231
.saturating_add(Weight::from_parts(1_914_286, 0).saturating_mul(y.into()))
// Standard Error: 190_288
.saturating_add(Weight::from_parts(52_553_932, 0).saturating_mul(z.into()))
// Standard Error: 21_211
.saturating_add(Weight::from_parts(6_672_158, 0).saturating_mul(x.into()))
// Standard Error: 20_961
.saturating_add(Weight::from_parts(6_811_767, 0).saturating_mul(y.into()))
// Standard Error: 41_888
.saturating_add(Weight::from_parts(64_921_111, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into())))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(y.into())))
@ -283,8 +283,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 23_352_000 picoseconds.
Weight::from_parts(23_905_000, 0)
// Minimum execution time: 24_181_000 picoseconds.
Weight::from_parts(24_667_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -294,8 +294,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `180`
// Estimated: `10187`
// Minimum execution time: 39_001_000 picoseconds.
Weight::from_parts(39_888_000, 0)
// Minimum execution time: 38_619_000 picoseconds.
Weight::from_parts(39_318_000, 0)
.saturating_add(Weight::from_parts(0, 10187))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -306,8 +306,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `253`
// Estimated: `10187`
// Minimum execution time: 42_546_000 picoseconds.
Weight::from_parts(43_204_000, 0)
// Minimum execution time: 42_291_000 picoseconds.
Weight::from_parts(42_908_000, 0)
.saturating_add(Weight::from_parts(0, 10187))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -322,10 +322,10 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
/// Proof: `Alliance::DepositOf` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`)
fn join_alliance() -> Weight {
// Proof Size summary in bytes:
// Measured: `402`
// Measured: `440`
// Estimated: `18048`
// Minimum execution time: 155_977_000 picoseconds.
Weight::from_parts(157_644_000, 0)
// Minimum execution time: 157_993_000 picoseconds.
Weight::from_parts(158_860_000, 0)
.saturating_add(Weight::from_parts(0, 18048))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
@ -336,10 +336,10 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
/// Proof: `Alliance::UnscrupulousAccounts` (`max_values`: Some(1), `max_size`: Some(3202), added: 3697, mode: `MaxEncodedLen`)
fn nominate_ally() -> Weight {
// Proof Size summary in bytes:
// Measured: `301`
// Measured: `339`
// Estimated: `18048`
// Minimum execution time: 94_314_000 picoseconds.
Weight::from_parts(95_782_000, 0)
// Minimum execution time: 92_924_000 picoseconds.
Weight::from_parts(93_984_000, 0)
.saturating_add(Weight::from_parts(0, 18048))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(1))
@ -356,8 +356,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `340`
// Estimated: `12362`
// Minimum execution time: 90_026_000 picoseconds.
Weight::from_parts(91_012_000, 0)
// Minimum execution time: 89_941_000 picoseconds.
Weight::from_parts(90_683_000, 0)
.saturating_add(Weight::from_parts(0, 12362))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(4))
@ -376,8 +376,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `340`
// Estimated: `23734`
// Minimum execution time: 114_599_000 picoseconds.
Weight::from_parts(115_242_000, 0)
// Minimum execution time: 115_079_000 picoseconds.
Weight::from_parts(116_006_000, 0)
.saturating_add(Weight::from_parts(0, 23734))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
@ -394,8 +394,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `621`
// Estimated: `6676`
// Minimum execution time: 138_656_000 picoseconds.
Weight::from_parts(139_830_000, 0)
// Minimum execution time: 141_769_000 picoseconds.
Weight::from_parts(142_752_000, 0)
.saturating_add(Weight::from_parts(0, 6676))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
@ -416,8 +416,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `604`
// Estimated: `18048`
// Minimum execution time: 208_754_000 picoseconds.
Weight::from_parts(210_357_000, 0)
// Minimum execution time: 211_219_000 picoseconds.
Weight::from_parts(212_953_000, 0)
.saturating_add(Weight::from_parts(0, 18048))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(5))
@ -432,13 +432,13 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `180`
// Estimated: `27187`
// Minimum execution time: 20_857_000 picoseconds.
Weight::from_parts(21_043_000, 0)
// Minimum execution time: 21_699_000 picoseconds.
Weight::from_parts(21_893_000, 0)
.saturating_add(Weight::from_parts(0, 27187))
// Standard Error: 10_346
.saturating_add(Weight::from_parts(3_350_295, 0).saturating_mul(n.into()))
// Standard Error: 4_052
.saturating_add(Weight::from_parts(222_910, 0).saturating_mul(l.into()))
// Standard Error: 10_128
.saturating_add(Weight::from_parts(3_357_496, 0).saturating_mul(n.into()))
// Standard Error: 3_966
.saturating_add(Weight::from_parts(216_176, 0).saturating_mul(l.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -452,13 +452,13 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + l * (100 ±0) + n * (289 ±0)`
// Estimated: `27187`
// Minimum execution time: 20_722_000 picoseconds.
Weight::from_parts(20_898_000, 0)
// Minimum execution time: 21_895_000 picoseconds.
Weight::from_parts(22_138_000, 0)
.saturating_add(Weight::from_parts(0, 27187))
// Standard Error: 641_628
.saturating_add(Weight::from_parts(64_136_091, 0).saturating_mul(n.into()))
// Standard Error: 251_289
.saturating_add(Weight::from_parts(310_793, 0).saturating_mul(l.into()))
// Standard Error: 632_441
.saturating_add(Weight::from_parts(63_177_711, 0).saturating_mul(n.into()))
// Standard Error: 247_692
.saturating_add(Weight::from_parts(273_557, 0).saturating_mul(l.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -474,8 +474,8 @@ impl<T: frame_system::Config> pallet_alliance::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `340`
// Estimated: `18048`
// Minimum execution time: 112_174_000 picoseconds.
Weight::from_parts(114_408_000, 0)
// Minimum execution time: 111_710_000 picoseconds.
Weight::from_parts(113_642_000, 0)
.saturating_add(Weight::from_parts(0, 18048))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))

View File

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

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_bags_list`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -58,8 +58,8 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1612`
// Estimated: `11506`
// Minimum execution time: 205_937_000 picoseconds.
Weight::from_parts(208_759_000, 0)
// Minimum execution time: 216_814_000 picoseconds.
Weight::from_parts(218_794_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
@ -76,8 +76,8 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1506`
// Estimated: `8877`
// Minimum execution time: 200_730_000 picoseconds.
Weight::from_parts(202_176_000, 0)
// Minimum execution time: 210_157_000 picoseconds.
Weight::from_parts(214_628_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
@ -96,8 +96,8 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `1815`
// Estimated: `11506`
// Minimum execution time: 242_324_000 picoseconds.
Weight::from_parts(245_160_000, 0)
// Minimum execution time: 255_261_000 picoseconds.
Weight::from_parts(258_576_000, 0)
.saturating_add(Weight::from_parts(0, 11506))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(6))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -52,8 +52,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 186_251_000 picoseconds.
Weight::from_parts(188_493_000, 0)
// Minimum execution time: 190_705_000 picoseconds.
Weight::from_parts(192_096_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -64,8 +64,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 148_070_000 picoseconds.
Weight::from_parts(149_658_000, 0)
// Minimum execution time: 151_366_000 picoseconds.
Weight::from_parts(152_572_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -74,10 +74,10 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_set_balance_creating() -> Weight {
// Proof Size summary in bytes:
// Measured: `207`
// Measured: `240`
// Estimated: `3593`
// Minimum execution time: 60_874_000 picoseconds.
Weight::from_parts(61_463_000, 0)
// Minimum execution time: 60_457_000 picoseconds.
Weight::from_parts(62_112_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -86,10 +86,10 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_set_balance_killing() -> Weight {
// Proof Size summary in bytes:
// Measured: `207`
// Measured: `240`
// Estimated: `3593`
// Minimum execution time: 79_499_000 picoseconds.
Weight::from_parts(81_083_000, 0)
// Minimum execution time: 81_215_000 picoseconds.
Weight::from_parts(82_316_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -98,10 +98,10 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `103`
// Measured: `140`
// Estimated: `6196`
// Minimum execution time: 198_506_000 picoseconds.
Weight::from_parts(199_817_000, 0)
// Minimum execution time: 201_571_000 picoseconds.
Weight::from_parts(204_225_000, 0)
.saturating_add(Weight::from_parts(0, 6196))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@ -112,8 +112,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `3593`
// Minimum execution time: 184_028_000 picoseconds.
Weight::from_parts(185_727_000, 0)
// Minimum execution time: 187_576_000 picoseconds.
Weight::from_parts(188_504_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -122,10 +122,10 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_unreserve() -> Weight {
// Proof Size summary in bytes:
// Measured: `207`
// Measured: `240`
// Estimated: `3593`
// Minimum execution time: 72_546_000 picoseconds.
Weight::from_parts(73_559_000, 0)
// Minimum execution time: 73_195_000 picoseconds.
Weight::from_parts(74_326_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -137,11 +137,11 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + u * (135 ±0)`
// Estimated: `990 + u * (2603 ±0)`
// Minimum execution time: 69_445_000 picoseconds.
Weight::from_parts(69_575_000, 0)
// Minimum execution time: 70_352_000 picoseconds.
Weight::from_parts(70_896_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 35_042
.saturating_add(Weight::from_parts(53_275_288, 0).saturating_mul(u.into()))
// Standard Error: 33_025
.saturating_add(Weight::from_parts(54_012_098, 0).saturating_mul(u.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(u.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(u.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(u.into()))
@ -150,24 +150,24 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 23_988_000 picoseconds.
Weight::from_parts(24_623_000, 0)
// Minimum execution time: 24_157_000 picoseconds.
Weight::from_parts(24_793_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_allow_death() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 117_406_000 picoseconds.
Weight::from_parts(118_538_000, 0)
// Minimum execution time: 117_793_000 picoseconds.
Weight::from_parts(119_425_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn burn_keep_alive() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 80_259_000 picoseconds.
Weight::from_parts(81_323_000, 0)
// Minimum execution time: 80_675_000 picoseconds.
Weight::from_parts(81_648_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
}

View File

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

View File

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

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_collective`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -61,13 +61,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + m * (3232 ±0) + p * (3190 ±0)`
// Estimated: `15691 + m * (1967 ±23) + p * (4332 ±23)`
// Minimum execution time: 52_928_000 picoseconds.
Weight::from_parts(53_873_000, 0)
// Minimum execution time: 55_767_000 picoseconds.
Weight::from_parts(56_636_000, 0)
.saturating_add(Weight::from_parts(0, 15691))
// Standard Error: 216_665
.saturating_add(Weight::from_parts(16_472_744, 0).saturating_mul(m.into()))
// Standard Error: 216_665
.saturating_add(Weight::from_parts(28_709_607, 0).saturating_mul(p.into()))
// Standard Error: 160_794
.saturating_add(Weight::from_parts(11_373_581, 0).saturating_mul(m.into()))
// Standard Error: 160_794
.saturating_add(Weight::from_parts(24_336_121, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes(2))
@ -83,13 +83,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `32 + m * (32 ±0)`
// Estimated: `1518 + m * (32 ±0)`
// Minimum execution time: 52_575_000 picoseconds.
Weight::from_parts(50_169_848, 0)
// Minimum execution time: 53_501_000 picoseconds.
Weight::from_parts(50_367_784, 0)
.saturating_add(Weight::from_parts(0, 1518))
// Standard Error: 120
.saturating_add(Weight::from_parts(4_820, 0).saturating_mul(b.into()))
// Standard Error: 1_243
.saturating_add(Weight::from_parts(34_828, 0).saturating_mul(m.into()))
// Standard Error: 53
.saturating_add(Weight::from_parts(4_666, 0).saturating_mul(b.into()))
// Standard Error: 547
.saturating_add(Weight::from_parts(38_691, 0).saturating_mul(m.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into()))
}
@ -103,13 +103,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `32 + m * (32 ±0)`
// Estimated: `3498 + m * (32 ±0)`
// Minimum execution time: 63_607_000 picoseconds.
Weight::from_parts(60_608_181, 0)
// Minimum execution time: 64_064_000 picoseconds.
Weight::from_parts(59_986_733, 0)
.saturating_add(Weight::from_parts(0, 3498))
// Standard Error: 114
.saturating_add(Weight::from_parts(4_472, 0).saturating_mul(b.into()))
// Standard Error: 1_179
.saturating_add(Weight::from_parts(58_380, 0).saturating_mul(m.into()))
// Standard Error: 80
.saturating_add(Weight::from_parts(5_165, 0).saturating_mul(b.into()))
// Standard Error: 833
.saturating_add(Weight::from_parts(50_309, 0).saturating_mul(m.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(m.into()))
}
@ -130,15 +130,15 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `322 + m * (32 ±0) + p * (36 ±0)`
// Estimated: `3714 + m * (33 ±0) + p * (36 ±0)`
// Minimum execution time: 81_855_000 picoseconds.
Weight::from_parts(76_036_301, 0)
// Minimum execution time: 81_966_000 picoseconds.
Weight::from_parts(76_356_962, 0)
.saturating_add(Weight::from_parts(0, 3714))
// Standard Error: 294
.saturating_add(Weight::from_parts(11_879, 0).saturating_mul(b.into()))
// Standard Error: 3_074
.saturating_add(Weight::from_parts(44_888, 0).saturating_mul(m.into()))
// Standard Error: 3_035
.saturating_add(Weight::from_parts(601_296, 0).saturating_mul(p.into()))
// Standard Error: 250
.saturating_add(Weight::from_parts(10_378, 0).saturating_mul(b.into()))
// Standard Error: 2_613
.saturating_add(Weight::from_parts(46_062, 0).saturating_mul(m.into()))
// Standard Error: 2_579
.saturating_add(Weight::from_parts(612_264, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(Weight::from_parts(0, 33).saturating_mul(m.into()))
@ -153,11 +153,11 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `771 + m * (64 ±0)`
// Estimated: `4235 + m * (64 ±0)`
// Minimum execution time: 73_450_000 picoseconds.
Weight::from_parts(75_584_927, 0)
// Minimum execution time: 73_065_000 picoseconds.
Weight::from_parts(75_774_038, 0)
.saturating_add(Weight::from_parts(0, 4235))
// Standard Error: 3_243
.saturating_add(Weight::from_parts(100_798, 0).saturating_mul(m.into()))
// Standard Error: 3_051
.saturating_add(Weight::from_parts(101_825, 0).saturating_mul(m.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 64).saturating_mul(m.into()))
@ -176,13 +176,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `360 + m * (64 ±0) + p * (36 ±0)`
// Estimated: `3805 + m * (65 ±0) + p * (36 ±0)`
// Minimum execution time: 88_475_000 picoseconds.
Weight::from_parts(86_864_180, 0)
// Minimum execution time: 86_413_000 picoseconds.
Weight::from_parts(84_843_269, 0)
.saturating_add(Weight::from_parts(0, 3805))
// Standard Error: 3_074
.saturating_add(Weight::from_parts(61_103, 0).saturating_mul(m.into()))
// Standard Error: 2_997
.saturating_add(Weight::from_parts(521_770, 0).saturating_mul(p.into()))
// Standard Error: 3_251
.saturating_add(Weight::from_parts(54_550, 0).saturating_mul(m.into()))
// Standard Error: 3_170
.saturating_add(Weight::from_parts(539_260, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 65).saturating_mul(m.into()))
@ -203,13 +203,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `662 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)`
// Estimated: `3979 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)`
// Minimum execution time: 122_041_000 picoseconds.
Weight::from_parts(119_856_590, 0)
// Minimum execution time: 123_381_000 picoseconds.
Weight::from_parts(119_321_351, 0)
.saturating_add(Weight::from_parts(0, 3979))
// Standard Error: 667
.saturating_add(Weight::from_parts(9_450, 0).saturating_mul(b.into()))
// Standard Error: 6_875
.saturating_add(Weight::from_parts(722_820, 0).saturating_mul(p.into()))
// Standard Error: 643
.saturating_add(Weight::from_parts(11_500, 0).saturating_mul(b.into()))
// Standard Error: 6_632
.saturating_add(Weight::from_parts(717_414, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into()))
@ -232,13 +232,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `458 + m * (48 ±0) + p * (36 ±0)`
// Estimated: `3898 + m * (49 ±0) + p * (36 ±0)`
// Minimum execution time: 94_729_000 picoseconds.
Weight::from_parts(94_114_064, 0)
// Minimum execution time: 93_038_000 picoseconds.
Weight::from_parts(92_223_927, 0)
.saturating_add(Weight::from_parts(0, 3898))
// Standard Error: 2_829
.saturating_add(Weight::from_parts(44_128, 0).saturating_mul(m.into()))
// Standard Error: 2_759
.saturating_add(Weight::from_parts(534_877, 0).saturating_mul(p.into()))
// Standard Error: 3_126
.saturating_add(Weight::from_parts(42_141, 0).saturating_mul(m.into()))
// Standard Error: 3_048
.saturating_add(Weight::from_parts(555_724, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 49).saturating_mul(m.into()))
@ -261,13 +261,13 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `682 + b * (1 ±0) + m * (64 ±0) + p * (40 ±0)`
// Estimated: `3999 + b * (1 ±0) + m * (66 ±0) + p * (40 ±0)`
// Minimum execution time: 130_654_000 picoseconds.
Weight::from_parts(128_611_780, 0)
// Minimum execution time: 129_214_000 picoseconds.
Weight::from_parts(128_136_995, 0)
.saturating_add(Weight::from_parts(0, 3999))
// Standard Error: 681
.saturating_add(Weight::from_parts(10_601, 0).saturating_mul(b.into()))
// Standard Error: 7_024
.saturating_add(Weight::from_parts(719_626, 0).saturating_mul(p.into()))
// Standard Error: 628
.saturating_add(Weight::from_parts(8_498, 0).saturating_mul(b.into()))
// Standard Error: 6_472
.saturating_add(Weight::from_parts(726_573, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 1).saturating_mul(b.into()))
@ -285,11 +285,11 @@ impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `189 + p * (32 ±0)`
// Estimated: `1674 + p * (32 ±0)`
// Minimum execution time: 51_098_000 picoseconds.
Weight::from_parts(51_768_978, 0)
// Minimum execution time: 51_418_000 picoseconds.
Weight::from_parts(52_271_519, 0)
.saturating_add(Weight::from_parts(0, 1674))
// Standard Error: 1_740
.saturating_add(Weight::from_parts(514_349, 0).saturating_mul(p.into()))
// Standard Error: 2_554
.saturating_add(Weight::from_parts(524_745, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(p.into()))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_core_fellowship`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-07-31, 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
@ -52,8 +52,8 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 24_114_000 picoseconds.
Weight::from_parts(24_650_000, 0)
// Minimum execution time: 24_436_000 picoseconds.
Weight::from_parts(24_940_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -73,10 +73,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn bump_offboard() -> Weight {
// Proof Size summary in bytes:
// Measured: `66531`
// Measured: `66884`
// Estimated: `69046`
// Minimum execution time: 369_406_000 picoseconds.
Weight::from_parts(378_675_000, 0)
// Minimum execution time: 387_602_000 picoseconds.
Weight::from_parts(391_884_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
@ -97,10 +97,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCollective::IndexToId` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn bump_demote() -> Weight {
// Proof Size summary in bytes:
// Measured: `66641`
// Measured: `66925`
// Estimated: `69046`
// Minimum execution time: 377_950_000 picoseconds.
Weight::from_parts(383_926_000, 0)
// Minimum execution time: 395_467_000 picoseconds.
Weight::from_parts(399_507_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
@ -111,10 +111,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCore::Member` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
fn set_active() -> Weight {
// Proof Size summary in bytes:
// Measured: `493`
// Measured: `565`
// Estimated: `3514`
// Minimum execution time: 66_378_000 picoseconds.
Weight::from_parts(67_186_000, 0)
// Minimum execution time: 66_931_000 picoseconds.
Weight::from_parts(68_036_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -131,10 +131,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn induct() -> Weight {
// Proof Size summary in bytes:
// Measured: `251`
// Measured: `530`
// Estimated: `3514`
// Minimum execution time: 97_387_000 picoseconds.
Weight::from_parts(98_825_000, 0)
// Minimum execution time: 113_787_000 picoseconds.
Weight::from_parts(115_087_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(5))
@ -155,10 +155,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCollective::IdToIndex` (`max_values`: None, `max_size`: Some(54), added: 2529, mode: `MaxEncodedLen`)
fn promote() -> Weight {
// Proof Size summary in bytes:
// Measured: `66509`
// Measured: `66636`
// Estimated: `69046`
// Minimum execution time: 355_360_000 picoseconds.
Weight::from_parts(365_158_000, 0)
// Minimum execution time: 366_918_000 picoseconds.
Weight::from_parts(369_534_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(6))
@ -171,10 +171,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn offboard() -> Weight {
// Proof Size summary in bytes:
// Measured: `398`
// Measured: `552`
// Estimated: `3514`
// Minimum execution time: 68_103_000 picoseconds.
Weight::from_parts(68_840_000, 0)
// Minimum execution time: 69_301_000 picoseconds.
Weight::from_parts(70_382_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@ -185,10 +185,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCollective::Members` (`max_values`: None, `max_size`: Some(42), added: 2517, mode: `MaxEncodedLen`)
fn import() -> Weight {
// Proof Size summary in bytes:
// Measured: `418`
// Measured: `490`
// Estimated: `3514`
// Minimum execution time: 62_920_000 picoseconds.
Weight::from_parts(63_842_000, 0)
// Minimum execution time: 63_841_000 picoseconds.
Weight::from_parts(64_810_000, 0)
.saturating_add(Weight::from_parts(0, 3514))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -201,10 +201,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn approve() -> Weight {
// Proof Size summary in bytes:
// Measured: `66100`
// Measured: `66172`
// Estimated: `69046`
// Minimum execution time: 295_396_000 picoseconds.
Weight::from_parts(300_948_000, 0)
// Minimum execution time: 301_638_000 picoseconds.
Weight::from_parts(303_373_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
@ -215,10 +215,10 @@ impl<T: frame_system::Config> pallet_core_fellowship::WeightInfo for WeightInfo<
/// Proof: `CultCore::MemberEvidence` (`max_values`: None, `max_size`: Some(65581), added: 68056, mode: `MaxEncodedLen`)
fn submit_evidence() -> Weight {
// Proof Size summary in bytes:
// Measured: `184`
// Measured: `151`
// Estimated: `69046`
// Minimum execution time: 246_746_000 picoseconds.
Weight::from_parts(254_720_000, 0)
// Minimum execution time: 253_463_000 picoseconds.
Weight::from_parts(255_091_000, 0)
.saturating_add(Weight::from_parts(0, 69046))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_election_provider_multi_phase`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `918`
// Estimated: `3481`
// Minimum execution time: 60_852_000 picoseconds.
Weight::from_parts(61_910_000, 0)
// Minimum execution time: 59_356_000 picoseconds.
Weight::from_parts(60_470_000, 0)
.saturating_add(Weight::from_parts(0, 3481))
.saturating_add(T::DbWeight::get().reads(8))
}
@ -79,8 +79,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `43`
// Estimated: `1528`
// Minimum execution time: 38_791_000 picoseconds.
Weight::from_parts(39_533_000, 0)
// Minimum execution time: 38_516_000 picoseconds.
Weight::from_parts(39_173_000, 0)
.saturating_add(Weight::from_parts(0, 1528))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -93,8 +93,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `43`
// Estimated: `1528`
// Minimum execution time: 41_607_000 picoseconds.
Weight::from_parts(42_967_000, 0)
// Minimum execution time: 41_540_000 picoseconds.
Weight::from_parts(42_546_000, 0)
.saturating_add(Weight::from_parts(0, 1528))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -107,8 +107,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 103_577_000 picoseconds.
Weight::from_parts(104_725_000, 0)
// Minimum execution time: 104_874_000 picoseconds.
Weight::from_parts(106_341_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
@ -119,8 +119,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `3593`
// Minimum execution time: 72_735_000 picoseconds.
Weight::from_parts(73_464_000, 0)
// Minimum execution time: 72_128_000 picoseconds.
Weight::from_parts(72_889_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -137,11 +137,11 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 937_928_000 picoseconds.
Weight::from_parts(946_881_000, 0)
// Minimum execution time: 935_144_000 picoseconds.
Weight::from_parts(946_333_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 4_742
.saturating_add(Weight::from_parts(737_679, 0).saturating_mul(v.into()))
// Standard Error: 4_610
.saturating_add(Weight::from_parts(742_473, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().writes(3))
}
/// Storage: `ElectionProviderMultiPhase::SignedSubmissionIndices` (r:1 w:1)
@ -168,13 +168,13 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `266 + a * (768 ±0) + d * (48 ±0)`
// Estimated: `3818 + a * (768 ±0) + d * (49 ±0)`
// Minimum execution time: 818_624_000 picoseconds.
Weight::from_parts(48_511_844, 0)
// Minimum execution time: 807_366_000 picoseconds.
Weight::from_parts(33_682_717, 0)
.saturating_add(Weight::from_parts(0, 3818))
// Standard Error: 9_830
.saturating_add(Weight::from_parts(1_291_925, 0).saturating_mul(a.into()))
// Standard Error: 14_735
.saturating_add(Weight::from_parts(348_448, 0).saturating_mul(d.into()))
// Standard Error: 11_235
.saturating_add(Weight::from_parts(1_310_189, 0).saturating_mul(a.into()))
// Standard Error: 16_841
.saturating_add(Weight::from_parts(317_382, 0).saturating_mul(d.into()))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(8))
.saturating_add(Weight::from_parts(0, 768).saturating_mul(a.into()))
@ -198,8 +198,8 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `1157`
// Estimated: `2642`
// Minimum execution time: 175_864_000 picoseconds.
Weight::from_parts(177_232_000, 0)
// Minimum execution time: 177_774_000 picoseconds.
Weight::from_parts(180_008_000, 0)
.saturating_add(Weight::from_parts(0, 2642))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(3))
@ -226,13 +226,13 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `148 + t * (32 ±0) + v * (553 ±0)`
// Estimated: `1633 + t * (32 ±0) + v * (553 ±0)`
// Minimum execution time: 12_770_696_000 picoseconds.
Weight::from_parts(12_821_423_000, 0)
// Minimum execution time: 13_641_128_000 picoseconds.
Weight::from_parts(13_688_484_000, 0)
.saturating_add(Weight::from_parts(0, 1633))
// Standard Error: 37_454
.saturating_add(Weight::from_parts(285_569, 0).saturating_mul(v.into()))
// Standard Error: 110_991
.saturating_add(Weight::from_parts(11_933_600, 0).saturating_mul(a.into()))
// Standard Error: 44_289
.saturating_add(Weight::from_parts(251_513, 0).saturating_mul(v.into()))
// Standard Error: 131_245
.saturating_add(Weight::from_parts(12_905_812, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into()))
@ -254,13 +254,13 @@ impl<T: frame_system::Config> pallet_election_provider_multi_phase::WeightInfo f
// Proof Size summary in bytes:
// Measured: `123 + t * (32 ±0) + v * (553 ±0)`
// Estimated: `1608 + t * (32 ±0) + v * (553 ±0)`
// Minimum execution time: 11_048_228_000 picoseconds.
Weight::from_parts(11_087_485_000, 0)
// Minimum execution time: 11_846_347_000 picoseconds.
Weight::from_parts(11_874_580_000, 0)
.saturating_add(Weight::from_parts(0, 1608))
// Standard Error: 35_194
.saturating_add(Weight::from_parts(388_849, 0).saturating_mul(v.into()))
// Standard Error: 104_295
.saturating_add(Weight::from_parts(9_035_405, 0).saturating_mul(a.into()))
// Standard Error: 35_292
.saturating_add(Weight::from_parts(270_578, 0).saturating_mul(v.into()))
// Standard Error: 104_585
.saturating_add(Weight::from_parts(10_407_792, 0).saturating_mul(a.into()))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(t.into()))
.saturating_add(Weight::from_parts(0, 553).saturating_mul(v.into()))

View File

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

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_identity`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -53,11 +53,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `32 + r * (57 ±0)`
// Estimated: `7187`
// Minimum execution time: 35_798_000 picoseconds.
Weight::from_parts(36_289_339, 0)
// Minimum execution time: 36_029_000 picoseconds.
Weight::from_parts(37_138_493, 0)
.saturating_add(Weight::from_parts(0, 7187))
// Standard Error: 1_103
.saturating_add(Weight::from_parts(160_539, 0).saturating_mul(r.into()))
// Standard Error: 811
.saturating_add(Weight::from_parts(143_381, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -68,11 +68,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `6978 + r * (5 ±0)`
// Estimated: `12718`
// Minimum execution time: 422_488_000 picoseconds.
Weight::from_parts(433_997_809, 0)
// Minimum execution time: 426_855_000 picoseconds.
Weight::from_parts(428_183_540, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 7_661
.saturating_add(Weight::from_parts(51_078, 0).saturating_mul(r.into()))
// Standard Error: 5_161
.saturating_add(Weight::from_parts(202_583, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -87,11 +87,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `101`
// Estimated: `12718 + s * (2589 ±0)`
// Minimum execution time: 37_449_000 picoseconds.
Weight::from_parts(90_911_440, 0)
// Minimum execution time: 38_909_000 picoseconds.
Weight::from_parts(93_060_862, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 14_352
.saturating_add(Weight::from_parts(12_452_243, 0).saturating_mul(s.into()))
// Standard Error: 13_890
.saturating_add(Weight::from_parts(13_055_562, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into())))
.saturating_add(T::DbWeight::get().writes(1))
@ -109,11 +109,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `194 + p * (32 ±0)`
// Estimated: `12718`
// Minimum execution time: 36_671_000 picoseconds.
Weight::from_parts(85_354_944, 0)
// Minimum execution time: 38_393_000 picoseconds.
Weight::from_parts(89_242_199, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 13_167
.saturating_add(Weight::from_parts(4_989_423, 0).saturating_mul(p.into()))
// Standard Error: 12_183
.saturating_add(Weight::from_parts(5_292_462, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
@ -130,13 +130,13 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `7070 + r * (5 ±0) + s * (32 ±0)`
// Estimated: `12718`
// Minimum execution time: 209_341_000 picoseconds.
Weight::from_parts(186_652_406, 0)
// Minimum execution time: 210_961_000 picoseconds.
Weight::from_parts(188_823_375, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 6_417
.saturating_add(Weight::from_parts(304_685, 0).saturating_mul(r.into()))
// Standard Error: 6_341
.saturating_add(Weight::from_parts(4_994_949, 0).saturating_mul(s.into()))
// Standard Error: 7_526
.saturating_add(Weight::from_parts(329_188, 0).saturating_mul(r.into()))
// Standard Error: 7_436
.saturating_add(Weight::from_parts(5_350_981, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@ -150,11 +150,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `6968 + r * (57 ±0)`
// Estimated: `12718`
// Minimum execution time: 291_282_000 picoseconds.
Weight::from_parts(296_670_458, 0)
// Minimum execution time: 298_678_000 picoseconds.
Weight::from_parts(301_034_667, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 6_436
.saturating_add(Weight::from_parts(171_191, 0).saturating_mul(r.into()))
// Standard Error: 3_406
.saturating_add(Weight::from_parts(174_545, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -165,11 +165,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `6999`
// Estimated: `12718`
// Minimum execution time: 284_020_000 picoseconds.
Weight::from_parts(287_345_725, 0)
// Minimum execution time: 292_089_000 picoseconds.
Weight::from_parts(294_952_996, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 5_507
.saturating_add(Weight::from_parts(101_486, 0).saturating_mul(r.into()))
// Standard Error: 5_162
.saturating_add(Weight::from_parts(79_491, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -180,11 +180,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `89 + r * (57 ±0)`
// Estimated: `7187`
// Minimum execution time: 25_410_000 picoseconds.
Weight::from_parts(26_240_051, 0)
// Minimum execution time: 26_819_000 picoseconds.
Weight::from_parts(27_445_527, 0)
.saturating_add(Weight::from_parts(0, 7187))
// Standard Error: 1_706
.saturating_add(Weight::from_parts(132_567, 0).saturating_mul(r.into()))
// Standard Error: 886
.saturating_add(Weight::from_parts(132_840, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -195,11 +195,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `89 + r * (57 ±0)`
// Estimated: `7187`
// Minimum execution time: 24_984_000 picoseconds.
Weight::from_parts(25_699_493, 0)
// Minimum execution time: 26_061_000 picoseconds.
Weight::from_parts(27_222_451, 0)
.saturating_add(Weight::from_parts(0, 7187))
// Standard Error: 673
.saturating_add(Weight::from_parts(140_957, 0).saturating_mul(r.into()))
// Standard Error: 1_137
.saturating_add(Weight::from_parts(133_491, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -210,11 +210,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `89 + r * (57 ±0)`
// Estimated: `7187`
// Minimum execution time: 24_378_000 picoseconds.
Weight::from_parts(25_057_857, 0)
// Minimum execution time: 25_767_000 picoseconds.
Weight::from_parts(26_674_843, 0)
.saturating_add(Weight::from_parts(0, 7187))
// Standard Error: 959
.saturating_add(Weight::from_parts(143_385, 0).saturating_mul(r.into()))
// Standard Error: 1_009
.saturating_add(Weight::from_parts(133_509, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -227,11 +227,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `7046 + r * (57 ±0)`
// Estimated: `12718`
// Minimum execution time: 365_166_000 picoseconds.
Weight::from_parts(370_040_326, 0)
// Minimum execution time: 371_609_000 picoseconds.
Weight::from_parts(373_810_252, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 6_899
.saturating_add(Weight::from_parts(164_155, 0).saturating_mul(r.into()))
// Standard Error: 2_210
.saturating_add(Weight::from_parts(154_120, 0).saturating_mul(r.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -249,13 +249,13 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `7277 + r * (5 ±0) + s * (32 ±0)`
// Estimated: `12718`
// Minimum execution time: 259_547_000 picoseconds.
Weight::from_parts(237_822_940, 0)
// Minimum execution time: 265_911_000 picoseconds.
Weight::from_parts(241_271_501, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 6_465
.saturating_add(Weight::from_parts(333_655, 0).saturating_mul(r.into()))
// Standard Error: 6_388
.saturating_add(Weight::from_parts(5_052_675, 0).saturating_mul(s.into()))
// Standard Error: 7_518
.saturating_add(Weight::from_parts(346_780, 0).saturating_mul(r.into()))
// Standard Error: 7_429
.saturating_add(Weight::from_parts(5_410_067, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into())))
@ -271,11 +271,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `475 + s * (36 ±0)`
// Estimated: `12718`
// Minimum execution time: 105_593_000 picoseconds.
Weight::from_parts(117_782_161, 0)
// Minimum execution time: 110_179_000 picoseconds.
Weight::from_parts(121_789_579, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 4_186
.saturating_add(Weight::from_parts(177_713, 0).saturating_mul(s.into()))
// Standard Error: 5_438
.saturating_add(Weight::from_parts(176_419, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -288,11 +288,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `591 + s * (3 ±0)`
// Estimated: `12718`
// Minimum execution time: 48_955_000 picoseconds.
Weight::from_parts(54_147_259, 0)
// Minimum execution time: 50_639_000 picoseconds.
Weight::from_parts(55_486_355, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 1_773
.saturating_add(Weight::from_parts(55_170, 0).saturating_mul(s.into()))
// Standard Error: 1_302
.saturating_add(Weight::from_parts(58_562, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -307,11 +307,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `638 + s * (35 ±0)`
// Estimated: `12718`
// Minimum execution time: 117_798_000 picoseconds.
Weight::from_parts(123_135_959, 0)
// Minimum execution time: 121_808_000 picoseconds.
Weight::from_parts(125_780_211, 0)
.saturating_add(Weight::from_parts(0, 12718))
// Standard Error: 3_618
.saturating_add(Weight::from_parts(129_792, 0).saturating_mul(s.into()))
// Standard Error: 1_897
.saturating_add(Weight::from_parts(146_144, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -326,11 +326,11 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `667 + s * (37 ±0)`
// Estimated: `6723`
// Minimum execution time: 86_156_000 picoseconds.
Weight::from_parts(90_875_435, 0)
// Minimum execution time: 88_672_000 picoseconds.
Weight::from_parts(93_095_231, 0)
.saturating_add(Weight::from_parts(0, 6723))
// Standard Error: 1_793
.saturating_add(Weight::from_parts(140_203, 0).saturating_mul(s.into()))
// Standard Error: 2_603
.saturating_add(Weight::from_parts(141_002, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -340,8 +340,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 27_101_000 picoseconds.
Weight::from_parts(27_734_000, 0)
// Minimum execution time: 28_397_000 picoseconds.
Weight::from_parts(28_848_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -351,8 +351,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `80`
// Estimated: `3517`
// Minimum execution time: 41_425_000 picoseconds.
Weight::from_parts(42_537_000, 0)
// Minimum execution time: 42_692_000 picoseconds.
Weight::from_parts(43_608_000, 0)
.saturating_add(Weight::from_parts(0, 3517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -369,8 +369,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `80`
// Estimated: `12718`
// Minimum execution time: 236_334_000 picoseconds.
Weight::from_parts(238_426_000, 0)
// Minimum execution time: 238_398_000 picoseconds.
Weight::from_parts(243_093_000, 0)
.saturating_add(Weight::from_parts(0, 12718))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(3))
@ -385,8 +385,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `115`
// Estimated: `12718`
// Minimum execution time: 83_197_000 picoseconds.
Weight::from_parts(84_626_000, 0)
// Minimum execution time: 86_312_000 picoseconds.
Weight::from_parts(87_506_000, 0)
.saturating_add(Weight::from_parts(0, 12718))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(3))
@ -397,8 +397,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `115`
// Estimated: `3550`
// Minimum execution time: 53_343_000 picoseconds.
Weight::from_parts(70_796_000, 0)
// Minimum execution time: 55_177_000 picoseconds.
Weight::from_parts(72_684_000, 0)
.saturating_add(Weight::from_parts(0, 3550))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -411,8 +411,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `257`
// Estimated: `12718`
// Minimum execution time: 69_483_000 picoseconds.
Weight::from_parts(71_115_000, 0)
// Minimum execution time: 70_554_000 picoseconds.
Weight::from_parts(71_242_000, 0)
.saturating_add(Weight::from_parts(0, 12718))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -425,8 +425,8 @@ impl<T: frame_system::Config> pallet_identity::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `98`
// Estimated: `12718`
// Minimum execution time: 50_501_000 picoseconds.
Weight::from_parts(51_611_000, 0)
// Minimum execution time: 50_768_000 picoseconds.
Weight::from_parts(52_044_000, 0)
.saturating_add(Weight::from_parts(0, 12718))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_indices`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -52,8 +52,8 @@ impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `3534`
// Minimum execution time: 90_978_000 picoseconds.
Weight::from_parts(97_027_000, 0)
// Minimum execution time: 88_097_000 picoseconds.
Weight::from_parts(89_172_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -66,8 +66,8 @@ impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `341`
// Estimated: `3593`
// Minimum execution time: 132_925_000 picoseconds.
Weight::from_parts(144_721_000, 0)
// Minimum execution time: 131_395_000 picoseconds.
Weight::from_parts(132_310_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@ -78,8 +78,8 @@ impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `238`
// Estimated: `3534`
// Minimum execution time: 89_306_000 picoseconds.
Weight::from_parts(94_702_000, 0)
// Minimum execution time: 87_436_000 picoseconds.
Weight::from_parts(88_420_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -90,10 +90,10 @@ impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn force_transfer() -> Weight {
// Proof Size summary in bytes:
// Measured: `341`
// Measured: `378`
// Estimated: `3593`
// Minimum execution time: 100_416_000 picoseconds.
Weight::from_parts(106_072_000, 0)
// Minimum execution time: 99_599_000 picoseconds.
Weight::from_parts(100_359_000, 0)
.saturating_add(Weight::from_parts(0, 3593))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@ -104,8 +104,8 @@ impl<T: frame_system::Config> pallet_indices::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `238`
// Estimated: `3534`
// Minimum execution time: 95_203_000 picoseconds.
Weight::from_parts(104_964_000, 0)
// Minimum execution time: 91_305_000 picoseconds.
Weight::from_parts(92_154_000, 0)
.saturating_add(Weight::from_parts(0, 3534))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_multisig`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -51,11 +51,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 45_038_000 picoseconds.
Weight::from_parts(64_423_078, 0)
// Minimum execution time: 43_478_000 picoseconds.
Weight::from_parts(44_609_560, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 181
.saturating_add(Weight::from_parts(5_199, 0).saturating_mul(z.into()))
// Standard Error: 12
.saturating_add(Weight::from_parts(1_401, 0).saturating_mul(z.into()))
}
/// Storage: `Multisig::Multisigs` (r:1 w:1)
/// Proof: `Multisig::Multisigs` (`max_values`: None, `max_size`: Some(3346), added: 5821, mode: `MaxEncodedLen`)
@ -63,15 +63,15 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
/// The range of component `z` is `[0, 10000]`.
fn as_multi_create(s: u32, z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `301 + s * (2 ±0)`
// Measured: `333 + s * (2 ±0)`
// Estimated: `6811`
// Minimum execution time: 173_451_000 picoseconds.
Weight::from_parts(237_581_625, 0)
// Minimum execution time: 142_936_000 picoseconds.
Weight::from_parts(124_108_455, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 68_614
.saturating_add(Weight::from_parts(642_475, 0).saturating_mul(s.into()))
// Standard Error: 672
.saturating_add(Weight::from_parts(4_309, 0).saturating_mul(z.into()))
// Standard Error: 2_855
.saturating_add(Weight::from_parts(221_355, 0).saturating_mul(s.into()))
// Standard Error: 27
.saturating_add(Weight::from_parts(4_474, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -83,13 +83,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `320`
// Estimated: `6811`
// Minimum execution time: 117_535_000 picoseconds.
Weight::from_parts(38_281_417, 0)
// Minimum execution time: 87_713_000 picoseconds.
Weight::from_parts(68_239_498, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 121_699
.saturating_add(Weight::from_parts(1_426_979, 0).saturating_mul(s.into()))
// Standard Error: 1_191
.saturating_add(Weight::from_parts(11_263, 0).saturating_mul(z.into()))
// Standard Error: 2_226
.saturating_add(Weight::from_parts(220_950, 0).saturating_mul(s.into()))
// Standard Error: 21
.saturating_add(Weight::from_parts(4_503, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -99,15 +99,17 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `s` is `[2, 100]`.
/// The range of component `z` is `[0, 10000]`.
fn as_multi_complete(_s: u32, z: u32, ) -> Weight {
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `426 + s * (33 ±0)`
// Measured: `456 + s * (33 ±0)`
// Estimated: `6811`
// Minimum execution time: 153_027_000 picoseconds.
Weight::from_parts(365_208_085, 0)
// Minimum execution time: 157_225_000 picoseconds.
Weight::from_parts(131_602_388, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 376
.saturating_add(Weight::from_parts(2_854, 0).saturating_mul(z.into()))
// Standard Error: 2_751
.saturating_add(Weight::from_parts(287_079, 0).saturating_mul(s.into()))
// Standard Error: 26
.saturating_add(Weight::from_parts(4_553, 0).saturating_mul(z.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -116,13 +118,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
/// The range of component `s` is `[2, 100]`.
fn approve_as_multi_create(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `301 + s * (2 ±0)`
// Measured: `334 + s * (2 ±0)`
// Estimated: `6811`
// Minimum execution time: 117_813_000 picoseconds.
Weight::from_parts(116_707_303, 0)
// Minimum execution time: 117_684_000 picoseconds.
Weight::from_parts(118_769_220, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 49_330
.saturating_add(Weight::from_parts(882_291, 0).saturating_mul(s.into()))
// Standard Error: 5_547
.saturating_add(Weight::from_parts(245_256, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -133,11 +135,11 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `320`
// Estimated: `6811`
// Minimum execution time: 68_535_000 picoseconds.
Weight::from_parts(78_742_402, 0)
// Minimum execution time: 63_527_000 picoseconds.
Weight::from_parts(63_245_044, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 39_978
.saturating_add(Weight::from_parts(616_693, 0).saturating_mul(s.into()))
// Standard Error: 3_544
.saturating_add(Weight::from_parts(233_731, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -146,13 +148,13 @@ impl<T: frame_system::Config> pallet_multisig::WeightInfo for WeightInfo<T> {
/// The range of component `s` is `[2, 100]`.
fn cancel_as_multi(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `492 + s * (1 ±0)`
// Measured: `525 + s * (1 ±0)`
// Estimated: `6811`
// Minimum execution time: 120_546_000 picoseconds.
Weight::from_parts(191_497_613, 0)
// Minimum execution time: 116_122_000 picoseconds.
Weight::from_parts(116_895_408, 0)
.saturating_add(Weight::from_parts(0, 6811))
// Standard Error: 51_063
.saturating_add(Weight::from_parts(1_090_254, 0).saturating_mul(s.into()))
// Standard Error: 2_124
.saturating_add(Weight::from_parts(230_923, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_nomination_pools`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -84,8 +84,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `3318`
// Estimated: `8877`
// Minimum execution time: 1_410_541_000 picoseconds.
Weight::from_parts(1_451_888_000, 0)
// Minimum execution time: 716_606_000 picoseconds.
Weight::from_parts(721_123_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(21))
.saturating_add(T::DbWeight::get().writes(13))
@ -120,8 +120,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `3328`
// Estimated: `8877`
// Minimum execution time: 1_262_490_000 picoseconds.
Weight::from_parts(1_290_270_000, 0)
// Minimum execution time: 716_271_000 picoseconds.
Weight::from_parts(722_192_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(18))
.saturating_add(T::DbWeight::get().writes(13))
@ -158,8 +158,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `3275`
// Estimated: `8799`
// Minimum execution time: 900_598_000 picoseconds.
Weight::from_parts(1_652_993_000, 0)
// Minimum execution time: 834_533_000 picoseconds.
Weight::from_parts(840_007_000, 0)
.saturating_add(Weight::from_parts(0, 8799))
.saturating_add(T::DbWeight::get().reads(18))
.saturating_add(T::DbWeight::get().writes(13))
@ -178,10 +178,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn claim_payout() -> Weight {
// Proof Size summary in bytes:
// Measured: `1210`
// Measured: `1243`
// Estimated: `4182`
// Minimum execution time: 560_223_000 picoseconds.
Weight::from_parts(591_523_000, 0)
// Minimum execution time: 295_679_000 picoseconds.
Weight::from_parts(297_682_000, 0)
.saturating_add(Weight::from_parts(0, 4182))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
@ -217,15 +217,15 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Storage: `VoterList::ListBags` (r:2 w:2)
/// Proof: `VoterList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`)
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(225), added: 2700, mode: `MaxEncodedLen`)
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`)
/// Storage: `NominationPools::CounterForSubPoolsStorage` (r:1 w:1)
/// Proof: `NominationPools::CounterForSubPoolsStorage` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
fn unbond() -> Weight {
// Proof Size summary in bytes:
// Measured: `3508`
// Estimated: `8877`
// Minimum execution time: 1_129_619_000 picoseconds.
Weight::from_parts(1_213_170_000, 0)
// Minimum execution time: 639_377_000 picoseconds.
Weight::from_parts(643_090_000, 0)
.saturating_add(Weight::from_parts(0, 8877))
.saturating_add(T::DbWeight::get().reads(21))
.saturating_add(T::DbWeight::get().writes(13))
@ -249,13 +249,15 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Storage: `NominationPools::TotalValueLocked` (r:1 w:1)
/// Proof: `NominationPools::TotalValueLocked` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`)
/// The range of component `s` is `[0, 100]`.
fn pool_withdraw_unbonded(_s: u32, ) -> Weight {
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `1739`
// Estimated: `4764`
// Minimum execution time: 294_248_000 picoseconds.
Weight::from_parts(549_242_698, 0)
// Minimum execution time: 262_375_000 picoseconds.
Weight::from_parts(265_593_485, 0)
.saturating_add(Weight::from_parts(0, 4764))
// Standard Error: 7_206
.saturating_add(Weight::from_parts(92_499, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(3))
}
@ -266,7 +268,7 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(225), added: 2700, mode: `MaxEncodedLen`)
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:0)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:1 w:1)
@ -288,13 +290,15 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Storage: `NominationPools::ClaimPermissions` (r:0 w:1)
/// Proof: `NominationPools::ClaimPermissions` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_update(_s: u32, ) -> Weight {
fn withdraw_unbonded_update(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `2129`
// Estimated: `4764`
// Minimum execution time: 511_071_000 picoseconds.
Weight::from_parts(736_094_042, 0)
// Minimum execution time: 517_498_000 picoseconds.
Weight::from_parts(523_574_962, 0)
.saturating_add(Weight::from_parts(0, 4764))
// Standard Error: 4_682
.saturating_add(Weight::from_parts(158_922, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(13))
.saturating_add(T::DbWeight::get().writes(9))
}
@ -305,7 +309,7 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Storage: `NominationPools::BondedPools` (r:1 w:1)
/// Proof: `NominationPools::BondedPools` (`max_values`: None, `max_size`: Some(254), added: 2729, mode: `MaxEncodedLen`)
/// Storage: `NominationPools::SubPoolsStorage` (r:1 w:1)
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(225), added: 2700, mode: `MaxEncodedLen`)
/// Proof: `NominationPools::SubPoolsStorage` (`max_values`: None, `max_size`: Some(1197), added: 3672, mode: `MaxEncodedLen`)
/// Storage: `Staking::Bonded` (r:1 w:1)
/// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`)
/// Storage: `Staking::Ledger` (r:1 w:1)
@ -349,10 +353,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `2454`
// Measured: `2487`
// Estimated: `8538`
// Minimum execution time: 902_792_000 picoseconds.
Weight::from_parts(1_030_417_932, 0)
// Minimum execution time: 915_305_000 picoseconds.
Weight::from_parts(924_951_139, 0)
.saturating_add(Weight::from_parts(0, 8538))
.saturating_add(T::DbWeight::get().reads(25))
.saturating_add(T::DbWeight::get().writes(21))
@ -405,10 +409,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Proof: `Staking::Payee` (`max_values`: None, `max_size`: Some(73), added: 2548, mode: `MaxEncodedLen`)
fn create() -> Weight {
// Proof Size summary in bytes:
// Measured: `1180`
// Measured: `1217`
// Estimated: `8538`
// Minimum execution time: 714_731_000 picoseconds.
Weight::from_parts(745_522_000, 0)
// Minimum execution time: 730_155_000 picoseconds.
Weight::from_parts(734_091_000, 0)
.saturating_add(Weight::from_parts(0, 8538))
.saturating_add(T::DbWeight::get().reads(25))
.saturating_add(T::DbWeight::get().writes(17))
@ -448,11 +452,11 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `1870`
// Estimated: `4556 + n * (2520 ±0)`
// Minimum execution time: 304_726_000 picoseconds.
Weight::from_parts(321_156_507, 0)
// Minimum execution time: 302_985_000 picoseconds.
Weight::from_parts(302_737_863, 0)
.saturating_add(Weight::from_parts(0, 4556))
// Standard Error: 73_202
.saturating_add(Weight::from_parts(5_156_012, 0).saturating_mul(n.into()))
// Standard Error: 22_407
.saturating_add(Weight::from_parts(5_487_308, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(15))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(5))
@ -468,8 +472,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `1326`
// Estimated: `4556`
// Minimum execution time: 114_437_000 picoseconds.
Weight::from_parts(117_596_000, 0)
// Minimum execution time: 113_053_000 picoseconds.
Weight::from_parts(114_218_000, 0)
.saturating_add(Weight::from_parts(0, 4556))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(1))
@ -485,11 +489,11 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `532`
// Estimated: `3735`
// Minimum execution time: 51_592_000 picoseconds.
Weight::from_parts(54_571_300, 0)
// Minimum execution time: 52_132_000 picoseconds.
Weight::from_parts(53_264_279, 0)
.saturating_add(Weight::from_parts(0, 3735))
// Standard Error: 1_879
.saturating_add(Weight::from_parts(12_064, 0).saturating_mul(n.into()))
// Standard Error: 428
.saturating_add(Weight::from_parts(2_468, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -509,8 +513,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 15_414_000 picoseconds.
Weight::from_parts(15_775_000, 0)
// Minimum execution time: 16_746_000 picoseconds.
Weight::from_parts(17_151_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(6))
}
@ -520,8 +524,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `532`
// Estimated: `3719`
// Minimum execution time: 61_671_000 picoseconds.
Weight::from_parts(62_422_000, 0)
// Minimum execution time: 63_646_000 picoseconds.
Weight::from_parts(64_352_000, 0)
.saturating_add(Weight::from_parts(0, 3719))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -552,8 +556,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `2037`
// Estimated: `4556`
// Minimum execution time: 276_195_000 picoseconds.
Weight::from_parts(309_526_000, 0)
// Minimum execution time: 274_338_000 picoseconds.
Weight::from_parts(276_519_000, 0)
.saturating_add(Weight::from_parts(0, 4556))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(5))
@ -570,8 +574,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `804`
// Estimated: `3719`
// Minimum execution time: 120_457_000 picoseconds.
Weight::from_parts(129_197_000, 0)
// Minimum execution time: 123_432_000 picoseconds.
Weight::from_parts(124_207_000, 0)
.saturating_add(Weight::from_parts(0, 3719))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
@ -584,8 +588,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `572`
// Estimated: `3719`
// Minimum execution time: 65_883_000 picoseconds.
Weight::from_parts(67_354_000, 0)
// Minimum execution time: 64_040_000 picoseconds.
Weight::from_parts(64_576_000, 0)
.saturating_add(Weight::from_parts(0, 3719))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -596,8 +600,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `532`
// Estimated: `3719`
// Minimum execution time: 65_959_000 picoseconds.
Weight::from_parts(67_449_000, 0)
// Minimum execution time: 63_327_000 picoseconds.
Weight::from_parts(63_759_000, 0)
.saturating_add(Weight::from_parts(0, 3719))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -608,8 +612,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `532`
// Estimated: `3719`
// Minimum execution time: 64_679_000 picoseconds.
Weight::from_parts(66_591_000, 0)
// Minimum execution time: 62_830_000 picoseconds.
Weight::from_parts(63_234_000, 0)
.saturating_add(Weight::from_parts(0, 3719))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
@ -622,8 +626,8 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
// Proof Size summary in bytes:
// Measured: `542`
// Estimated: `4182`
// Minimum execution time: 54_153_000 picoseconds.
Weight::from_parts(55_640_000, 0)
// Minimum execution time: 53_239_000 picoseconds.
Weight::from_parts(54_298_000, 0)
.saturating_add(Weight::from_parts(0, 4182))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -638,10 +642,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
fn claim_commission() -> Weight {
// Proof Size summary in bytes:
// Measured: `1040`
// Measured: `1073`
// Estimated: `3719`
// Minimum execution time: 248_027_000 picoseconds.
Weight::from_parts(252_312_000, 0)
// Minimum execution time: 246_773_000 picoseconds.
Weight::from_parts(248_359_000, 0)
.saturating_add(Weight::from_parts(0, 3719))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))
@ -656,10 +660,10 @@ impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
fn adjust_pool_deposit() -> Weight {
// Proof Size summary in bytes:
// Measured: `939`
// Measured: `972`
// Estimated: `4764`
// Minimum execution time: 275_027_000 picoseconds.
Weight::from_parts(493_643_000, 0)
// Minimum execution time: 273_640_000 picoseconds.
Weight::from_parts(275_806_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(2))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_preimage`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -59,11 +59,11 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `3556`
// Minimum execution time: 187_163_000 picoseconds.
Weight::from_parts(1_016_003_397, 0)
// Minimum execution time: 184_982_000 picoseconds.
Weight::from_parts(185_981_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
// Standard Error: 109
.saturating_add(Weight::from_parts(6_049, 0).saturating_mul(s.into()))
// Standard Error: 12
.saturating_add(Weight::from_parts(6_544, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
@ -78,11 +78,11 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `140`
// Estimated: `3556`
// Minimum execution time: 102_629_000 picoseconds.
Weight::from_parts(7_214_980_200, 0)
// Minimum execution time: 58_660_000 picoseconds.
Weight::from_parts(59_197_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
// Standard Error: 224
.saturating_add(Weight::from_parts(4_433, 0).saturating_mul(s.into()))
// Standard Error: 11
.saturating_add(Weight::from_parts(6_536, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -97,11 +97,11 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `140`
// Estimated: `3556`
// Minimum execution time: 61_780_000 picoseconds.
Weight::from_parts(696_495_161, 0)
// Minimum execution time: 60_486_000 picoseconds.
Weight::from_parts(61_208_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
// Standard Error: 24
.saturating_add(Weight::from_parts(5_607, 0).saturating_mul(s.into()))
// Standard Error: 12
.saturating_add(Weight::from_parts(6_563, 0).saturating_mul(s.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -117,8 +117,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `278`
// Estimated: `3556`
// Minimum execution time: 196_752_000 picoseconds.
Weight::from_parts(199_602_000, 0)
// Minimum execution time: 196_725_000 picoseconds.
Weight::from_parts(198_947_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
@ -133,8 +133,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `178`
// Estimated: `3556`
// Minimum execution time: 94_886_000 picoseconds.
Weight::from_parts(98_635_000, 0)
// Minimum execution time: 93_063_000 picoseconds.
Weight::from_parts(94_422_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@ -147,8 +147,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `222`
// Estimated: `3556`
// Minimum execution time: 78_089_000 picoseconds.
Weight::from_parts(79_794_000, 0)
// Minimum execution time: 75_641_000 picoseconds.
Weight::from_parts(77_340_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -161,8 +161,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `178`
// Estimated: `3556`
// Minimum execution time: 60_983_000 picoseconds.
Weight::from_parts(62_151_000, 0)
// Minimum execution time: 59_452_000 picoseconds.
Weight::from_parts(60_649_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -175,8 +175,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `76`
// Estimated: `3556`
// Minimum execution time: 69_363_000 picoseconds.
Weight::from_parts(71_322_000, 0)
// Minimum execution time: 67_319_000 picoseconds.
Weight::from_parts(68_408_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -189,8 +189,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `140`
// Estimated: `3556`
// Minimum execution time: 44_043_000 picoseconds.
Weight::from_parts(45_561_000, 0)
// Minimum execution time: 43_700_000 picoseconds.
Weight::from_parts(44_342_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -205,8 +205,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `178`
// Estimated: `3556`
// Minimum execution time: 87_783_000 picoseconds.
Weight::from_parts(90_504_000, 0)
// Minimum execution time: 85_045_000 picoseconds.
Weight::from_parts(86_364_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
@ -219,8 +219,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `140`
// Estimated: `3556`
// Minimum execution time: 44_074_000 picoseconds.
Weight::from_parts(45_550_000, 0)
// Minimum execution time: 43_163_000 picoseconds.
Weight::from_parts(44_239_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -233,8 +233,8 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `140`
// Estimated: `3556`
// Minimum execution time: 44_665_000 picoseconds.
Weight::from_parts(45_634_000, 0)
// Minimum execution time: 44_330_000 picoseconds.
Weight::from_parts(45_448_000, 0)
.saturating_add(Weight::from_parts(0, 3556))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(1))
@ -252,11 +252,11 @@ impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0 + n * (227 ±0)`
// Estimated: `990 + n * (2603 ±0)`
// Minimum execution time: 208_486_000 picoseconds.
Weight::from_parts(208_847_000, 0)
// Minimum execution time: 209_069_000 picoseconds.
Weight::from_parts(210_285_000, 0)
.saturating_add(Weight::from_parts(0, 990))
// Standard Error: 134_724
.saturating_add(Weight::from_parts(203_423_381, 0).saturating_mul(n.into()))
// Standard Error: 107_938
.saturating_add(Weight::from_parts(203_214_364, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2603).saturating_mul(n.into()))

View File

@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_proxy`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2025-11-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ghostown`, CPU: `Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("casper-dev")`, DB CACHE: 1024
@ -53,11 +53,11 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `227 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 49_481_000 picoseconds.
Weight::from_parts(50_995_826, 0)
// Minimum execution time: 52_102_000 picoseconds.
Weight::from_parts(52_983_652, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 3_198
.saturating_add(Weight::from_parts(110_515, 0).saturating_mul(p.into()))
// Standard Error: 2_345
.saturating_add(Weight::from_parts(123_131, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
}
/// Storage: `Proxy::Proxies` (r:1 w:0)
@ -72,13 +72,13 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `554 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 130_153_000 picoseconds.
Weight::from_parts(128_711_019, 0)
// Minimum execution time: 135_284_000 picoseconds.
Weight::from_parts(133_942_081, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 8_790
.saturating_add(Weight::from_parts(491_909, 0).saturating_mul(a.into()))
// Standard Error: 9_082
.saturating_add(Weight::from_parts(101_604, 0).saturating_mul(p.into()))
// Standard Error: 7_270
.saturating_add(Weight::from_parts(486_065, 0).saturating_mul(a.into()))
// Standard Error: 7_511
.saturating_add(Weight::from_parts(93_257, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -88,15 +88,17 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// The range of component `a` is `[0, 31]`.
/// The range of component `p` is `[1, 31]`.
fn remove_announcement(a: u32, _p: u32, ) -> Weight {
fn remove_announcement(a: u32, p: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `469 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 89_529_000 picoseconds.
Weight::from_parts(90_887_836, 0)
// Minimum execution time: 92_458_000 picoseconds.
Weight::from_parts(93_228_580, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 5_789
.saturating_add(Weight::from_parts(470_495, 0).saturating_mul(a.into()))
// Standard Error: 3_540
.saturating_add(Weight::from_parts(496_930, 0).saturating_mul(a.into()))
// Standard Error: 3_658
.saturating_add(Weight::from_parts(20_009, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -110,13 +112,13 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `469 + a * (68 ±0)`
// Estimated: `5698`
// Minimum execution time: 89_167_000 picoseconds.
Weight::from_parts(89_500_097, 0)
// Minimum execution time: 92_412_000 picoseconds.
Weight::from_parts(93_431_190, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 5_162
.saturating_add(Weight::from_parts(491_814, 0).saturating_mul(a.into()))
// Standard Error: 5_334
.saturating_add(Weight::from_parts(28_371, 0).saturating_mul(p.into()))
// Standard Error: 4_974
.saturating_add(Weight::from_parts(499_958, 0).saturating_mul(a.into()))
// Standard Error: 5_139
.saturating_add(Weight::from_parts(8_062, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -132,13 +134,13 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `486 + a * (68 ±0) + p * (37 ±0)`
// Estimated: `5698`
// Minimum execution time: 118_291_000 picoseconds.
Weight::from_parts(117_789_349, 0)
// Minimum execution time: 122_066_000 picoseconds.
Weight::from_parts(120_516_865, 0)
.saturating_add(Weight::from_parts(0, 5698))
// Standard Error: 5_389
.saturating_add(Weight::from_parts(439_098, 0).saturating_mul(a.into()))
// Standard Error: 5_568
.saturating_add(Weight::from_parts(52_417, 0).saturating_mul(p.into()))
// Standard Error: 3_583
.saturating_add(Weight::from_parts(474_188, 0).saturating_mul(a.into()))
// Standard Error: 3_702
.saturating_add(Weight::from_parts(89_204, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(2))
}
@ -149,11 +151,11 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `227 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 87_673_000 picoseconds.
Weight::from_parts(88_498_284, 0)
// Minimum execution time: 90_747_000 picoseconds.
Weight::from_parts(92_224_658, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 5_087
.saturating_add(Weight::from_parts(160_633, 0).saturating_mul(p.into()))
// Standard Error: 6_178
.saturating_add(Weight::from_parts(115_174, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -164,11 +166,11 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `227 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 86_923_000 picoseconds.
Weight::from_parts(88_407_273, 0)
// Minimum execution time: 90_894_000 picoseconds.
Weight::from_parts(91_907_515, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 3_144
.saturating_add(Weight::from_parts(157_620, 0).saturating_mul(p.into()))
// Standard Error: 5_632
.saturating_add(Weight::from_parts(170_776, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -179,11 +181,11 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `227 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 78_497_000 picoseconds.
Weight::from_parts(80_261_310, 0)
// Minimum execution time: 82_623_000 picoseconds.
Weight::from_parts(83_682_560, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 4_821
.saturating_add(Weight::from_parts(130_950, 0).saturating_mul(p.into()))
// Standard Error: 1_885
.saturating_add(Weight::from_parts(142_952, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -194,11 +196,11 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `239`
// Estimated: `4706`
// Minimum execution time: 92_942_000 picoseconds.
Weight::from_parts(94_228_619, 0)
// Minimum execution time: 96_987_000 picoseconds.
Weight::from_parts(98_089_930, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 3_983
.saturating_add(Weight::from_parts(49_038, 0).saturating_mul(p.into()))
// Standard Error: 2_115
.saturating_add(Weight::from_parts(36_871, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@ -209,11 +211,11 @@ impl<T: frame_system::Config> pallet_proxy::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `264 + p * (37 ±0)`
// Estimated: `4706`
// Minimum execution time: 81_597_000 picoseconds.
Weight::from_parts(83_604_817, 0)
// Minimum execution time: 86_027_000 picoseconds.
Weight::from_parts(87_080_852, 0)
.saturating_add(Weight::from_parts(0, 4706))
// Standard Error: 5_329
.saturating_add(Weight::from_parts(124_813, 0).saturating_mul(p.into()))
// Standard Error: 1_982
.saturating_add(Weight::from_parts(142_829, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}

Some files were not shown because too many files have changed in this diff Show More