diff --git a/.gitmodules b/.gitmodules index a11e4ae9..28fb613b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "ternoa-pallets"] path = ternoa-pallets url = https://github.com/capsule-corp-ternoa/ternoa-pallets - + branch = tee-staking diff --git a/Cargo.lock b/Cargo.lock index a84a5fbc..de4e4bd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,7 +93,7 @@ dependencies = [ [[package]] name = "alphanet-runtime" -version = "1.3.1" +version = "1.3.2" dependencies = [ "alphanet-runtime-constants", "frame-benchmarking", @@ -3759,7 +3759,7 @@ dependencies = [ [[package]] name = "mainnet-runtime" -version = "1.3.1" +version = "1.3.2" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -8367,16 +8367,22 @@ name = "ternoa-auction" version = "1.0.2" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", "log", "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "ternoa-common", "ternoa-marketplace", @@ -8491,16 +8497,22 @@ name = "ternoa-marketplace" version = "1.0.4" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", "log", "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "ternoa-common", "ternoa-nft", @@ -8513,16 +8525,22 @@ name = "ternoa-nft" version = "1.0.5" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", "log", "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "ternoa-common", "ternoa-pallets-primitives", @@ -8543,19 +8561,25 @@ dependencies = [ [[package]] name = "ternoa-rent" -version = "1.0.2" +version = "1.0.3" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", "log", "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "ternoa-common", "ternoa-nft", @@ -8565,7 +8589,7 @@ dependencies = [ [[package]] name = "ternoa-runtime-common" -version = "1.3.1" +version = "1.3.2" dependencies = [ "frame-election-provider-support", "frame-support", @@ -8664,18 +8688,25 @@ dependencies = [ [[package]] name = "ternoa-tee" -version = "1.0.0" +version = "1.0.2" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", "log", "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", "parity-scale-codec", "scale-info", + "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "ternoa-common", "ternoa-nft", @@ -8687,16 +8718,22 @@ name = "ternoa-transmission-protocols" version = "1.0.0" dependencies = [ "frame-benchmarking", + "frame-election-provider-support", "frame-support", "frame-system", "log", "pallet-balances", + "pallet-session", + "pallet-staking", + "pallet-staking-reward-curve", + "pallet-timestamp", "parity-scale-codec", "scale-info", "sp-arithmetic", "sp-core", "sp-io", "sp-runtime", + "sp-staking", "sp-std", "ternoa-common", "ternoa-nft", diff --git a/runtime/alphanet/Cargo.toml b/runtime/alphanet/Cargo.toml index 4b067fb9..8d13b377 100644 --- a/runtime/alphanet/Cargo.toml +++ b/runtime/alphanet/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "alphanet-runtime" authors = [ "Ternoa" ] -version = "1.3.1" +version = "1.3.2" edition = "2021" build = "build.rs" diff --git a/runtime/alphanet/src/pallets.rs b/runtime/alphanet/src/pallets.rs index 92ab34a9..b9f32378 100644 --- a/runtime/alphanet/src/pallets.rs +++ b/runtime/alphanet/src/pallets.rs @@ -766,15 +766,24 @@ parameter_types! { pub const ClusterSize: u32 = 5; pub const MaxUriLen: u32 = 150; pub const ListSizeLimit: u32 = 10; + pub const TeeBondingDuration: u32 = 200; + pub const InitialStakingAmount: Balance = 250_000_000_000_000_000_000_000; + pub const InitalDailyRewardPool: Balance = 3082_000_000_000_000_000_000; + pub const TeePalletId: PalletId = PalletId(*b"teepalet"); + pub const TeeHistoryDepth: u32 = 10; } impl ternoa_tee::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type WeightInfo = weights::ternoa_tee::WeightInfo; + type TeeWeightInfo = weights::ternoa_tee::WeightInfo; type ClusterSize = ClusterSize; type MaxUriLen = MaxUriLen; type ListSizeLimit = ListSizeLimit; + type TeeBondingDuration = TeeBondingDuration; + type InitialStakingAmount = InitialStakingAmount; + type InitalDailyRewardPool = InitalDailyRewardPool; + type PalletId = TeePalletId; + type TeeHistoryDepth = TeeHistoryDepth; } parameter_types! { diff --git a/runtime/alphanet/src/version.rs b/runtime/alphanet/src/version.rs index a6146853..7700f6f2 100644 --- a/runtime/alphanet/src/version.rs +++ b/runtime/alphanet/src/version.rs @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { /// Version of the runtime specification. A full-node will not attempt to use its native /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, /// `spec_version` and `authoring_version` are the same between Wasm and native. - spec_version: 15, + spec_version: 16, /// Version of the implementation of the specification. Nodes are free to ignore this; it /// serves only as an indication that the code is different; as long as the other two versions diff --git a/runtime/alphanet/src/weights/ternoa_tee.rs b/runtime/alphanet/src/weights/ternoa_tee.rs index 4fb8f28f..4467a984 100644 --- a/runtime/alphanet/src/weights/ternoa_tee.rs +++ b/runtime/alphanet/src/weights/ternoa_tee.rs @@ -7,19 +7,19 @@ //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("mainnet-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/ternoa +// ./target/release/ternoa // benchmark // pallet -// --chain=mainnet-dev +// --chain +// alphanet-dev // --steps=50 // --repeat=20 -// --pallet=ternoa_tee // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output -// ./output +// --output=./weights/ +// --pallet=ternoa_tee #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -31,54 +31,59 @@ use sp_std::marker::PhantomData; /// Weight functions for `ternoa_tee`. pub struct WeightInfo(PhantomData); impl ternoa_tee::WeightInfo for WeightInfo { - // Storage: TEE EnclaveRegistrations (r:1 w:1) - // Storage: TEE EnclaveData (r:1 w:0) - // Storage: TEE EnclaveAccountOperator (r:1 w:0) - fn register_enclave() -> Weight { - Weight::from_ref_time(98_184_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveData (r:1 w:0) - // Storage: TEE EnclaveUnregistrations (r:1 w:1) - fn unregister_enclave() -> Weight { - Weight::from_ref_time(91_443_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveData (r:1 w:0) - // Storage: TEE EnclaveUpdates (r:1 w:1) - // Storage: TEE EnclaveAccountOperator (r:1 w:0) - fn update_enclave() -> Weight { - Weight::from_ref_time(133_793_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveUpdates (r:1 w:1) - fn cancel_update() -> Weight { - Weight::from_ref_time(71_405_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveRegistrations (r:1 w:1) - // Storage: TEE ClusterData (r:1 w:1) - // Storage: TEE EnclaveAccountOperator (r:1 w:1) - // Storage: TEE EnclaveData (r:1 w:1) - // Storage: TEE EnclaveClusterId (r:0 w:1) - fn assign_enclave() -> Weight { - Weight::from_ref_time(141_175_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(5 as u64)) - } - // Storage: TEE EnclaveRegistrations (r:1 w:1) - fn remove_registration() -> Weight { - Weight::from_ref_time(80_362_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Storage: TEE EnclaveRegistrations (r:1 w:1) + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE EnclaveAccountOperator (r:1 w:0) + // Storage: TEE StakingAmount (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: TEE StakingLedger (r:0 w:1) + fn register_enclave() -> Weight { + Weight::from_ref_time(82_930_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: TEE StakingAmount (r:1 w:0) + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE StakingLedger (r:0 w:1) + fn unregister_enclave() -> Weight { + Weight::from_ref_time(107_941_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE EnclaveUpdates (r:1 w:1) + // Storage: TEE EnclaveAccountOperator (r:1 w:0) + fn update_enclave() -> Weight { + Weight::from_ref_time(65_591_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE EnclaveUpdates (r:1 w:1) + fn cancel_update() -> Weight { + Weight::from_ref_time(50_530_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE EnclaveRegistrations (r:1 w:1) + // Storage: TEE ClusterData (r:1 w:1) + // Storage: TEE EnclaveAccountOperator (r:1 w:1) + // Storage: TEE EnclaveData (r:1 w:1) + // Storage: TEE EnclaveClusterId (r:0 w:1) + fn assign_enclave() -> Weight { + Weight::from_ref_time(135_892_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + // Storage: TEE EnclaveRegistrations (r:1 w:1) + fn remove_registration() -> Weight { + Weight::from_ref_time(80_101_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: TEE EnclaveUpdates (r:1 w:1) fn remove_update() -> Weight { - Weight::from_ref_time(151_134_000 as u64) + Weight::from_ref_time(49_860_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -86,32 +91,89 @@ impl ternoa_tee::WeightInfo for WeightInfo { // Storage: TEE EnclaveAccountOperator (r:1 w:1) // Storage: TEE EnclaveClusterId (r:1 w:1) // Storage: TEE ClusterData (r:1 w:1) - // Storage: TEE EnclaveUnregistrations (r:1 w:1) // Storage: TEE EnclaveUpdates (r:1 w:1) fn remove_enclave() -> Weight { - Weight::from_ref_time(161_545_000 as u64) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(6 as u64)) + Weight::from_ref_time(80_180_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) } // Storage: TEE EnclaveData (r:1 w:1) // Storage: TEE EnclaveAccountOperator (r:1 w:1) // Storage: TEE EnclaveUpdates (r:1 w:1) fn force_update_enclave() -> Weight { - Weight::from_ref_time(175_701_000 as u64) + Weight::from_ref_time(50_281_000 as u64) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: TEE NextClusterId (r:1 w:1) // Storage: TEE ClusterData (r:0 w:1) fn create_cluster() -> Weight { - Weight::from_ref_time(71_855_000 as u64) + Weight::from_ref_time(29_040_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: TEE ClusterData (r:1 w:1) + fn update_cluster() -> Weight { + Weight::from_ref_time(29_500_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE ClusterData (r:1 w:1) fn remove_cluster() -> Weight { - Weight::from_ref_time(71_444_000 as u64) + Weight::from_ref_time(29_070_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } + // Storage: TEE StakingLedger (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: TEE StakingAmount (r:1 w:0) + fn withdraw_unbonded() -> Weight { + Weight::from_ref_time(131_891_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: TEE MetricsServers (r:1 w:1) + fn register_metrics_server() -> Weight { + Weight::from_ref_time(69_001_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE MetricsServers (r:1 w:0) + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE MetricsReports (r:1 w:1) + fn submit_metrics_server_report() -> Weight { + Weight::from_ref_time(70_251_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE ReportParamsWeightages (r:0 w:1) + fn set_report_params_weightage() -> Weight { + Weight::from_ref_time(31_831_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE StakingAmount (r:0 w:1) + fn set_staking_amount() -> Weight { + Weight::from_ref_time(31_430_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE DailyRewardPool (r:0 w:1) + fn set_daily_reward_pool() -> Weight { + Weight::from_ref_time(31_501_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Staking ActiveEra (r:1 w:0) + // Storage: TEE EnclaveData (r:2 w:0) + // Storage: TEE DailyRewardPool (r:1 w:0) + // Storage: TEE MetricsReports (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: TEE ClaimedRewards (r:0 w:1) + fn claim_rewards() -> Weight { + Weight::from_ref_time(102_370_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + fn unregister_metrics_server() -> Weight { todo!() } + fn force_update_metrics_server_type() -> Weight { todo!() } } + diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index c65c2fe6..1f540180 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ternoa-runtime-common" authors = [ "Ternoa" ] -version = "1.3.1" +version = "1.3.2" edition = "2021" [dependencies] diff --git a/runtime/mainnet/Cargo.toml b/runtime/mainnet/Cargo.toml index f8714c87..86530fc0 100644 --- a/runtime/mainnet/Cargo.toml +++ b/runtime/mainnet/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "mainnet-runtime" authors = [ "Ternoa" ] -version = "1.3.1" +version = "1.3.2" edition = "2021" build = "build.rs" diff --git a/runtime/mainnet/src/pallets.rs b/runtime/mainnet/src/pallets.rs index b504d09d..6abd96c3 100644 --- a/runtime/mainnet/src/pallets.rs +++ b/runtime/mainnet/src/pallets.rs @@ -765,16 +765,25 @@ impl ternoa_rent::Config for Runtime { parameter_types! { pub const ClusterSize: u32 = 5; pub const MaxUriLen: u32 = 150; - pub const ListSizeLimit: u32 = 1_000; + pub const ListSizeLimit: u32 = 10; + pub const TeeBondingDuration: u32 = 12_96_000; + pub const InitialStakingAmount: Balance = 15_00_000_000_000_000_000_000_000; + pub const InitalDailyRewardPool: Balance = 13_699_000_000_000_000_000_000; + pub const TeePalletId: PalletId = PalletId(*b"teepalet"); + pub const TeeHistoryDepth: u32 = 84; } impl ternoa_tee::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type WeightInfo = weights::ternoa_tee::WeightInfo; + type TeeWeightInfo = weights::ternoa_tee::WeightInfo; type ClusterSize = ClusterSize; type MaxUriLen = MaxUriLen; type ListSizeLimit = ListSizeLimit; + type TeeBondingDuration = TeeBondingDuration; + type InitialStakingAmount = InitialStakingAmount; + type InitalDailyRewardPool = InitalDailyRewardPool; + type PalletId = TeePalletId; + type TeeHistoryDepth = TeeHistoryDepth; } parameter_types! { diff --git a/runtime/mainnet/src/version.rs b/runtime/mainnet/src/version.rs index 1b415f3b..391e23c9 100644 --- a/runtime/mainnet/src/version.rs +++ b/runtime/mainnet/src/version.rs @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { /// Version of the runtime specification. A full-node will not attempt to use its native /// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, /// `spec_version` and `authoring_version` are the same between Wasm and native. - spec_version: 15, + spec_version: 16, /// Version of the implementation of the specification. Nodes are free to ignore this; it /// serves only as an indication that the code is different; as long as the other two versions diff --git a/runtime/mainnet/src/weights/ternoa_tee.rs b/runtime/mainnet/src/weights/ternoa_tee.rs index 4fb8f28f..4467a984 100644 --- a/runtime/mainnet/src/weights/ternoa_tee.rs +++ b/runtime/mainnet/src/weights/ternoa_tee.rs @@ -7,19 +7,19 @@ //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("mainnet-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/ternoa +// ./target/release/ternoa // benchmark // pallet -// --chain=mainnet-dev +// --chain +// alphanet-dev // --steps=50 // --repeat=20 -// --pallet=ternoa_tee // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output -// ./output +// --output=./weights/ +// --pallet=ternoa_tee #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -31,54 +31,59 @@ use sp_std::marker::PhantomData; /// Weight functions for `ternoa_tee`. pub struct WeightInfo(PhantomData); impl ternoa_tee::WeightInfo for WeightInfo { - // Storage: TEE EnclaveRegistrations (r:1 w:1) - // Storage: TEE EnclaveData (r:1 w:0) - // Storage: TEE EnclaveAccountOperator (r:1 w:0) - fn register_enclave() -> Weight { - Weight::from_ref_time(98_184_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveData (r:1 w:0) - // Storage: TEE EnclaveUnregistrations (r:1 w:1) - fn unregister_enclave() -> Weight { - Weight::from_ref_time(91_443_000 as u64) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveData (r:1 w:0) - // Storage: TEE EnclaveUpdates (r:1 w:1) - // Storage: TEE EnclaveAccountOperator (r:1 w:0) - fn update_enclave() -> Weight { - Weight::from_ref_time(133_793_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveUpdates (r:1 w:1) - fn cancel_update() -> Weight { - Weight::from_ref_time(71_405_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: TEE EnclaveRegistrations (r:1 w:1) - // Storage: TEE ClusterData (r:1 w:1) - // Storage: TEE EnclaveAccountOperator (r:1 w:1) - // Storage: TEE EnclaveData (r:1 w:1) - // Storage: TEE EnclaveClusterId (r:0 w:1) - fn assign_enclave() -> Weight { - Weight::from_ref_time(141_175_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(5 as u64)) - } - // Storage: TEE EnclaveRegistrations (r:1 w:1) - fn remove_registration() -> Weight { - Weight::from_ref_time(80_362_000 as u64) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + // Storage: TEE EnclaveRegistrations (r:1 w:1) + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE EnclaveAccountOperator (r:1 w:0) + // Storage: TEE StakingAmount (r:1 w:0) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: TEE StakingLedger (r:0 w:1) + fn register_enclave() -> Weight { + Weight::from_ref_time(82_930_000 as u64) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(4 as u64)) + } + // Storage: TEE StakingAmount (r:1 w:0) + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE StakingLedger (r:0 w:1) + fn unregister_enclave() -> Weight { + Weight::from_ref_time(107_941_000 as u64) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE EnclaveUpdates (r:1 w:1) + // Storage: TEE EnclaveAccountOperator (r:1 w:0) + fn update_enclave() -> Weight { + Weight::from_ref_time(65_591_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE EnclaveUpdates (r:1 w:1) + fn cancel_update() -> Weight { + Weight::from_ref_time(50_530_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE EnclaveRegistrations (r:1 w:1) + // Storage: TEE ClusterData (r:1 w:1) + // Storage: TEE EnclaveAccountOperator (r:1 w:1) + // Storage: TEE EnclaveData (r:1 w:1) + // Storage: TEE EnclaveClusterId (r:0 w:1) + fn assign_enclave() -> Weight { + Weight::from_ref_time(135_892_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + // Storage: TEE EnclaveRegistrations (r:1 w:1) + fn remove_registration() -> Weight { + Weight::from_ref_time(80_101_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: TEE EnclaveUpdates (r:1 w:1) fn remove_update() -> Weight { - Weight::from_ref_time(151_134_000 as u64) + Weight::from_ref_time(49_860_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } @@ -86,32 +91,89 @@ impl ternoa_tee::WeightInfo for WeightInfo { // Storage: TEE EnclaveAccountOperator (r:1 w:1) // Storage: TEE EnclaveClusterId (r:1 w:1) // Storage: TEE ClusterData (r:1 w:1) - // Storage: TEE EnclaveUnregistrations (r:1 w:1) // Storage: TEE EnclaveUpdates (r:1 w:1) fn remove_enclave() -> Weight { - Weight::from_ref_time(161_545_000 as u64) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(6 as u64)) + Weight::from_ref_time(80_180_000 as u64) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) } // Storage: TEE EnclaveData (r:1 w:1) // Storage: TEE EnclaveAccountOperator (r:1 w:1) // Storage: TEE EnclaveUpdates (r:1 w:1) fn force_update_enclave() -> Weight { - Weight::from_ref_time(175_701_000 as u64) + Weight::from_ref_time(50_281_000 as u64) .saturating_add(T::DbWeight::get().reads(3 as u64)) .saturating_add(T::DbWeight::get().writes(3 as u64)) } // Storage: TEE NextClusterId (r:1 w:1) // Storage: TEE ClusterData (r:0 w:1) fn create_cluster() -> Weight { - Weight::from_ref_time(71_855_000 as u64) + Weight::from_ref_time(29_040_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(2 as u64)) } // Storage: TEE ClusterData (r:1 w:1) + fn update_cluster() -> Weight { + Weight::from_ref_time(29_500_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE ClusterData (r:1 w:1) fn remove_cluster() -> Weight { - Weight::from_ref_time(71_444_000 as u64) + Weight::from_ref_time(29_070_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } + // Storage: TEE StakingLedger (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: TEE StakingAmount (r:1 w:0) + fn withdraw_unbonded() -> Weight { + Weight::from_ref_time(131_891_000 as u64) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + // Storage: TEE MetricsServers (r:1 w:1) + fn register_metrics_server() -> Weight { + Weight::from_ref_time(69_001_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE MetricsServers (r:1 w:0) + // Storage: TEE EnclaveData (r:1 w:0) + // Storage: TEE MetricsReports (r:1 w:1) + fn submit_metrics_server_report() -> Weight { + Weight::from_ref_time(70_251_000 as u64) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE ReportParamsWeightages (r:0 w:1) + fn set_report_params_weightage() -> Weight { + Weight::from_ref_time(31_831_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE StakingAmount (r:0 w:1) + fn set_staking_amount() -> Weight { + Weight::from_ref_time(31_430_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: TEE DailyRewardPool (r:0 w:1) + fn set_daily_reward_pool() -> Weight { + Weight::from_ref_time(31_501_000 as u64) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: Staking ActiveEra (r:1 w:0) + // Storage: TEE EnclaveData (r:2 w:0) + // Storage: TEE DailyRewardPool (r:1 w:0) + // Storage: TEE MetricsReports (r:1 w:0) + // Storage: System Account (r:2 w:2) + // Storage: TEE ClaimedRewards (r:0 w:1) + fn claim_rewards() -> Weight { + Weight::from_ref_time(102_370_000 as u64) + .saturating_add(T::DbWeight::get().reads(7 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + fn unregister_metrics_server() -> Weight { todo!() } + fn force_update_metrics_server_type() -> Weight { todo!() } } + diff --git a/ternoa-pallets b/ternoa-pallets index 9814c2bd..b7322161 160000 --- a/ternoa-pallets +++ b/ternoa-pallets @@ -1 +1 @@ -Subproject commit 9814c2bdc93bf62af48d347d3fe1b8af97ec73e8 +Subproject commit b73221615a9564562d72c33ba9fab2869f40d188