Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ jobs:
os: [ubuntu-latest]
rust: [stable]
rust-target: [x86_64-unknown-linux-gnu]
check: [fmt, clippy]
# check: [fmt --all -- --check, clippy -- -D warnings]
check: [fmt --all -- --check] # skip clippy for now
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
Expand All @@ -178,20 +179,12 @@ jobs:
- name: Setup Rust toolchain
run: rustup show

- name: Install llvm-10
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed. This is installed by default

run: sudo apt-get install llvm-10 clang-10

- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.rust-target }}-${{ matrix.check }}

- name: Fmt
if: ${{ matrix.check == 'fmt' }}
run: cargo fmt --all -- --check

# - name: Clippy
# if: ${{ matrix.check == 'clippy' }}
# run: cargo clippy -- -D warnings
- name: ${{ matrix.check }}
run: cargo ${{ matrix.check }}

build-runtimes:
name: Build Runtimes
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,16 @@ runtime-benchmarks = [
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking",
"frame-system/runtime-benchmarks",
"hex-literal",
"sp-runtime/runtime-benchmarks",
# actual pallets to be benchmarked
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-teerex/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
]
34 changes: 22 additions & 12 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ use pallet_transaction_payment::CurrencyAdapter;
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};

mod weights;

/// An index to a block.
pub type BlockNumber = u32;

Expand Down Expand Up @@ -258,7 +260,7 @@ impl frame_system::Config for Runtime {
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// The set code logic, just the default since we're not a parachain.
Expand Down Expand Up @@ -305,7 +307,7 @@ impl pallet_timestamp::Config for Runtime {
type Moment = Moment;
type OnTimestampSet = (Aura, Teerex);
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
}

parameter_types! {
Expand All @@ -325,7 +327,7 @@ impl pallet_balances::Config for Runtime {
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
Expand Down Expand Up @@ -354,8 +356,7 @@ impl pallet_teerex::Config for Runtime {
type Currency = pallet_balances::Pallet<Runtime>;
type MomentsPerDay = MomentsPerDay;
type MaxSilenceTime = MaxSilenceTime;
// currently we have only benchmarks there for the integritee-parachain
type WeightInfo = pallet_teerex::weights::IntegriteeWeight<Runtime>;
type WeightInfo = weights::pallet_teerex::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -383,7 +384,7 @@ impl pallet_treasury::Config for Runtime {
type BurnDestination = (); //No burn
type SpendFunds = (); //No spend, no bounty
type MaxApprovals = MaxApprovals; //0:cannot approve any proposal
type WeightInfo = ();
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>;
}

parameter_types! {
Expand All @@ -401,7 +402,7 @@ impl pallet_multisig::Config for Runtime {
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = ();
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -478,7 +479,7 @@ impl pallet_proxy::Config for Runtime {
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = ();
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
Expand All @@ -494,7 +495,7 @@ impl pallet_vesting::Config for Runtime {
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = ();
type WeightInfo = weights::pallet_vesting::WeightInfo<Runtime>;
const MAX_VESTING_SCHEDULES: u32 = 28;
}

Expand All @@ -512,7 +513,7 @@ impl pallet_scheduler::Config for Runtime {
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureRoot<AccountId>;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = ();
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
Expand Down Expand Up @@ -719,9 +720,14 @@ impl_runtime_apis! {

list_benchmark!(list, extra, frame_system, SystemBench::<Runtime>);
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_multisig, Multisig);
list_benchmark!(list, extra, pallet_proxy, Proxy);
list_benchmark!(list, extra, pallet_scheduler, Scheduler);
list_benchmark!(list, extra, pallet_teerex, Teerex);
list_benchmark!(list, extra, pallet_timestamp, Timestamp);
list_benchmark!(list, extra, pallet_treasury, Treasury);
list_benchmark!(list, extra, pallet_multisig, Multisig);
list_benchmark!(list, extra, pallet_vesting, Vesting);

let storage_info = AllPalletsWithSystem::storage_info();

return (list, storage_info)
Expand Down Expand Up @@ -755,9 +761,13 @@ impl_runtime_apis! {

add_benchmark!(params, batches, frame_system, SystemBench::<Runtime>);
add_benchmark!(params, batches, pallet_balances, Balances);
add_benchmark!(params, batches, pallet_multisig, Multisig);
add_benchmark!(params, batches, pallet_proxy, Proxy);
add_benchmark!(params, batches, pallet_scheduler, Scheduler);
add_benchmark!(params, batches, pallet_teerex, Teerex);
add_benchmark!(params, batches, pallet_timestamp, Timestamp);
add_benchmark!(params, batches, pallet_treasury, Treasury);
add_benchmark!(params, batches, pallet_multisig, Multisig);
add_benchmark!(params, batches, pallet_vesting, Vesting);

if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
Expand Down
74 changes: 74 additions & 0 deletions runtime/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
//! Autogenerated weights for `frame_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128

// Executed Command:
// ./target/release/integritee-node
// benchmark
// --chain=integritee-solo-fresh
// --steps=50
// --repeat=20
// --pallet=frame_system
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./runtime/src/weights/frame_system.rs


#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for frame_system.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
fn remark(b: u32, ) -> Weight {
(574_000 as Weight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
}
fn remark_with_event(b: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
}
// Storage: unknown [0x3a686561707061676573] (r:0 w:1)
fn set_heap_pages() -> Weight {
(1_800_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Digest (r:1 w:1)
// Storage: unknown [0x3a6368616e6765735f74726965] (r:0 w:1)
fn set_changes_trie_config() -> Weight {
(8_000_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Skipped Metadata (r:0 w:0)
fn set_storage(i: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 2_000
.saturating_add((887_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
// Storage: Skipped Metadata (r:0 w:0)
fn kill_storage(i: u32, ) -> Weight {
(2_052_000 as Weight)
// Standard Error: 1_000
.saturating_add((567_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
}
// Storage: Skipped Metadata (r:0 w:0)
fn kill_prefix(p: u32, ) -> Weight {
(3_640_000 as Weight)
// Standard Error: 2_000
.saturating_add((799_000 as Weight).saturating_mul(p as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
}
}
24 changes: 24 additions & 0 deletions runtime/src/weights/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! The weights used in the runtime
//!
//! The current weights have been obtained with the following reference hardware:
//! * Core(TM) i7-10875H
//! * 32GB of RAM
//! * NVMe SSD

// the generated files to not pass clippy
#![allow(clippy::all)]

// note: Always double check the frame_system generated weights. Sometimes some values are 0, but
// return ridiculously high weights in another run. When re-running the benchmarks always perform
// sanity checks with substrate's weight for this module. The close to 0 values seem to be correct.
//
// Problematic functions are: `remark`, `remark_with_event`.
pub mod frame_system;
pub mod pallet_balances;
pub mod pallet_multisig;
pub mod pallet_proxy;
pub mod pallet_scheduler;
pub mod pallet_teerex;
pub mod pallet_timestamp;
pub mod pallet_treasury;
pub mod pallet_vesting;
68 changes: 68 additions & 0 deletions runtime/src/weights/pallet_balances.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

//! Autogenerated weights for `pallet_balances`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-10-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128

// Executed Command:
// ./target/release/integritee-node
// benchmark
// --chain=integritee-solo-fresh
// --steps=50
// --repeat=20
// --pallet=pallet_balances
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./runtime/src/weights/pallet_balances.rs


#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for pallet_balances.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(72_600_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
(53_200_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
(27_600_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
(33_600_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: System Account (r:2 w:2)
fn force_transfer() -> Weight {
(69_800_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: System Account (r:1 w:1)
fn transfer_all() -> Weight {
(64_000_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
Loading