Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
runtime compiles with benchmarks (few benchmark warnings though)
  • Loading branch information
clangenb committed Sep 10, 2025
commit 3610270a8e08c5cac5c93d96d420e9088b0709ee
48 changes: 29 additions & 19 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ use frame_support::{
};
use frame_system::{EnsureRoot, EnsureWithSuccess};
use pallet_grandpa::AuthorityId as GrandpaId;
use pallet_transaction_payment::{CurrencyAdapter, Multiplier};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use pallet_transaction_payment::Multiplier;
use parity_scale_codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata, RuntimeDebug};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
generic, impl_opaque_keys,
traits::{
BlakeTwo256, Block as BlockT, ConvertInto, IdentifyAccount, IdentityLookup, NumberFor, One,
Verify,
},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiSignature,
ApplyExtrinsicResult, Cow, MultiSignature,
};
use sp_std::prelude::*;

Expand All @@ -50,6 +50,7 @@ pub use pallet_teerex;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;

use frame_support::traits::{fungible::Credit, tokens::imbalance::ResolveTo};
pub use frame_support::{
weights::{
constants::{
Expand All @@ -59,8 +60,8 @@ pub use frame_support::{
},
PalletId, StorageValue,
};

pub use pallet_timestamp::Call as TimestampCall;
use pallet_treasury::TreasuryAccountId;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};
Expand Down Expand Up @@ -114,14 +115,14 @@ pub mod opaque {
// https://docs.substrate.io/main-docs/build/upgrade#runtime-versioning
#[sp_version::runtime_version]
pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("integritee-solo"),
impl_name: create_runtime_str!("integritee-solo"),
spec_name: Cow::Borrowed("integritee-solo"),
impl_name: Cow::Borrowed("integritee-solo"),
authoring_version: 1,
spec_version: 400,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 8,
state_version: 0,
system_version: 0,
};

/// This determines the average expected block time that we are targeting.
Expand Down Expand Up @@ -165,10 +166,16 @@ pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
}

pub struct DealWithFees;
impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees {
fn on_unbalanceds<B>(
mut fees_then_tips: impl Iterator<Item = pallet_balances::NegativeImbalance<Runtime>>,
pub struct DealWithFees<R>(sp_std::marker::PhantomData<R>);

impl<R> OnUnbalanced<Credit<R::AccountId, pallet_balances::Pallet<R>>> for DealWithFees<R>
where
R: pallet_balances::Config + pallet_treasury::Config,
<R as frame_system::Config>::AccountId: From<AccountId>,
<R as frame_system::Config>::AccountId: Into<AccountId>,
{
fn on_unbalanceds(
mut fees_then_tips: impl Iterator<Item = Credit<R::AccountId, pallet_balances::Pallet<R>>>,
) {
if let Some(fees) = fees_then_tips.next() {
// for fees, 1% to treasury, 99% burned
Expand All @@ -179,7 +186,7 @@ impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees
if let Some(tips) = fees_then_tips.next() {
tips.merge_into(&mut split.0);
}
Treasury::on_unbalanced(split.0);
ResolveTo::<TreasuryAccountId<R>, pallet_balances::Pallet<R>>::on_unbalanced(split.0);
// burn remainder by not assigning imbalance to someone
}
}
Expand Down Expand Up @@ -323,19 +330,22 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ();
type DoneSlashHandler = ();
}

parameter_types! {
pub FeeMultiplier: Multiplier = Multiplier::one();
}

impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = CurrencyAdapter<Balances, DealWithFees>;
type OnChargeTransaction =
pallet_transaction_payment::FungibleAdapter<Balances, DealWithFees<Runtime>>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type WeightToFee = IdentityFee<Balance>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = ();
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
}

impl pallet_sudo::Config for Runtime {
Expand Down Expand Up @@ -438,13 +448,8 @@ impl ConversionFromAssetBalance<u128, (), u128> for NoConversion {
impl pallet_treasury::Config for Runtime {
type PalletId = TreasuryPalletId;
type Currency = pallet_balances::Pallet<Runtime>;
type ApproveOrigin = RootOrigin;
type RejectOrigin = RootOrigin;
type RuntimeEvent = RuntimeEvent;
type OnSlash = (); // No Proposal
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type ProposalBondMaximum = ProposalBondMaximum;
type SpendPeriod = SpendPeriod; //Cannot be 0: Error: Thread 'tokio-runtime-worker' panicked at 'attempt to calculate the remainder with a divisor of zero
type Burn = (); //No burn
type BurnDestination = (); //No burn
Expand All @@ -460,6 +465,7 @@ impl pallet_treasury::Config for Runtime {
type PayoutPeriod = PayoutSpendPeriod;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
type BlockNumberProvider = System;
}
parameter_types! {
// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
Expand All @@ -477,6 +483,7 @@ impl pallet_multisig::Config for Runtime {
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
type BlockNumberProvider = System;
}

parameter_types! {
Expand All @@ -500,6 +507,7 @@ parameter_types! {
PartialOrd,
Encode,
Decode,
DecodeWithMemTracking,
RuntimeDebug,
MaxEncodedLen,
TypeInfo,
Expand Down Expand Up @@ -568,6 +576,7 @@ impl pallet_proxy::Config for Runtime {
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
type AnnouncementDepositFactor = AnnouncementDepositFactor;
type BlockNumberProvider = System;
}

parameter_types! {
Expand Down Expand Up @@ -604,6 +613,7 @@ impl pallet_scheduler::Config for Runtime {
type WeightInfo = weights::pallet_scheduler::WeightInfo<Runtime>;
type OriginPrivilegeCmp = EqualPrivilegeOnly;
type Preimages = Preimage;
type BlockNumberProvider = System;
}

impl pallet_utility::Config for Runtime {
Expand Down
62 changes: 34 additions & 28 deletions runtime/src/weights/pallet_claims.rs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copied all the weights from the integritee-parachain

Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@

//! Autogenerated weights for `pallet_claims`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 39.0.0
//! DATE: 2024-07-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 47.2.0
//! DATE: 2025-08-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `caribe`, CPU: `12th Gen Intel(R) Core(TM) i7-1260P`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("integritee-solo-fresh")`, DB CACHE: 1024
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("integritee-rococo-local-dev")`, DB CACHE: 1024

// Executed Command:
// target/release/integritee-node
// ./target/release/integritee-collator
// benchmark
// pallet
// --chain=integritee-solo-fresh
// --chain=integritee-rococo-local-dev
// --steps=50
// --repeat=20
// --pallet=pallet_claims
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=runtime/src/weights/pallet_claims.rs
// --output=./polkadot-parachains/integritee-kusama/src/weights/pallet_claims.rs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -42,21 +40,21 @@ impl<T: frame_system::Config> pallet_claims::WeightInfo for WeightInfo<T> {
/// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Vesting::Vesting` (r:1 w:1)
/// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Storage: `System::Account` (r:1 w:0)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
fn claim() -> Weight {
// Proof Size summary in bytes:
// Measured: `487`
// Measured: `363`
// Estimated: `4764`
// Minimum execution time: 161_698_000 picoseconds.
Weight::from_parts(171_763_000, 0)
// Minimum execution time: 155_819_000 picoseconds.
Weight::from_parts(179_695_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(7))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Claims::Total` (r:1 w:1)
/// Proof: `Claims::Total` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
Expand All @@ -70,8 +68,8 @@ impl<T: frame_system::Config> pallet_claims::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `1630`
// Minimum execution time: 12_358_000 picoseconds.
Weight::from_parts(14_041_000, 0)
// Minimum execution time: 12_952_000 picoseconds.
Weight::from_parts(14_917_000, 0)
.saturating_add(Weight::from_parts(0, 1630))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(4))
Expand All @@ -86,21 +84,21 @@ impl<T: frame_system::Config> pallet_claims::WeightInfo for WeightInfo<T> {
/// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Vesting::Vesting` (r:1 w:1)
/// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Storage: `System::Account` (r:1 w:0)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
fn claim_attest() -> Weight {
// Proof Size summary in bytes:
// Measured: `487`
// Measured: `363`
// Estimated: `4764`
// Minimum execution time: 165_109_000 picoseconds.
Weight::from_parts(173_146_000, 0)
// Minimum execution time: 157_428_000 picoseconds.
Weight::from_parts(189_096_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(7))
.saturating_add(T::DbWeight::get().writes(6))
}
/// Storage: `Claims::Preclaims` (r:1 w:1)
/// Proof: `Claims::Preclaims` (`max_values`: None, `max_size`: None, mode: `Measured`)
Expand All @@ -114,21 +112,21 @@ impl<T: frame_system::Config> pallet_claims::WeightInfo for WeightInfo<T> {
/// Proof: `Claims::Vesting` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `Vesting::Vesting` (r:1 w:1)
/// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:1 w:1)
/// Storage: `System::Account` (r:1 w:0)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
/// Storage: `Balances::Locks` (r:1 w:1)
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`)
fn attest() -> Weight {
// Proof Size summary in bytes:
// Measured: `561`
// Measured: `437`
// Estimated: `4764`
// Minimum execution time: 92_439_000 picoseconds.
Weight::from_parts(99_940_000, 0)
// Minimum execution time: 85_154_000 picoseconds.
Weight::from_parts(99_867_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(8))
.saturating_add(T::DbWeight::get().writes(7))
}
/// Storage: `Claims::Claims` (r:1 w:2)
/// Proof: `Claims::Claims` (`max_values`: None, `max_size`: None, mode: `Measured`)
Expand All @@ -142,10 +140,18 @@ impl<T: frame_system::Config> pallet_claims::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `369`
// Estimated: `3834`
// Minimum execution time: 28_020_000 picoseconds.
Weight::from_parts(29_512_000, 0)
// Minimum execution time: 29_184_000 picoseconds.
Weight::from_parts(34_573_000, 0)
.saturating_add(Weight::from_parts(0, 3834))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(7))
}
}

fn prevalidate_attests() -> Weight {
// fake
Weight::from_parts(101_523_000, 0)
.saturating_add(Weight::from_parts(0, 4764))
.saturating_add(T::DbWeight::get().reads(9))
.saturating_add(T::DbWeight::get().writes(7))
}
}
Loading