diff --git a/c-pallets/audit/src/benchmarking.rs b/c-pallets/audit/src/benchmarking.rs index bdf395ab..6fd062fd 100644 --- a/c-pallets/audit/src/benchmarking.rs +++ b/c-pallets/audit/src/benchmarking.rs @@ -2,9 +2,10 @@ use crate::{Pallet as Audit, *}; // use cp_cess_common::{IpAddress, Hash, DataType}; // use codec::{alloc::string::ToString, Decode}; -pub use frame_benchmarking::{ +use frame_benchmarking::{ account, benchmarks, impl_benchmark_test_suite, whitelist_account, whitelisted_caller, }; +use frame_system::RawOrigin; // use frame_support::{ // dispatch::UnfilteredDispatchable, // pallet_prelude::*, @@ -22,19 +23,214 @@ pub use frame_benchmarking::{ // use sp_std::prelude::*; // use frame_system::RawOrigin; +pub struct Pallet(Audit); +pub trait Config: + crate::Config + pallet_cess_staking::Config + pallet_tee_worker::benchmarking::Config + pallet_sminer::benchmarking::Config + pallet_file_bank::benchmarking::Config +{ +} -// pub struct Pallet(Audit); -// pub trait Config: -// crate::Config + pallet_cess_staking::Config + pallet_tee_worker::Config + pallet_sminer::Config + pallet_file_bank::Config -// { -// } +const USER_SEED: u32 = 999666; -// const USER_SEED: u32 = 999666; +const SEED: u32 = 2190502; -// pub fn bench_generate_challenge() { +const MINER_LIST: [&'static str; 30] = [ + "miner1", "miner2", "miner3", "miner4", "miner5", "miner6", "miner7", "miner8", "miner9", "miner10", + "miner11", "miner12", "miner13", "miner14", "miner15", "miner16", "miner17", "miner18", "miner19", "miner20", + "miner21", "miner22", "miner23", "miner24", "miner25", "miner26", "miner27", "miner28", "miner29", "miner30", +]; -// } +pub fn bench_generate_challenge() { + let space_challenge_param = [67_549_635, 67_864_236, 67_338_392, 67_130_229, 67_369_766, 67_193_409, 67_799_602, 67_425_292]; + let random_index_list = [691, 406, 838, 480, 996, 798, 362, 456, 144, 666, 1, 018, 568, 992, 650, 729, 808, 229, 623, 499, 671, 254, 24, 217, 698, 648, 781, 460, 298, 548, 742, 364, 183, 114, 309, 564, 127, 154, 815, 651, 397, 576, 697, 358, 880, 73, 629, 66]; + let random_list = [[55u8; 20]; 48]; -// benchmarks! { + let mut miner_snapshot_list: BoundedVec, BlockNumberOf>, ::ChallengeMinerMax> = Default::default(); + let mut total_idle_space: u128 = u128::MIN; + let mut total_service_space: u128 = u128::MIN; + let all_miner = ::MinerControl::get_all_miner().expect("get all miner error!"); + for miner in all_miner.into_iter() { + let (idle_space, service_space, service_bloom_filter, space_proof_info, tee_signature) = ::MinerControl::get_miner_snapshot(&miner).expect("get miner snapshot failed"); + if (idle_space == 0) && (service_space == 0) { + continue; + } + total_idle_space = total_idle_space.checked_add(idle_space).expect("overflow"); + total_service_space = total_service_space.checked_add(service_space).expect("overflow"); + let miner_snapshot = MinerSnapShot::, BlockNumberOf> { + miner, + idle_life: 200u32.saturated_into(), + service_life: 200u32.saturated_into(), + idle_space, + service_space, + idle_submitted: false, + service_submitted: false, + service_bloom_filter, + space_proof_info, + tee_signature, + }; + miner_snapshot_list.try_push(miner_snapshot).unwrap(); + } -// } + let _ = pallet_sminer::benchmarking::increase_reward::(1_000_000_000_000_000u128); + + let net_snap_shot = NetSnapShot::> { + start: 1u32.saturated_into(), + life: 2000u32.saturated_into(), + total_reward: 1_000_000_000_000_000u128, + total_idle_space, + total_service_space, + random_index_list: random_index_list.to_vec().try_into().expect("BoundedVec Error"), + random_list: random_list.to_vec().try_into().expect("BoundedVec Error"), + space_challenge_param, + }; + + let challenge_info = ChallengeInfo:: { + net_snap_shot, + miner_snapshot_list, + }; + >::put(challenge_info); + let duration: BlockNumberOf = 5000u32.saturated_into(); + >::put(duration); + let duration: BlockNumberOf = 6000u32.saturated_into(); + >::put(duration); +} + +benchmarks! { + submit_idle_proof { + let _ = pallet_tee_worker::benchmarking::tee_register::()?; + for i in 0 .. 5 { + let miner = pallet_sminer::benchmarking::add_miner::(MINER_LIST[i as usize])?; + pallet_file_bank::benchmarking::add_idle_space::(miner.clone())?; + } + bench_generate_challenge::(); + let miner: AccountOf = account("miner1", 100, SEED); + let idle_total_hash: BoundedVec = [5u8; 256].to_vec().try_into().unwrap(); + }: _(RawOrigin::Signed(miner.clone()), idle_total_hash) + verify { + let challenge_snap_shot = >::try_get().unwrap(); + let mut miner_list: Vec> = Default::default(); + for (index, miner_snapshot) in challenge_snap_shot.miner_snapshot_list.iter().enumerate() { + miner_list.push(miner_snapshot.miner.clone()); + if miner_snapshot.miner == miner { + assert_eq!(miner_snapshot.idle_submitted, true); + } + } + assert!(miner_list.contains(&miner)); + } + + submit_service_proof { + let _ = pallet_tee_worker::benchmarking::tee_register::()?; + for i in 0 .. 5 { + let miner = pallet_sminer::benchmarking::add_miner::(MINER_LIST[i as usize])?; + pallet_file_bank::benchmarking::add_idle_space::(miner.clone())?; + } + bench_generate_challenge::(); + let miner: AccountOf = account("miner1", 100, SEED); + let sigma: BoundedVec = [5u8; 2048].to_vec().try_into().unwrap(); + }: _(RawOrigin::Signed(miner.clone()), sigma) + verify { + let challenge_snap_shot = >::try_get().unwrap(); + let mut miner_list: Vec> = Default::default(); + for (index, miner_snapshot) in challenge_snap_shot.miner_snapshot_list.iter().enumerate() { + miner_list.push(miner_snapshot.miner.clone()); + if miner_snapshot.miner == miner { + assert_eq!(miner_snapshot.service_submitted, true); + } + } + assert!(miner_list.contains(&miner)); + } + + submit_verify_idle_result { + let (_, controller_acc) = pallet_tee_worker::benchmarking::tee_register::()?; + for i in 0 .. 5 { + let miner = pallet_sminer::benchmarking::add_miner::(MINER_LIST[i as usize])?; + pallet_file_bank::benchmarking::add_idle_space::(miner.clone())?; + } + bench_generate_challenge::(); + let miner: AccountOf = account("miner1", 100, SEED); + let idle_total_hash: BoundedVec = [5u8; 256].to_vec().try_into().unwrap(); + let sigma: BoundedVec = [5u8; 2048].to_vec().try_into().unwrap(); + Audit::::submit_idle_proof(RawOrigin::Signed(miner.clone()).into(), idle_total_hash.clone())?; + Audit::::submit_service_proof(RawOrigin::Signed(miner.clone()).into(), sigma.clone())?; + + let random_index_list = [691, 406, 838, 480, 996, 798, 362, 456, 144, 666, 1, 018, 568, 992, 650, 729, 808, 229, 623, 499, 671, 254, 24, 217, 698, 648, 781, 460, 298, 548, 742, 364, 183, 114, 309, 564, 127, 154, 815, 651, 397, 576, 697, 358, 880, 73, 629, 66]; + let random_list = [[55u8; 20]; 48]; + let verify_service_result = VerifyServiceResultInfo::{ + miner: miner.clone(), + tee_acc: controller_acc.clone(), + miner_prove: sigma.clone(), + result: true, + chal: QElement { + random_index_list: random_index_list.to_vec().try_into().unwrap(), + random_list: random_list.to_vec().try_into().unwrap(), + }, + service_bloom_filter: cp_bloom_filter::BloomFilter([0u64; 256]), + }; + + let sig = [51, 231, 229, 255, 95, 218, 131, 76, 213, 104, 14, 3, 79, 205, 33, 157, 39, 190, 5, 169, 27, 210, 250, 86, 103, 116, 218, 23, 255, 252, 221, 247, 82, 109, 185, 200, 134, 188, 81, 199, 219, 245, 30, 42, 228, 193, 208, 135, 209, 24, 232, 30, 104, 90, 156, 215, 174, 98, 143, 143, 119, 217, 72, 24, 247, 232, 191, 246, 205, 57, 221, 124, 234, 135, 110, 184, 208, 77, 60, 64, 169, 75, 168, 123, 244, 134, 187, 187, 65, 62, 237, 10, 246, 102, 44, 235, 68, 175, 91, 36, 58, 157, 213, 63, 184, 32, 38, 242, 57, 255, 190, 251, 214, 41, 53, 36, 190, 66, 47, 100, 153, 110, 88, 6, 221, 250, 183, 169, 76, 203, 9, 188, 187, 79, 149, 16, 145, 155, 97, 89, 56, 94, 187, 65, 197, 133, 121, 0, 73, 115, 166, 148, 177, 62, 121, 137, 96, 86, 3, 111, 153, 108, 230, 241, 190, 114, 169, 249, 118, 50, 130, 46, 190, 127, 131, 142, 253, 217, 138, 102, 215, 162, 47, 94, 83, 36, 117, 25, 24, 125, 11, 91, 112, 211, 201, 28, 64, 141, 129, 14, 117, 2, 124, 217, 229, 179, 192, 34, 0, 37, 187, 44, 38, 170, 116, 176, 175, 96, 207, 181, 144, 30, 246, 170, 98, 206, 88, 176, 141, 118, 180, 99, 107, 196, 201, 206, 144, 81, 154, 138, 115, 38, 88, 219, 8, 55, 221, 20, 222, 106, 134, 98, 184, 92, 253, 185]; + Audit::::submit_verify_service_result(RawOrigin::Signed(miner.clone()).into(), verify_service_result.result, sig, verify_service_result.service_bloom_filter, verify_service_result.tee_acc)?; + + let verify_idle_result = VerifyIdleResultInfo::{ + miner: miner.clone(), + miner_prove: idle_total_hash.clone(), + front: 0, + rear: 10000, + accumulator: [8u8; 256], + space_challenge_param: [67_549_635, 67_864_236, 67_338_392, 67_130_229, 67_369_766, 67_193_409, 67_799_602, 67_425_292], + result: true, + tee_acc: controller_acc.clone(), + }; + + let sig = [105, 84, 152, 186, 134, 202, 80, 152, 159, 223, 251, 150, 106, 226, 63, 179, 168, 182, 237, 158, 111, 17, 68, 195, 39, 255, 75, 98, 67, 232, 10, 129, 175, 254, 222, 147, 45, 182, 91, 235, 26, 246, 88, 16, 106, 100, 241, 54, 236, 205, 224, 173, 113, 54, 71, 0, 95, 157, 184, 238, 54, 114, 40, 145, 44, 87, 163, 77, 177, 34, 211, 247, 51, 174, 53, 20, 151, 186, 173, 135, 83, 150, 197, 172, 121, 181, 203, 164, 10, 104, 163, 51, 110, 231, 241, 26, 112, 214, 127, 139, 247, 33, 158, 252, 146, 157, 47, 53, 172, 50, 111, 45, 249, 109, 145, 173, 10, 228, 133, 34, 163, 4, 254, 140, 64, 252, 136, 40, 87, 242, 36, 83, 15, 23, 182, 77, 9, 197, 223, 36, 129, 3, 41, 247, 102, 143, 192, 42, 251, 16, 215, 193, 1, 19, 154, 245, 212, 209, 52, 1, 80, 248, 118, 47, 114, 202, 238, 173, 244, 154, 218, 209, 71, 185, 76, 15, 0, 56, 213, 201, 228, 193, 105, 160, 48, 247, 134, 58, 91, 121, 75, 144, 163, 89, 105, 176, 29, 30, 169, 70, 205, 202, 188, 230, 207, 171, 95, 253, 14, 103, 249, 144, 213, 44, 57, 142, 82, 252, 103, 201, 183, 218, 31, 131, 219, 108, 83, 115, 198, 3, 14, 244, 178, 48, 196, 128, 100, 53, 1, 10, 31, 37, 205, 163, 20, 181, 71, 152, 171, 180, 102, 208, 1, 241, 174, 28]; + }: _(RawOrigin::Signed(miner.clone()), verify_idle_result.miner_prove, verify_idle_result.front, verify_idle_result.rear, verify_idle_result.accumulator, verify_idle_result.result, sig, verify_idle_result.tee_acc) + verify { + let unverify_list = >::try_get(&controller_acc).unwrap(); + assert_eq!(0, unverify_list.len()); + } + + submit_verify_service_result { + let (_, controller_acc) = pallet_tee_worker::benchmarking::tee_register::()?; + for i in 0 .. 5 { + let miner = pallet_sminer::benchmarking::add_miner::(MINER_LIST[i as usize])?; + pallet_file_bank::benchmarking::add_idle_space::(miner.clone())?; + } + bench_generate_challenge::(); + let miner: AccountOf = account("miner1", 100, SEED); + let idle_total_hash: BoundedVec = [5u8; 256].to_vec().try_into().unwrap(); + let sigma: BoundedVec = [5u8; 2048].to_vec().try_into().unwrap(); + Audit::::submit_idle_proof(RawOrigin::Signed(miner.clone()).into(), idle_total_hash.clone())?; + Audit::::submit_service_proof(RawOrigin::Signed(miner.clone()).into(), sigma.clone())?; + + let verify_idle_result = VerifyIdleResultInfo::{ + miner: miner.clone(), + miner_prove: idle_total_hash.clone(), + front: 0, + rear: 10000, + accumulator: [8u8; 256], + space_challenge_param: [67_549_635, 67_864_236, 67_338_392, 67_130_229, 67_369_766, 67_193_409, 67_799_602, 67_425_292], + result: true, + tee_acc: controller_acc.clone(), + }; + let sig = [105, 84, 152, 186, 134, 202, 80, 152, 159, 223, 251, 150, 106, 226, 63, 179, 168, 182, 237, 158, 111, 17, 68, 195, 39, 255, 75, 98, 67, 232, 10, 129, 175, 254, 222, 147, 45, 182, 91, 235, 26, 246, 88, 16, 106, 100, 241, 54, 236, 205, 224, 173, 113, 54, 71, 0, 95, 157, 184, 238, 54, 114, 40, 145, 44, 87, 163, 77, 177, 34, 211, 247, 51, 174, 53, 20, 151, 186, 173, 135, 83, 150, 197, 172, 121, 181, 203, 164, 10, 104, 163, 51, 110, 231, 241, 26, 112, 214, 127, 139, 247, 33, 158, 252, 146, 157, 47, 53, 172, 50, 111, 45, 249, 109, 145, 173, 10, 228, 133, 34, 163, 4, 254, 140, 64, 252, 136, 40, 87, 242, 36, 83, 15, 23, 182, 77, 9, 197, 223, 36, 129, 3, 41, 247, 102, 143, 192, 42, 251, 16, 215, 193, 1, 19, 154, 245, 212, 209, 52, 1, 80, 248, 118, 47, 114, 202, 238, 173, 244, 154, 218, 209, 71, 185, 76, 15, 0, 56, 213, 201, 228, 193, 105, 160, 48, 247, 134, 58, 91, 121, 75, 144, 163, 89, 105, 176, 29, 30, 169, 70, 205, 202, 188, 230, 207, 171, 95, 253, 14, 103, 249, 144, 213, 44, 57, 142, 82, 252, 103, 201, 183, 218, 31, 131, 219, 108, 83, 115, 198, 3, 14, 244, 178, 48, 196, 128, 100, 53, 1, 10, 31, 37, 205, 163, 20, 181, 71, 152, 171, 180, 102, 208, 1, 241, 174, 28]; + Audit::::submit_verify_idle_result(RawOrigin::Signed(miner.clone()).into(), verify_idle_result.miner_prove, verify_idle_result.front, verify_idle_result.rear, verify_idle_result.accumulator, verify_idle_result.result, sig, verify_idle_result.tee_acc)?; + + let random_index_list = [691, 406, 838, 480, 996, 798, 362, 456, 144, 666, 1, 018, 568, 992, 650, 729, 808, 229, 623, 499, 671, 254, 24, 217, 698, 648, 781, 460, 298, 548, 742, 364, 183, 114, 309, 564, 127, 154, 815, 651, 397, 576, 697, 358, 880, 73, 629, 66]; + let random_list = [[55u8; 20]; 48]; + let verify_service_result = VerifyServiceResultInfo::{ + miner: miner.clone(), + tee_acc: controller_acc.clone(), + miner_prove: sigma.clone(), + result: true, + chal: QElement { + random_index_list: random_index_list.to_vec().try_into().unwrap(), + random_list: random_list.to_vec().try_into().unwrap(), + }, + service_bloom_filter: cp_bloom_filter::BloomFilter([0u64; 256]), + }; + + let sig = [51, 231, 229, 255, 95, 218, 131, 76, 213, 104, 14, 3, 79, 205, 33, 157, 39, 190, 5, 169, 27, 210, 250, 86, 103, 116, 218, 23, 255, 252, 221, 247, 82, 109, 185, 200, 134, 188, 81, 199, 219, 245, 30, 42, 228, 193, 208, 135, 209, 24, 232, 30, 104, 90, 156, 215, 174, 98, 143, 143, 119, 217, 72, 24, 247, 232, 191, 246, 205, 57, 221, 124, 234, 135, 110, 184, 208, 77, 60, 64, 169, 75, 168, 123, 244, 134, 187, 187, 65, 62, 237, 10, 246, 102, 44, 235, 68, 175, 91, 36, 58, 157, 213, 63, 184, 32, 38, 242, 57, 255, 190, 251, 214, 41, 53, 36, 190, 66, 47, 100, 153, 110, 88, 6, 221, 250, 183, 169, 76, 203, 9, 188, 187, 79, 149, 16, 145, 155, 97, 89, 56, 94, 187, 65, 197, 133, 121, 0, 73, 115, 166, 148, 177, 62, 121, 137, 96, 86, 3, 111, 153, 108, 230, 241, 190, 114, 169, 249, 118, 50, 130, 46, 190, 127, 131, 142, 253, 217, 138, 102, 215, 162, 47, 94, 83, 36, 117, 25, 24, 125, 11, 91, 112, 211, 201, 28, 64, 141, 129, 14, 117, 2, 124, 217, 229, 179, 192, 34, 0, 37, 187, 44, 38, 170, 116, 176, 175, 96, 207, 181, 144, 30, 246, 170, 98, 206, 88, 176, 141, 118, 180, 99, 107, 196, 201, 206, 144, 81, 154, 138, 115, 38, 88, 219, 8, 55, 221, 20, 222, 106, 134, 98, 184, 92, 253, 185]; + }: _(RawOrigin::Signed(miner.clone()), verify_service_result.result, sig, verify_service_result.service_bloom_filter, verify_service_result.tee_acc) + verify { + let unverify_list = >::try_get(&controller_acc).unwrap(); + assert_eq!(0, unverify_list.len()); + } +} diff --git a/c-pallets/audit/src/lib.rs b/c-pallets/audit/src/lib.rs index 7c627c64..b0a8fe74 100644 --- a/c-pallets/audit/src/lib.rs +++ b/c-pallets/audit/src/lib.rs @@ -478,7 +478,7 @@ pub mod pallet { >::insert(&sender, u8::MIN); challenge_info.miner_snapshot_list.remove(index); } - + return Ok(temp_miner_snap); } } @@ -501,7 +501,6 @@ pub mod pallet { UnverifyIdleProof::::mutate(tee_acc, |unverify_list| -> DispatchResult { unverify_list.try_push(prove_info).map_err(|_| Error::::Overflow)?; - Ok(()) })?; diff --git a/c-pallets/audit/src/weights_demo.rs b/c-pallets/audit/src/weights_demo.rs new file mode 100644 index 00000000..fc161a76 --- /dev/null +++ b/c-pallets/audit/src/weights_demo.rs @@ -0,0 +1,153 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_audit +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-08-29, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("cess-initial-devnet"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/cess-node +// benchmark +// pallet +// --chain +// cess-initial-devnet +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// pallet_audit +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=./.maintain/frame-weight-template.hbs +// --output=./c-pallets/audit/src/weights_demo.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_audit. +pub trait WeightInfo { + fn submit_idle_proof() -> Weight; + fn submit_service_proof() -> Weight; + fn submit_verify_idle_result() -> Weight; + fn submit_verify_service_result() -> Weight; +} + +/// Weights for pallet_audit using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + // Storage: Audit ChallengeSnapShot (r:1 w:1) + // Storage: TeeWorker TeeWorkerMap (r:2 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: Audit UnverifyIdleProof (r:1 w:1) + fn submit_idle_proof() -> Weight { + (172_133_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Audit ChallengeSnapShot (r:1 w:1) + // Storage: TeeWorker TeeWorkerMap (r:2 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: Audit UnverifyServiceProof (r:1 w:1) + fn submit_service_proof() -> Weight { + (144_386_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Audit UnverifyIdleProof (r:1 w:1) + // Storage: Audit ChallengeSnapShot (r:1 w:0) + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Audit VerifyResult (r:1 w:1) + // Storage: Sminer RewardMap (r:1 w:1) + // Storage: Sminer CurrencyReward (r:1 w:1) + // Storage: SchedulerCredit CurrentCounters (r:1 w:1) + // Storage: Audit CountedIdleFailed (r:0 w:1) + fn submit_verify_idle_result() -> Weight { + (1_722_404_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: Audit UnverifyServiceProof (r:1 w:1) + // Storage: Audit ChallengeSnapShot (r:1 w:0) + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Audit VerifyResult (r:1 w:1) + // Storage: Sminer RewardMap (r:1 w:1) + // Storage: Sminer CurrencyReward (r:1 w:1) + // Storage: SchedulerCredit CurrentCounters (r:1 w:1) + // Storage: Audit CountedIdleFailed (r:0 w:1) + fn submit_verify_service_result() -> Weight { + (1_768_883_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + // Storage: Audit ChallengeSnapShot (r:1 w:1) + // Storage: TeeWorker TeeWorkerMap (r:2 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: Audit UnverifyIdleProof (r:1 w:1) + fn submit_idle_proof() -> Weight { + (172_133_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + // Storage: Audit ChallengeSnapShot (r:1 w:1) + // Storage: TeeWorker TeeWorkerMap (r:2 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: Audit UnverifyServiceProof (r:1 w:1) + fn submit_service_proof() -> Weight { + (144_386_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + // Storage: Audit UnverifyIdleProof (r:1 w:1) + // Storage: Audit ChallengeSnapShot (r:1 w:0) + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Audit VerifyResult (r:1 w:1) + // Storage: Sminer RewardMap (r:1 w:1) + // Storage: Sminer CurrencyReward (r:1 w:1) + // Storage: SchedulerCredit CurrentCounters (r:1 w:1) + // Storage: Audit CountedIdleFailed (r:0 w:1) + fn submit_verify_idle_result() -> Weight { + (1_722_404_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(7 as Weight)) + .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + } + // Storage: Audit UnverifyServiceProof (r:1 w:1) + // Storage: Audit ChallengeSnapShot (r:1 w:0) + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Audit VerifyResult (r:1 w:1) + // Storage: Sminer RewardMap (r:1 w:1) + // Storage: Sminer CurrencyReward (r:1 w:1) + // Storage: SchedulerCredit CurrentCounters (r:1 w:1) + // Storage: Audit CountedIdleFailed (r:0 w:1) + fn submit_verify_service_result() -> Weight { + (1_768_883_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(7 as Weight)) + .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + } +} \ No newline at end of file diff --git a/c-pallets/file-bank/src/benchmarking.rs b/c-pallets/file-bank/src/benchmarking.rs index b58b0dac..77433166 100755 --- a/c-pallets/file-bank/src/benchmarking.rs +++ b/c-pallets/file-bank/src/benchmarking.rs @@ -136,12 +136,12 @@ benchmarks! { log::info!("original: {:?}", original); - let tee_sig = [40, 184, 234, 22, 220, 221, 5, 31, 62, 245, 212, 216, 231, 188, 235, 150, 73, 189, 73, 38, 124, 227, 107, 163, 241, 3, 213, 25, 35, 245, 176, 145, 173, 18, 171, 18, 76, 103, 112, 64, 46, 19, 129, 212, 13, 42, 248, 218, 159, 38, 172, 121, 253, 252, 252, 181, 115, 110, 39, 122, 231, 249, 121, 121, 219, 96, 153, 180, 207, 193, 58, 248, 191, 255, 151, 223, 13, 179, 23, 153, 236, 234, 214, 254, 73, 142, 0, 56, 89, 245, 238, 26, 211, 246, 152, 12, 79, 2, 30, 21, 124, 168, 72, 100, 204, 7, 107, 71, 127, 209, 3, 55, 148, 240, 64, 143, 1, 190, 228, 24, 192, 46, 34, 254, 252, 105, 253, 95, 8, 143, 93, 177, 132, 73, 42, 182, 141, 226, 1, 167, 187, 47, 41, 176, 44, 140, 141, 150, 160, 246, 23, 251, 241, 23, 97, 58, 44, 11, 116, 116, 93, 182, 247, 58, 132, 44, 50, 224, 105, 39, 108, 84, 31, 113, 22, 35, 218, 163, 114, 240, 162, 80, 8, 183, 74, 181, 122, 132, 241, 196, 54, 61, 245, 108, 253, 45, 222, 211, 98, 147, 213, 53, 101, 169, 209, 139, 214, 64, 228, 10, 179, 204, 168, 231, 91, 23, 75, 38, 97, 4, 12, 78, 197, 166, 79, 40, 105, 162, 110, 251, 102, 158, 108, 223, 148, 208, 205, 226, 134, 29, 131, 135, 130, 152, 244, 177, 208, 44, 158, 17, 131, 249, 34, 74, 89, 216]; + let tee_sig = [19, 66, 60, 64, 120, 225, 105, 244, 158, 246, 90, 112, 6, 239, 63, 152, 116, 41, 57, 4, 4, 217, 206, 100, 138, 168, 193, 247, 62, 155, 76, 164, 179, 117, 202, 77, 182, 109, 223, 103, 50, 197, 214, 153, 233, 158, 124, 138, 64, 252, 54, 62, 250, 128, 177, 239, 248, 98, 31, 77, 208, 8, 91, 241, 66, 205, 89, 240, 211, 84, 250, 194, 206, 106, 35, 25, 154, 82, 174, 156, 14, 10, 201, 1, 45, 70, 50, 89, 202, 96, 42, 93, 227, 71, 119, 211, 11, 210, 192, 113, 249, 221, 217, 116, 181, 116, 206, 56, 43, 238, 147, 157, 38, 95, 79, 73, 221, 41, 87, 203, 162, 172, 32, 9, 173, 190, 225, 160, 118, 34, 77, 121, 73, 79, 199, 66, 32, 131, 174, 158, 210, 97, 172, 72, 251, 183, 247, 74, 207, 46, 201, 97, 90, 171, 251, 245, 202, 155, 8, 168, 199, 206, 64, 97, 66, 215, 6, 251, 111, 32, 37, 56, 60, 178, 2, 155, 167, 207, 224, 56, 20, 196, 162, 9, 188, 137, 225, 48, 117, 217, 229, 183, 122, 157, 93, 12, 142, 131, 239, 44, 12, 157, 55, 246, 59, 22, 216, 112, 84, 42, 54, 226, 99, 46, 246, 5, 110, 15, 122, 247, 46, 244, 132, 195, 60, 54, 98, 232, 53, 162, 82, 107, 134, 218, 70, 71, 148, 75, 31, 65, 33, 193, 221, 20, 124, 128, 42, 9, 116, 181, 125, 77, 33, 202, 152, 179]; }: _(RawOrigin::Signed(miner.clone()), space_proof_info, tee_sig) verify { let (idle, service) = T::MinerControl::get_power(&miner)?; - assert_eq!(idle, 1000 * 256 * 1024 * 1024); + assert_eq!(idle, 1000 * IDLE_SEG_SIZE); } upload_declaration { @@ -429,7 +429,6 @@ benchmarks! { let avail_replace_space = deal_info.assigned_miner[0].fragment_list.len() as u128 * FRAGMENT_SIZE; let front = avail_replace_space / IDLE_SEG_SIZE; - log::info!("deal_info.assigned_miner[0].fragment_list.len(): {:?}", deal_info.assigned_miner[0].fragment_list.len()); let pois_key = PoISKey { g: [2u8; 256], @@ -447,7 +446,7 @@ benchmarks! { let hashing = sp_io::hashing::sha2_256(&encoding); log::info!("replace_idle_space hashing: {:?}", hashing); - let tee_sig = [92, 125, 38, 132, 147, 27, 79, 14, 12, 32, 237, 138, 183, 67, 18, 196, 163, 224, 179, 213, 78, 70, 226, 36, 197, 160, 7, 149, 95, 96, 243, 188, 178, 75, 242, 32, 158, 203, 204, 181, 80, 196, 107, 101, 49, 89, 168, 7, 231, 211, 192, 201, 132, 153, 206, 153, 237, 214, 110, 81, 74, 200, 136, 178, 67, 212, 123, 180, 234, 183, 126, 170, 145, 219, 121, 3, 224, 246, 92, 232, 243, 176, 37, 95, 137, 249, 137, 73, 240, 113, 123, 84, 168, 2, 233, 251, 141, 19, 214, 124, 82, 219, 6, 75, 228, 97, 102, 72, 144, 84, 117, 250, 6, 97, 230, 2, 16, 204, 31, 159, 197, 153, 95, 107, 240, 31, 184, 58, 3, 239, 248, 191, 133, 1, 191, 199, 215, 55, 125, 234, 105, 151, 218, 50, 110, 35, 208, 129, 166, 151, 255, 3, 229, 23, 239, 241, 221, 53, 216, 155, 86, 140, 194, 115, 13, 255, 218, 122, 186, 2, 55, 125, 237, 151, 200, 119, 16, 13, 112, 130, 188, 151, 223, 152, 28, 20, 136, 119, 142, 8, 93, 55, 95, 203, 126, 47, 128, 230, 0, 121, 191, 177, 104, 65, 91, 32, 76, 71, 43, 79, 118, 98, 131, 91, 152, 132, 179, 161, 112, 184, 207, 44, 205, 145, 61, 233, 75, 133, 214, 226, 213, 144, 29, 4, 86, 94, 67, 139, 255, 93, 161, 23, 95, 140, 176, 165, 175, 108, 44, 163, 44, 125, 252, 229, 141, 181]; + let tee_sig = [11, 155, 78, 85, 105, 233, 219, 127, 241, 166, 154, 21, 185, 76, 67, 196, 13, 233, 94, 42, 83, 110, 93, 124, 132, 244, 5, 233, 254, 238, 160, 73, 24, 130, 215, 13, 120, 203, 172, 10, 186, 82, 142, 3, 51, 151, 242, 175, 14, 77, 93, 167, 181, 105, 32, 108, 16, 44, 185, 159, 53, 38, 102, 134, 81, 3, 57, 100, 32, 117, 35, 157, 78, 215, 88, 41, 201, 102, 63, 28, 190, 206, 116, 140, 101, 3, 136, 177, 201, 188, 32, 56, 195, 36, 217, 238, 111, 54, 119, 70, 199, 55, 183, 252, 210, 204, 33, 29, 88, 253, 15, 29, 194, 18, 93, 170, 144, 25, 66, 120, 210, 253, 203, 236, 74, 191, 234, 84, 130, 164, 22, 142, 251, 105, 178, 69, 80, 111, 115, 54, 71, 67, 48, 215, 5, 132, 234, 26, 207, 102, 18, 62, 185, 184, 78, 9, 159, 158, 180, 78, 78, 242, 219, 229, 234, 238, 211, 103, 158, 132, 62, 219, 34, 242, 32, 254, 104, 136, 114, 210, 180, 52, 17, 17, 0, 119, 35, 129, 25, 175, 99, 37, 55, 195, 159, 157, 120, 82, 6, 38, 47, 105, 111, 114, 51, 47, 170, 123, 196, 78, 98, 128, 220, 246, 159, 237, 101, 111, 213, 219, 5, 177, 76, 150, 22, 34, 82, 59, 70, 204, 219, 38, 78, 50, 179, 36, 93, 132, 84, 24, 69, 176, 93, 230, 11, 1, 140, 53, 108, 72, 107, 200, 238, 197, 28, 59]; }: _(RawOrigin::Signed(miner.clone()), space_proof_info, tee_sig) verify { let space = PendingReplacements::::get(&miner); diff --git a/c-pallets/file-bank/src/functions.rs b/c-pallets/file-bank/src/functions.rs index da4b0fba..ba84d6cc 100644 --- a/c-pallets/file-bank/src/functions.rs +++ b/c-pallets/file-bank/src/functions.rs @@ -229,9 +229,6 @@ impl Pallet { // Used to count the number of random selections. let mut cur_count = 0; let miner = loop { - // FOR TESTING - // log::info!("benchmark, total count = {:?}, max_count = {:?}, cur_count = {:?}", total, random_count_limit, cur_count); - if random_count_limit == cur_count { Err(Error::::NotQualified)?; } @@ -527,8 +524,6 @@ impl Pallet { let random_seed = match random_seed { Some(v) => v, None => { - // log::info!("Is None"); - #[cfg(feature = "runtime-benchmarks")] return Ok(seed); @@ -539,7 +534,6 @@ impl Pallet { if random_number != 0 { return Ok(random_number) } - log::info!("random number: {}", random_number); counter = counter.checked_add(1).ok_or(Error::::Overflow)?; } } diff --git a/c-pallets/file-bank/src/lib.rs b/c-pallets/file-bank/src/lib.rs index 28bbc824..b7fafd1a 100755 --- a/c-pallets/file-bank/src/lib.rs +++ b/c-pallets/file-bank/src/lib.rs @@ -485,7 +485,6 @@ pub mod pallet { if count < 20 { if let Err(e) = >::try_mutate(&deal_hash, |opt| -> DispatchResult { - log::info!("point 1"); let deal_info = opt.as_mut().ok_or(Error::::NonExistent)?; // unlock mienr space let mut needed_list: BoundedVec, T::FragmentCount> = Default::default(); @@ -496,9 +495,7 @@ pub mod pallet { } selected_miner.try_push(miner_task.miner.clone()).map_err(|_| Error::::Overflow)?; } - log::info!("point 2"); let mut miner_task_list = Self::reassign_miner(needed_list.clone(), selected_miner.clone())?.to_vec(); - log::info!("point 3"); for miner_task in &deal_info.assigned_miner.clone() { if !deal_info.complete_list.contains(&miner_task.miner) { deal_info.assigned_miner.retain(|temp_info| temp_info.miner != miner_task.miner); @@ -508,15 +505,13 @@ pub mod pallet { Self::add_task_failed_count(&miner_task.miner)?; } } - log::info!("point 4"); + deal_info.assigned_miner.try_append(&mut miner_task_list).map_err(|_| Error::::Overflow)?; deal_info.count = count; // count <= 20 - log::info!("point 5"); Self::start_first_task(deal_hash.0.to_vec(), deal_hash, count + 1, life)?; Ok(()) }) { - log::info!("point Err: {:?}", e); Self::remove_deal(&deal_hash)?; } } else { @@ -1115,7 +1110,7 @@ pub mod pallet { Ok(()) } - + #[pallet::call_index(20)] #[transactional] #[pallet::weight(10_000_000_000)] diff --git a/c-pallets/file-bank/src/weights_demo.rs b/c-pallets/file-bank/src/weights_demo.rs index f3f764af..b09c7f19 100644 --- a/c-pallets/file-bank/src/weights_demo.rs +++ b/c-pallets/file-bank/src/weights_demo.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_file_bank //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-21, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-28, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("cess-initial-testnet"), DB CACHE: 1024 // Executed Command: @@ -49,6 +49,19 @@ use sp_std::marker::PhantomData; /// Weight functions needed for pallet_file_bank. pub trait WeightInfo { + fn cert_idle_space() -> Weight; + fn upload_declaration(v: u32, ) -> Weight; + fn upload_declaration_expected_max(v: u32, ) -> Weight; + fn transfer_report(v: u32, ) -> Weight; + fn transfer_report_last(v: u32, ) -> Weight; + fn upload_declaration_fly_upload(v: u32, ) -> Weight; + fn deal_reassign_miner(v: u32, ) -> Weight; + fn deal_reassign_miner_exceed_limit(v: u32, ) -> Weight; + fn calculate_end(v: u32, ) -> Weight; + fn replace_idle_space() -> Weight; + fn delete_file(v: u32, ) -> Weight; + fn create_bucket() -> Weight; + fn delete_bucket() -> Weight; fn generate_restoral_order() -> Weight; fn claim_restoral_order() -> Weight; fn restoral_order_complete() -> Weight; @@ -58,17 +71,166 @@ pub trait WeightInfo { /// Weights for pallet_file_bank using the Substrate node and recommended hardware. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Sminer MinerItems (r:1 w:1) + // Storage: StorageHandler TotalIdleSpace (r:1 w:1) + fn cert_idle_space() -> Weight { + (1_526_565_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: FileBank File (r:1 w:0) + // Storage: Sminer AllMiner (r:1 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: FileBank TaskFailedCount (r:1 w:0) + // Storage: Sminer MinerItems (r:1 w:1) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: FileBank DealMap (r:0 w:1) + fn upload_declaration(v: u32, ) -> Weight { + (193_518_325 as Weight) + // Standard Error: 81_931 + .saturating_add((1_556_936 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(11 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: FileBank File (r:1 w:0) + // Storage: Sminer AllMiner (r:1 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: FileBank TaskFailedCount (r:15 w:0) + // Storage: Sminer MinerItems (r:15 w:2) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: FileBank DealMap (r:0 w:1) + fn upload_declaration_expected_max(v: u32, ) -> Weight { + (417_790_915 as Weight) + // Standard Error: 90_219 + .saturating_add((448_381 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(36 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + fn transfer_report(v: u32, ) -> Weight { + (72_203_328 as Weight) + // Standard Error: 26_036 + .saturating_add((798_142 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: FileBank PendingReplacements (r:3 w:3) + // Storage: FileBank TaskFailedCount (r:3 w:3) + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: StorageHandler TotalIdleSpace (r:1 w:1) + // Storage: StorageHandler TotalServiceSpace (r:1 w:1) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + // Storage: FileBank UserHoldFileList (r:1 w:1) + // Storage: FileBank File (r:0 w:1) + fn transfer_report_last(v: u32, ) -> Weight { + (183_457_174 as Weight) + // Standard Error: 73_260 + .saturating_add((4_738_236 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(16 as Weight)) + .saturating_add(T::DbWeight::get().writes(17 as Weight)) + } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: FileBank File (r:1 w:1) + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + // Storage: FileBank UserHoldFileList (r:1 w:1) + fn upload_declaration_fly_upload(v: u32, ) -> Weight { + (117_464_406 as Weight) + // Standard Error: 39_959 + .saturating_add((916_856 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: Sminer AllMiner (r:1 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: FileBank TaskFailedCount (r:18 w:3) + // Storage: Sminer MinerItems (r:18 w:6) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn deal_reassign_miner(v: u32, ) -> Weight { + (444_951_473 as Weight) + // Standard Error: 75_341 + .saturating_add((866_536 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(41 as Weight)) + .saturating_add(T::DbWeight::get().writes(12 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: Sminer MinerItems (r:3 w:3) + fn deal_reassign_miner_exceed_limit(v: u32, ) -> Weight { + (113_027_061 as Weight) + // Standard Error: 35_814 + .saturating_add((602_107 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: Sminer MinerItems (r:3 w:3) + // Storage: FileBank File (r:1 w:1) + fn calculate_end(v: u32, ) -> Weight { + (152_148_501 as Weight) + // Standard Error: 32_534 + .saturating_add((3_139_336 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Sminer MinerItems (r:1 w:1) + // Storage: FileBank PendingReplacements (r:1 w:1) + fn replace_idle_space() -> Weight { + (1_508_960_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: FileBank File (r:1 w:1) + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: StorageHandler TotalServiceSpace (r:1 w:1) + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserHoldFileList (r:1 w:1) + // Storage: Sminer RestoralTarget (r:3 w:0) + // Storage: Sminer MinerItems (r:3 w:3) + fn delete_file(v: u32, ) -> Weight { + (190_020_234 as Weight) + // Standard Error: 110_544 + .saturating_add((4_197_987 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(10 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) + } + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + fn create_bucket() -> Weight { + (45_647_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + fn delete_bucket() -> Weight { + (52_822_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } // Storage: FileBank RestoralOrder (r:1 w:1) // Storage: FileBank File (r:1 w:1) fn generate_restoral_order() -> Weight { - (97_296_000 as Weight) + (92_979_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Sminer MinerItems (r:1 w:0) // Storage: FileBank RestoralOrder (r:1 w:1) fn claim_restoral_order() -> Weight { - (74_032_000 as Weight) + (73_633_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -78,7 +240,7 @@ impl WeightInfo for SubstrateWeight { // Storage: FileBank PendingReplacements (r:1 w:1) // Storage: Sminer RestoralTarget (r:1 w:0) fn restoral_order_complete() -> Weight { - (195_002_000 as Weight) + (197_280_000 as Weight) .saturating_add(T::DbWeight::get().reads(6 as Weight)) .saturating_add(T::DbWeight::get().writes(5 as Weight)) } @@ -87,7 +249,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Sminer RestoralTarget (r:1 w:0) // Storage: FileBank File (r:1 w:1) fn claim_restoral_noexist_order() -> Weight { - (118_736_000 as Weight) + (118_929_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } @@ -95,17 +257,166 @@ impl WeightInfo for SubstrateWeight { // For backwards compatibility and tests impl WeightInfo for () { + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Sminer MinerItems (r:1 w:1) + // Storage: StorageHandler TotalIdleSpace (r:1 w:1) + fn cert_idle_space() -> Weight { + (1_526_565_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: FileBank File (r:1 w:0) + // Storage: Sminer AllMiner (r:1 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: FileBank TaskFailedCount (r:1 w:0) + // Storage: Sminer MinerItems (r:1 w:1) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: FileBank DealMap (r:0 w:1) + fn upload_declaration(v: u32, ) -> Weight { + (193_518_325 as Weight) + // Standard Error: 81_931 + .saturating_add((1_556_936 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(11 as Weight)) + .saturating_add(RocksDbWeight::get().writes(7 as Weight)) + } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: FileBank File (r:1 w:0) + // Storage: Sminer AllMiner (r:1 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: FileBank TaskFailedCount (r:15 w:0) + // Storage: Sminer MinerItems (r:15 w:2) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + // Storage: FileBank DealMap (r:0 w:1) + fn upload_declaration_expected_max(v: u32, ) -> Weight { + (417_790_915 as Weight) + // Standard Error: 90_219 + .saturating_add((448_381 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(36 as Weight)) + .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + fn transfer_report(v: u32, ) -> Weight { + (72_203_328 as Weight) + // Standard Error: 26_036 + .saturating_add((798_142 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: FileBank PendingReplacements (r:3 w:3) + // Storage: FileBank TaskFailedCount (r:3 w:3) + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: StorageHandler TotalIdleSpace (r:1 w:1) + // Storage: StorageHandler TotalServiceSpace (r:1 w:1) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:2 w:2) + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + // Storage: FileBank UserHoldFileList (r:1 w:1) + // Storage: FileBank File (r:0 w:1) + fn transfer_report_last(v: u32, ) -> Weight { + (183_457_174 as Weight) + // Standard Error: 73_260 + .saturating_add((4_738_236 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(16 as Weight)) + .saturating_add(RocksDbWeight::get().writes(17 as Weight)) + } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: FileBank File (r:1 w:1) + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + // Storage: FileBank UserHoldFileList (r:1 w:1) + fn upload_declaration_fly_upload(v: u32, ) -> Weight { + (117_464_406 as Weight) + // Standard Error: 39_959 + .saturating_add((916_856 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: Sminer AllMiner (r:1 w:0) + // Storage: Babe AuthorVrfRandomness (r:1 w:0) + // Storage: FileBank TaskFailedCount (r:18 w:3) + // Storage: Sminer MinerItems (r:18 w:6) + // Storage: Scheduler Lookup (r:1 w:1) + // Storage: Scheduler Agenda (r:1 w:1) + fn deal_reassign_miner(v: u32, ) -> Weight { + (444_951_473 as Weight) + // Standard Error: 75_341 + .saturating_add((866_536 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(41 as Weight)) + .saturating_add(RocksDbWeight::get().writes(12 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: Sminer MinerItems (r:3 w:3) + fn deal_reassign_miner_exceed_limit(v: u32, ) -> Weight { + (113_027_061 as Weight) + // Standard Error: 35_814 + .saturating_add((602_107 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + } + // Storage: FileBank DealMap (r:1 w:1) + // Storage: Sminer MinerItems (r:3 w:3) + // Storage: FileBank File (r:1 w:1) + fn calculate_end(v: u32, ) -> Weight { + (152_148_501 as Weight) + // Standard Error: 32_534 + .saturating_add((3_139_336 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + } + // Storage: TeeWorker TeePodr2Pk (r:1 w:0) + // Storage: Sminer MinerItems (r:1 w:1) + // Storage: FileBank PendingReplacements (r:1 w:1) + fn replace_idle_space() -> Weight { + (1_508_960_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + // Storage: FileBank File (r:1 w:1) + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: StorageHandler TotalServiceSpace (r:1 w:1) + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserHoldFileList (r:1 w:1) + // Storage: Sminer RestoralTarget (r:3 w:0) + // Storage: Sminer MinerItems (r:3 w:3) + fn delete_file(v: u32, ) -> Weight { + (190_020_234 as Weight) + // Standard Error: 110_544 + .saturating_add((4_197_987 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(10 as Weight)) + .saturating_add(RocksDbWeight::get().writes(8 as Weight)) + } + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + fn create_bucket() -> Weight { + (45_647_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + // Storage: FileBank Bucket (r:1 w:1) + // Storage: FileBank UserBucketList (r:1 w:1) + fn delete_bucket() -> Weight { + (52_822_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } // Storage: FileBank RestoralOrder (r:1 w:1) // Storage: FileBank File (r:1 w:1) fn generate_restoral_order() -> Weight { - (97_296_000 as Weight) + (92_979_000 as Weight) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Sminer MinerItems (r:1 w:0) // Storage: FileBank RestoralOrder (r:1 w:1) fn claim_restoral_order() -> Weight { - (74_032_000 as Weight) + (73_633_000 as Weight) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -115,7 +426,7 @@ impl WeightInfo for () { // Storage: FileBank PendingReplacements (r:1 w:1) // Storage: Sminer RestoralTarget (r:1 w:0) fn restoral_order_complete() -> Weight { - (195_002_000 as Weight) + (197_280_000 as Weight) .saturating_add(RocksDbWeight::get().reads(6 as Weight)) .saturating_add(RocksDbWeight::get().writes(5 as Weight)) } @@ -124,7 +435,7 @@ impl WeightInfo for () { // Storage: Sminer RestoralTarget (r:1 w:0) // Storage: FileBank File (r:1 w:1) fn claim_restoral_noexist_order() -> Weight { - (118_736_000 as Weight) + (118_929_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } diff --git a/c-pallets/oss/src/benchmarking.rs b/c-pallets/oss/src/benchmarking.rs index d5789002..083be4a6 100644 --- a/c-pallets/oss/src/benchmarking.rs +++ b/c-pallets/oss/src/benchmarking.rs @@ -1,59 +1,62 @@ -// use crate::{Pallet as OssPallet, *}; -// use frame_benchmarking::{ -// account, benchmarks, impl_benchmark_test_suite, whitelist_account, whitelisted_caller, -// }; -// use frame_support::dispatch::RawOrigin; +use crate::{Pallet as OssPallet, *}; +use frame_benchmarking::{ + account, benchmarks, impl_benchmark_test_suite, whitelist_account, whitelisted_caller, +}; +use frame_support::dispatch::RawOrigin; -// const SEED: u32 = 2190502; +const SEED: u32 = 2190502; -// benchmarks! { -// authorize { -// let owner: AccountOf = account("owner", 100, SEED); -// let operator: AccountOf = account("operator", 100, SEED); -// }: _(RawOrigin::Signed(owner.clone()), operator.clone()) -// verify { -// assert!(>::contains_key(&owner)); -// let acc = >::get(&owner).unwrap(); -// assert_eq!(acc, operator); -// } +benchmarks! { + authorize { + let owner: AccountOf = account("owner", 100, SEED); + let operator: AccountOf = account("operator", 100, SEED); + }: _(RawOrigin::Signed(owner.clone()), operator.clone()) + verify { + assert!(>::contains_key(&owner)); + let acc_list = >::get(&owner); + assert!(acc_list.contains(&operator)); + } -// cancel_authorize { -// let owner: AccountOf = account("owner", 100, SEED); -// let operator: AccountOf = account("operator", 100, SEED); -// >::insert(&owner, operator.clone()); -// }: _(RawOrigin::Signed(owner.clone())) -// verify { -// assert!(!>::contains_key(&owner)); -// } + cancel_authorize { + let owner: AccountOf = account("owner", 100, SEED); + let operator: AccountOf = account("operator", 100, SEED); + let mut operator_list: BoundedVec, T::AuthorLimit> = Default::default(); + operator_list.try_push(operator.clone()).unwrap(); + >::insert(&owner, operator_list); + }: _(RawOrigin::Signed(owner.clone()), operator.clone()) + verify { + let operator_list = >::get(&owner); + assert!(!operator_list.contains(&operator)); + } -// register { -// let oss: AccountOf = account("oss", 100, SEED); -// let ip: IpAddress = IpAddress::IPV4([127,0,0,1], 15000); -// }: _(RawOrigin::Signed(oss.clone()), ip.clone()) -// verify { -// assert!(>::contains_key(&oss)); -// let oss_ip = >::get(&oss).unwrap(); -// assert_eq!(ip, oss_ip); -// } + register { + let oss: AccountOf = account("oss", 100, SEED); + let peer_id = [5u8; 38]; + }: _(RawOrigin::Signed(oss.clone()), peer_id.clone()) + verify { + assert!(>::contains_key(&oss)); + let oss_ip = >::get(&oss).unwrap(); + assert_eq!(oss_ip, peer_id); + } -// update { -// let oss: AccountOf = account("oss", 100, SEED); -// let ip: IpAddress = IpAddress::IPV4([127,0,0,1], 15000); -// >::insert(&oss, ip); -// let new_ip: IpAddress = IpAddress::IPV4([127,0,0,1], 15001); -// }: _(RawOrigin::Signed(oss.clone()), new_ip.clone()) -// verify { -// assert!(>::contains_key(&oss)); -// let oss_ip = >::get(&oss).unwrap(); -// assert_eq!(new_ip, oss_ip); -// } + update { + let oss: AccountOf = account("oss", 100, SEED); + let peer_id = [5u8; 38]; + >::insert(&oss, peer_id); + let new_peer_id = [6u8; 38]; + }: _(RawOrigin::Signed(oss.clone()), new_peer_id.clone()) + verify { + assert!(>::contains_key(&oss)); + let oss_peer_id = >::get(&oss).unwrap(); + assert_eq!(new_peer_id, oss_peer_id); + } -// destroy { -// let oss: AccountOf = account("oss", 100, SEED); -// let ip: IpAddress = IpAddress::IPV4([127,0,0,1], 15000); -// >::insert(&oss, ip.clone()); -// }: _(RawOrigin::Signed(oss.clone())) -// verify { -// assert!(!>::contains_key(&oss)); -// } -// } + destroy { + let oss: AccountOf = account("oss", 100, SEED); + let peer_id = [5u8; 38]; + >::insert(&oss, peer_id.clone()); + }: _(RawOrigin::Signed(oss.clone())) + verify { + assert!(!>::contains_key(&oss)); + } +} diff --git a/c-pallets/oss/src/weights_demo.rs b/c-pallets/oss/src/weights_demo.rs new file mode 100644 index 00000000..4c2c75e6 --- /dev/null +++ b/c-pallets/oss/src/weights_demo.rs @@ -0,0 +1,126 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_oss +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-08-29, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("cess-initial-testnet"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/cess-node +// benchmark +// pallet +// --chain +// cess-initial-testnet +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// pallet_oss +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=./.maintain/frame-weight-template.hbs +// --output=./c-pallets/oss/src/weights_demo.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_oss. +pub trait WeightInfo { + fn authorize() -> Weight; + fn cancel_authorize() -> Weight; + fn register() -> Weight; + fn update() -> Weight; + fn destroy() -> Weight; +} + +/// Weights for pallet_oss using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + // Storage: Oss AuthorityList (r:1 w:1) + fn authorize() -> Weight { + (50_169_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Oss AuthorityList (r:1 w:1) + fn cancel_authorize() -> Weight { + (66_539_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Oss Oss (r:1 w:1) + fn register() -> Weight { + (57_477_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Oss Oss (r:1 w:1) + fn update() -> Weight { + (63_189_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: Oss Oss (r:1 w:1) + fn destroy() -> Weight { + (37_122_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + // Storage: Oss AuthorityList (r:1 w:1) + fn authorize() -> Weight { + (50_169_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: Oss AuthorityList (r:1 w:1) + fn cancel_authorize() -> Weight { + (66_539_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: Oss Oss (r:1 w:1) + fn register() -> Weight { + (57_477_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: Oss Oss (r:1 w:1) + fn update() -> Weight { + (63_189_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: Oss Oss (r:1 w:1) + fn destroy() -> Weight { + (37_122_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } +} \ No newline at end of file diff --git a/c-pallets/sminer/src/benchmarking.rs b/c-pallets/sminer/src/benchmarking.rs index ca293a34..79899899 100644 --- a/c-pallets/sminer/src/benchmarking.rs +++ b/c-pallets/sminer/src/benchmarking.rs @@ -21,6 +21,23 @@ pub trait Config: } // const MAX_SPANS: u32 = 100; +pub fn increase_reward(b_reward: u128) -> Result<(), &'static str> { + let acc = T::FaucetId::get().into_account_truncating(); + + ::Currency::make_free_balance_be( + &acc, + BalanceOf::::max_value(), + ); + + let b_reward: BalanceOf = b_reward.try_into().map_err(|_| "convert error")?; + + >::mutate(|reward| { + *reward = *reward + b_reward; + }); + + Ok(()) +} + pub fn add_miner(name: &'static str) -> Result { // let _ = pallet_tee_worker::benchmarking::tee_register::()?; @@ -135,9 +152,8 @@ benchmarks! { let encoding = space_proof_info.encode(); let hashing = sp_io::hashing::sha2_256(&encoding); - log::info!("register hashing: {:?}", hashing); - let sig: TeeRsaSignature = [27, 227, 6, 81, 243, 202, 129, 247, 142, 47, 147, 80, 173, 149, 139, 98, 89, 161, 88, 135, 198, 87, 212, 162, 210, 161, 33, 2, 239, 67, 206, 191, 180, 207, 235, 88, 16, 164, 232, 152, 182, 57, 3, 196, 1, 139, 194, 146, 241, 51, 102, 165, 50, 11, 240, 234, 75, 211, 130, 105, 42, 204, 17, 108, 254, 137, 58, 70, 2, 46, 93, 109, 216, 145, 120, 151, 29, 214, 182, 132, 96, 144, 63, 127, 124, 182, 255, 231, 211, 40, 220, 202, 53, 207, 214, 183, 214, 226, 242, 170, 27, 169, 218, 24, 171, 199, 192, 240, 15, 155, 46, 64, 205, 101, 212, 62, 212, 92, 65, 170, 174, 76, 50, 119, 125, 239, 134, 23, 11, 126, 41, 7, 29, 39, 216, 122, 103, 167, 97, 29, 196, 196, 181, 122, 202, 252, 98, 169, 151, 29, 188, 21, 55, 15, 238, 211, 250, 195, 51, 205, 82, 205, 110, 159, 126, 215, 107, 159, 9, 201, 110, 224, 156, 125, 250, 187, 144, 23, 22, 129, 217, 98, 91, 122, 8, 45, 251, 19, 152, 161, 94, 140, 17, 250, 63, 34, 85, 113, 205, 179, 55, 79, 39, 147, 200, 187, 125, 25, 153, 187, 184, 194, 216, 217, 130, 160, 99, 164, 118, 53, 146, 215, 239, 53, 81, 128, 35, 161, 73, 241, 250, 101, 212, 89, 224, 15, 220, 35, 191, 61, 114, 172, 238, 244, 184, 116, 185, 40, 249, 8, 99, 24, 98, 48, 126, 133]; + let sig: TeeRsaSignature = [151, 66, 19, 21, 197, 133, 110, 137, 144, 124, 158, 44, 178, 8, 38, 111, 87, 41, 21, 178, 205, 70, 94, 130, 231, 130, 118, 228, 46, 78, 165, 31, 64, 57, 105, 18, 58, 250, 170, 246, 57, 207, 14, 180, 87, 160, 68, 157, 214, 37, 103, 187, 77, 6, 41, 167, 35, 93, 134, 89, 78, 140, 196, 174, 132, 177, 75, 212, 135, 115, 79, 251, 125, 150, 226, 163, 129, 104, 74, 39, 231, 117, 87, 162, 10, 61, 189, 165, 160, 190, 111, 66, 178, 31, 11, 201, 67, 119, 99, 125, 84, 181, 25, 141, 38, 241, 180, 95, 104, 94, 46, 30, 233, 99, 73, 97, 77, 101, 226, 70, 74, 83, 233, 102, 136, 208, 142, 109, 220, 122, 95, 9, 212, 34, 227, 248, 58, 138, 24, 159, 56, 201, 46, 106, 240, 49, 172, 193, 211, 25, 108, 238, 250, 202, 79, 44, 149, 27, 231, 106, 148, 135, 245, 157, 3, 69, 196, 11, 151, 129, 136, 216, 248, 146, 119, 83, 209, 107, 196, 252, 140, 18, 123, 198, 173, 25, 18, 234, 47, 151, 133, 179, 242, 179, 10, 111, 185, 72, 247, 96, 152, 120, 19, 213, 77, 52, 149, 120, 90, 34, 22, 8, 36, 63, 74, 114, 128, 119, 254, 19, 71, 163, 21, 41, 115, 226, 52, 107, 156, 75, 6, 229, 85, 26, 84, 0, 186, 234, 94, 229, 240, 14, 3, 49, 219, 130, 160, 238, 133, 197, 17, 13, 108, 31, 135, 107]; }: _(RawOrigin::Signed(caller.clone()), caller.clone(), peer_id, 2_000u32.into(), pois_key, sig) verify { assert!(>::contains_key(&caller)) diff --git a/c-pallets/sminer/src/weights_demo.rs b/c-pallets/sminer/src/weights_demo.rs index fa6fbb5d..2cf1b05b 100644 --- a/c-pallets/sminer/src/weights_demo.rs +++ b/c-pallets/sminer/src/weights_demo.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_sminer //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-18, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-28, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("cess-initial-devnet"), DB CACHE: 1024 // Executed Command: @@ -70,32 +70,32 @@ impl WeightInfo for SubstrateWeight { // Storage: Sminer RewardMap (r:0 w:1) // Storage: Sminer MinerPublicKey (r:0 w:1) fn regnstk() -> Weight { - (1_590_845_000 as Weight) + (1_692_205_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } // Storage: Sminer MinerItems (r:1 w:1) // Storage: System Account (r:1 w:1) fn increase_collateral() -> Weight { - (76_783_000 as Weight) + (78_646_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: Sminer MinerItems (r:1 w:1) fn update_beneficiary() -> Weight { - (60_823_000 as Weight) + (62_968_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: Sminer MinerItems (r:1 w:1) fn update_peer_id() -> Weight { - (57_107_000 as Weight) + (62_354_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 faucet_top_up() -> Weight { - (74_479_000 as Weight) + (76_437_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -104,7 +104,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) fn miner_exit_prep() -> Weight { - (77_330_000 as Weight) + (79_163_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } @@ -115,7 +115,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Sminer AllMiner (r:1 w:1) // Storage: Sminer RestoralTarget (r:0 w:1) fn miner_exit() -> Weight { - (71_580_000 as Weight) + (73_918_000 as Weight) .saturating_add(T::DbWeight::get().reads(5 as Weight)) .saturating_add(T::DbWeight::get().writes(6 as Weight)) } @@ -125,7 +125,7 @@ impl WeightInfo for SubstrateWeight { // Storage: Sminer CounterForMinerItems (r:1 w:1) // Storage: Sminer MinerPublicKey (r:0 w:1) fn miner_withdraw() -> Weight { - (85_722_000 as Weight) + (86_556_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } @@ -141,32 +141,32 @@ impl WeightInfo for () { // Storage: Sminer RewardMap (r:0 w:1) // Storage: Sminer MinerPublicKey (r:0 w:1) fn regnstk() -> Weight { - (1_590_845_000 as Weight) + (1_692_205_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(6 as Weight)) } // Storage: Sminer MinerItems (r:1 w:1) // Storage: System Account (r:1 w:1) fn increase_collateral() -> Weight { - (76_783_000 as Weight) + (78_646_000 as Weight) .saturating_add(RocksDbWeight::get().reads(2 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } // Storage: Sminer MinerItems (r:1 w:1) fn update_beneficiary() -> Weight { - (60_823_000 as Weight) + (62_968_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: Sminer MinerItems (r:1 w:1) fn update_peer_id() -> Weight { - (57_107_000 as Weight) + (62_354_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } // Storage: System Account (r:1 w:1) fn faucet_top_up() -> Weight { - (74_479_000 as Weight) + (76_437_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } @@ -175,7 +175,7 @@ impl WeightInfo for () { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) fn miner_exit_prep() -> Weight { - (77_330_000 as Weight) + (79_163_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } @@ -186,7 +186,7 @@ impl WeightInfo for () { // Storage: Sminer AllMiner (r:1 w:1) // Storage: Sminer RestoralTarget (r:0 w:1) fn miner_exit() -> Weight { - (71_580_000 as Weight) + (73_918_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(6 as Weight)) } @@ -196,7 +196,7 @@ impl WeightInfo for () { // Storage: Sminer CounterForMinerItems (r:1 w:1) // Storage: Sminer MinerPublicKey (r:0 w:1) fn miner_withdraw() -> Weight { - (85_722_000 as Weight) + (86_556_000 as Weight) .saturating_add(RocksDbWeight::get().reads(4 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } diff --git a/c-pallets/storage-handler/src/weights_demo.rs b/c-pallets/storage-handler/src/weights_demo.rs index f30cddfa..095afd2e 100644 --- a/c-pallets/storage-handler/src/weights_demo.rs +++ b/c-pallets/storage-handler/src/weights_demo.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_storage_handler //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-24, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("cess-initial-devnet"), DB CACHE: 1024 // Executed Command: @@ -51,6 +51,7 @@ use sp_std::marker::PhantomData; pub trait WeightInfo { fn buy_space() -> Weight; fn expansion_space() -> Weight; + fn renewal_space() -> Weight; } /// Weights for pallet_storage_handler using the Substrate node and recommended hardware. @@ -63,7 +64,7 @@ impl WeightInfo for SubstrateWeight { // Storage: StorageHandler TotalServiceSpace (r:1 w:0) // Storage: System Account (r:2 w:2) fn buy_space() -> Weight { - (92_448_000 as Weight) + (92_002_000 as Weight) .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } @@ -74,10 +75,18 @@ impl WeightInfo for SubstrateWeight { // Storage: StorageHandler TotalIdleSpace (r:1 w:0) // Storage: StorageHandler TotalServiceSpace (r:1 w:0) fn expansion_space() -> Weight { - (87_154_000 as Weight) + (101_652_000 as Weight) .saturating_add(T::DbWeight::get().reads(7 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: StorageHandler UnitPrice (r:1 w:0) + // Storage: System Account (r:2 w:2) + fn renewal_space() -> Weight { + (76_537_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } } // For backwards compatibility and tests @@ -89,7 +98,7 @@ impl WeightInfo for () { // Storage: StorageHandler TotalServiceSpace (r:1 w:0) // Storage: System Account (r:2 w:2) fn buy_space() -> Weight { - (92_448_000 as Weight) + (92_002_000 as Weight) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } @@ -100,8 +109,16 @@ impl WeightInfo for () { // Storage: StorageHandler TotalIdleSpace (r:1 w:0) // Storage: StorageHandler TotalServiceSpace (r:1 w:0) fn expansion_space() -> Weight { - (87_154_000 as Weight) + (101_652_000 as Weight) .saturating_add(RocksDbWeight::get().reads(7 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } + // Storage: StorageHandler UserOwnedSpace (r:1 w:1) + // Storage: StorageHandler UnitPrice (r:1 w:0) + // Storage: System Account (r:2 w:2) + fn renewal_space() -> Weight { + (76_537_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } } \ No newline at end of file diff --git a/c-pallets/tee-worker/src/benchmarking.rs b/c-pallets/tee-worker/src/benchmarking.rs index 9b48542d..caa4deb3 100644 --- a/c-pallets/tee-worker/src/benchmarking.rs +++ b/c-pallets/tee-worker/src/benchmarking.rs @@ -16,15 +16,15 @@ pub trait Config: } const USER_SEED: u32 = 999666; -const PODR2_PBK: [u8; 270] = [48, 130, 1, 10, 2, 130, 1, 1, 0, 232, 164, 71, 61, 156, 19, 143, 219, 24, 119, 196, 115, 203, 33, 130, 151, 75, 193, 108, 45, 181, 28, 191, 217, 102, 16, 251, 69, 156, 138, 34, 69, 68, 239, 167, 157, 121, 34, 146, 221, 122, 71, 183, 180, 190, 53, 5, 94, 154, 224, 178, 215, 143, 210, 96, 209, 51, 13, 153, 186, 209, 42, 30, 184, 117, 100, 112, 165, 234, 132, 48, 11, 137, 160, 143, 171, 209, 37, 93, 58, 237, 199, 4, 65, 231, 156, 171, 238, 184, 196, 182, 185, 5, 15, 216, 174, 194, 238, 247, 101, 25, 167, 108, 61, 236, 131, 208, 221, 104, 49, 198, 233, 98, 40, 30, 35, 0, 99, 93, 169, 190, 225, 76, 106, 55, 179, 135, 252, 71, 124, 215, 70, 189, 104, 167, 157, 31, 169, 7, 65, 147, 103, 47, 238, 62, 44, 136, 49, 31, 68, 176, 103, 77, 230, 83, 205, 162, 237, 154, 196, 193, 246, 79, 40, 206, 156, 87, 70, 178, 11, 64, 59, 174, 248, 210, 233, 140, 144, 93, 197, 115, 32, 133, 44, 157, 125, 226, 159, 221, 4, 19, 26, 247, 234, 54, 49, 216, 114, 142, 130, 13, 163, 250, 178, 72, 32, 187, 175, 59, 189, 53, 174, 19, 252, 169, 83, 235, 175, 38, 76, 241, 124, 131, 86, 46, 38, 87, 119, 45, 101, 51, 6, 133, 36, 178, 123, 212, 137, 57, 14, 110, 20, 164, 219, 79, 134, 82, 98, 213, 246, 115, 68, 119, 104, 157, 209, 2, 3, 1, 0, 1]; - -const NODE_PUBLIC_KEY: NodePublicKey = sp_core::ed25519::Public([0u8; 32]); +const PODR2_PBK: [u8; 270] = [48, 130, 1, 10, 2, 130, 1, 1, 0, 151, 247, 38, 216, 188, 81, 0, 64, 239, 101, 82, 181, 134, 30, 84, 171, 120, 21, 39, 196, 216, 82, 17, 10, 225, 78, 91, 35, 182, 8, 50, 1, 164, 235, 206, 201, 233, 223, 174, 125, 138, 51, 70, 14, 20, 198, 52, 199, 9, 142, 65, 183, 251, 134, 22, 114, 242, 205, 169, 28, 115, 213, 82, 82, 170, 63, 57, 24, 59, 136, 162, 231, 123, 234, 187, 175, 244, 95, 232, 254, 130, 17, 46, 163, 201, 93, 244, 240, 179, 30, 43, 221, 67, 226, 161, 22, 53, 161, 77, 221, 124, 48, 21, 62, 181, 108, 63, 10, 7, 160, 92, 170, 151, 111, 51, 112, 0, 183, 168, 219, 78, 105, 29, 47, 84, 34, 159, 17, 118, 194, 115, 4, 208, 110, 56, 76, 22, 202, 200, 104, 210, 97, 102, 183, 86, 63, 108, 50, 179, 21, 236, 147, 57, 142, 76, 67, 243, 235, 162, 202, 147, 163, 148, 237, 7, 229, 122, 250, 75, 249, 99, 242, 157, 34, 136, 175, 74, 140, 73, 145, 9, 131, 56, 88, 249, 175, 17, 26, 93, 72, 15, 50, 85, 230, 91, 124, 235, 26, 104, 200, 161, 160, 137, 249, 3, 49, 7, 119, 207, 100, 127, 108, 215, 251, 214, 228, 180, 221, 223, 12, 163, 66, 214, 185, 100, 84, 65, 6, 71, 240, 45, 247, 107, 193, 238, 68, 67, 92, 161, 223, 1, 43, 150, 137, 218, 221, 213, 232, 36, 5, 121, 32, 59, 129, 75, 5, 2, 3, 1, 0, 1]; +const PEER_ID: [u8; 38] = [0, 36, 8, 1, 18, 32, 12, 50, 93, 198, 152, 25, 126, 164, 106, 27, 26, 219, 151, 207, 191, 72, 133, 39, 20, 109, 117, 187, 165, 127, 101, 12, 167, 175, 255, 138, 213, 34]; +const NODE_PUBLIC_KEY: NodePublicKey = sp_core::ed25519::Public([12, 50, 93, 198, 152, 25, 126, 164, 106, 27, 26, 219, 151, 207, 191, 72, 133, 39, 20, 109, 117, 187, 165, 127, 101, 12, 167, 175, 255, 138, 213, 34]); pub fn get_report() -> SgxAttestationReport { SgxAttestationReport { - report_json_raw: "{\"id\":\"184395600112234849453795347768280755165\",\"timestamp\":\"2023-04-14T02:09:47.119891\",\"version\":4,\"epidPseudonym\":\"7+Jpi5RSDua6q1rmZHMpKdtPhfgoQj+74Ujo11SCqvYk/U1/s08H2mCekn5wkR/5rG7B1zrhJ1kyveR/kHxb/Dwu0jk79okEkT5vCIb0z2UXL2qcCmgU6faXkeuO2j6RqVjP/sxud0xUdZRfLQgh6RdCPbphnQGYitMV38G1MMA=\",\"advisoryURL\":\"https://security-center.intel.com\",\"advisoryIDs\":[\"INTEL-SA-00161\",\"INTEL-SA-00219\",\"INTEL-SA-00289\",\"INTEL-SA-00334\",\"INTEL-SA-00614\",\"INTEL-SA-00615\",\"INTEL-SA-00617\"],\"isvEnclaveQuoteStatus\":\"GROUP_OUT_OF_DATE\",\"platformInfoBlob\":\"150200650400090000131302040180070000000000000000000D00000C000000020000000000000C14356D7E6BD49FCE309AAC5007C3460F25CFD98D34DB2AD00836B4BCEF207509ADB761A9C3387BE53F6CAD756FE3024B91699F19D452294DEFC724873FAA232BF8\",\"isvEnclaveQuoteBody\":\"AgABABQMAAANAA0AAAAAAB6Xh0EMRY+We+07AgcxosUAAAAAAAAAAAAAAAAAAAAAERMCBv+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAAPQprxuAacfFpkMnlSNkZWrjSB7QpI7Bi9y7NYu6P3AmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJaXDwjRmUJaezDwOBzT4u9xntaxv/9C345MfmeBnIpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwKjAFBgMrZXADIQA6A6w8225D6fhgT3+5qpgxlYooSXnulLDOxPJcFiMr3AAAAAAAAAAAAAAAAAAAAAAAAAAA\"}".as_bytes().to_vec().try_into().unwrap(), - sign: "STJ5RTIyg/NLcFN0528CGqQ08GfIu/czhUS1EJ1+gZhEqzEn9deC/j4nELvoCUiEZ2Xk5DSZ6eRIw9UYyWf5VUNFP95gHgpgz+/Ly35830fh3kjQGB078io43L8Cg3T/Y8e1yXV4MbFKGeLGRhR4ETAvVPfR+kVwapDvQAZ6AX+RcOfJVSsd16DYzIzlZLviq77soWVEW1n2Sqaf2zYXjasuW4YlLwbwKfQT7aZLAP8HWkpGaj7j9GnRlj3tiNZs7nZs7mE7voir+3bHGg/BDsxE0MPbMrZdqyiwejTjgyn4eNdjzYgD2ngYMVZnBJxJ3akxfVTnKDwn4rUeaxnh0g==".as_bytes().to_vec().try_into().unwrap(), - cert_der: "MIIEoTCCAwmgAwIBAgIJANEHdl0yo7CWMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEUMBIGA1UEBwwLU2FudGEgQ2xhcmExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMTAwLgYDVQQDDCdJbnRlbCBTR1ggQXR0ZXN0YXRpb24gUmVwb3J0IFNpZ25pbmcgQ0EwHhcNMTYxMTIyMDkzNjU4WhcNMjYxMTIwMDkzNjU4WjB7MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1NhbnRhIENsYXJhMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEtMCsGA1UEAwwkSW50ZWwgU0dYIEF0dGVzdGF0aW9uIFJlcG9ydCBTaWduaW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqXot4OZuphR8nudFrAFiaGxxkgma/Es/BA+tbeCTUR106AL1ENcWA4FX3K+E9BBL0/7X5rj5nIgX/R/1ubhkKWw9gfqPG3KeAtIdcv/uTO1yXv50vqaPvE1CRChvzdS/ZEBqQ5oVvLTPZ3VEicQjlytKgN9cLnxbwtuvLUK7eyRPfJW/ksddOzP8VBBniolYnRCD2jrMRZ8nBM2ZWYwnXnwYeOAHV+W9tOhAImwRwKF/95yAsVwd21ryHMJBcGH70qLagZ7Ttyt++qO/6+KAXJuKwZqjRlEtSEz8gZQeFfVYgcwSfo96oSMAzVr7V0L6HSDLRnpb6xxmbPdqNol4tQIDAQABo4GkMIGhMB8GA1UdIwQYMBaAFHhDe3amfrzQr35CN+s1fDuHAVE8MA4GA1UdDwEB/wQEAwIGwDAMBgNVHRMBAf8EAjAAMGAGA1UdHwRZMFcwVaBToFGGT2h0dHA6Ly90cnVzdGVkc2VydmljZXMuaW50ZWwuY29tL2NvbnRlbnQvQ1JML1NHWC9BdHRlc3RhdGlvblJlcG9ydFNpZ25pbmdDQS5jcmwwDQYJKoZIhvcNAQELBQADggGBAGcIthtcK9IVRz4rRq+ZKE+7k50/OxUsmW8aavOzKb0iCx07YQ9rzi5nU73tME2yGRLzhSViFs/LpFa9lpQL6JL1aQwmDR74TxYGBAIi5f4I5TJoCCEqRHz91kpG6Uvyn2tLmnIdJbPE4vYvWLrtXXfFBSSPD4Afn7+3/XUggAlc7oCTizOfbbtOFlYA4g5KcYgS1J2ZAeMQqbUdZseZCcaZZZn65tdqee8UXZlDvx0+NdO0LR+5pFy+juM0wWbu59MvzcmTXbjsi7HY6zd53Yq5K244fwFHRQ8eOB0IWB+4PfM7FeAApZvlfqlKOlLcZL2uyVmzRkyR5yW72uo9mehX44CiPJ2fse9Y6eQtcfEhMPkmHXI01sN+KwPbpA39+xOsStjhP9N1Y1a2tQAVo+yVgLgV2Hws73Fc0o3wC78qPEA+v2aRs/Be3ZFDgDyghc/1fgU+7C+P6kbqd4poyb6IW8KCJbxfMJvkordNOgOUUxndPHEi/tb/U7uLjLOgPA==".as_bytes().to_vec().try_into().unwrap(), + report_json_raw: [123, 34, 105, 100, 34, 58, 34, 49, 52, 53, 48, 49, 48, 48, 56, 52, 50, 57, 55, 53, 48, 51, 56, 53, 56, 57, 54, 54, 52, 56, 56, 57, 56, 49, 53, 53, 52, 52, 51, 53, 56, 48, 48, 55, 53, 56, 34, 44, 34, 116, 105, 109, 101, 115, 116, 97, 109, 112, 34, 58, 34, 50, 48, 50, 51, 45, 48, 56, 45, 50, 54, 84, 48, 50, 58, 48, 56, 58, 52, 51, 46, 53, 51, 52, 57, 53, 55, 34, 44, 34, 118, 101, 114, 115, 105, 111, 110, 34, 58, 52, 44, 34, 101, 112, 105, 100, 80, 115, 101, 117, 100, 111, 110, 121, 109, 34, 58, 34, 55, 43, 74, 112, 105, 53, 82, 83, 68, 117, 97, 54, 113, 49, 114, 109, 90, 72, 77, 112, 75, 100, 116, 80, 104, 102, 103, 111, 81, 106, 43, 55, 52, 85, 106, 111, 49, 49, 83, 67, 113, 118, 89, 107, 47, 85, 49, 47, 115, 48, 56, 72, 50, 109, 67, 101, 107, 110, 53, 119, 107, 82, 47, 53, 114, 71, 55, 66, 49, 122, 114, 104, 74, 49, 107, 121, 118, 101, 82, 47, 107, 72, 120, 98, 47, 71, 109, 75, 71, 51, 84, 99, 52, 83, 86, 74, 110, 78, 55, 75, 43, 47, 97, 48, 80, 110, 54, 121, 43, 106, 66, 75, 104, 106, 52, 79, 74, 101, 109, 102, 88, 75, 84, 104, 109, 49, 104, 89, 122, 52, 76, 65, 113, 53, 120, 69, 83, 82, 121, 68, 76, 89, 111, 71, 82, 89, 47, 57, 48, 118, 103, 97, 65, 89, 90, 109, 104, 53, 111, 85, 111, 48, 65, 98, 98, 111, 49, 99, 65, 102, 119, 61, 34, 44, 34, 97, 100, 118, 105, 115, 111, 114, 121, 85, 82, 76, 34, 58, 34, 104, 116, 116, 112, 115, 58, 47, 47, 115, 101, 99, 117, 114, 105, 116, 121, 45, 99, 101, 110, 116, 101, 114, 46, 105, 110, 116, 101, 108, 46, 99, 111, 109, 34, 44, 34, 97, 100, 118, 105, 115, 111, 114, 121, 73, 68, 115, 34, 58, 91, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 51, 51, 52, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 51, 56, 49, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 51, 56, 57, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 52, 55, 55, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 54, 49, 52, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 54, 49, 53, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 54, 49, 55, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 56, 50, 56, 34, 93, 44, 34, 105, 115, 118, 69, 110, 99, 108, 97, 118, 101, 81, 117, 111, 116, 101, 83, 116, 97, 116, 117, 115, 34, 58, 34, 71, 82, 79, 85, 80, 95, 79, 85, 84, 95, 79, 70, 95, 68, 65, 84, 69, 34, 44, 34, 112, 108, 97, 116, 102, 111, 114, 109, 73, 110, 102, 111, 66, 108, 111, 98, 34, 58, 34, 49, 53, 48, 50, 48, 48, 54, 53, 48, 52, 48, 48, 48, 49, 48, 48, 48, 48, 48, 70, 48, 70, 48, 50, 48, 50, 48, 49, 56, 48, 48, 69, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 68, 48, 48, 48, 48, 48, 67, 48, 48, 48, 48, 48, 48, 48, 50, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 66, 69, 52, 57, 65, 66, 51, 55, 55, 53, 56, 66, 70, 50, 67, 49, 65, 48, 70, 56, 52, 68, 66, 66, 56, 67, 67, 66, 48, 49, 52, 57, 67, 68, 50, 53, 69, 48, 51, 65, 56, 68, 66, 69, 48, 67, 50, 51, 70, 70, 66, 51, 49, 56, 66, 69, 70, 48, 68, 48, 66, 65, 49, 70, 53, 56, 51, 49, 52, 57, 55, 52, 49, 49, 67, 65, 55, 51, 70, 53, 56, 55, 49, 48, 65, 57, 52, 54, 66, 66, 70, 53, 66, 52, 56, 52, 66, 66, 66, 49, 67, 70, 69, 67, 54, 50, 49, 55, 67, 54, 55, 67, 70, 48, 56, 68, 68, 52, 69, 50, 70, 56, 67, 50, 56, 66, 69, 53, 52, 49, 66, 34, 44, 34, 105, 115, 118, 69, 110, 99, 108, 97, 118, 101, 81, 117, 111, 116, 101, 66, 111, 100, 121, 34, 58, 34, 65, 103, 65, 66, 65, 79, 81, 76, 65, 65, 65, 79, 65, 65, 52, 65, 65, 65, 65, 65, 65, 66, 54, 88, 104, 48, 69, 77, 82, 89, 43, 87, 101, 43, 48, 55, 65, 103, 99, 120, 111, 115, 85, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 103, 55, 47, 66, 119, 101, 65, 66, 103, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 119, 65, 65, 65, 65, 65, 65, 65, 65, 65, 72, 65, 65, 65, 65, 65, 65, 65, 65, 65, 75, 116, 102, 122, 78, 76, 100, 106, 54, 79, 100, 85, 99, 83, 87, 50, 77, 54, 66, 106, 83, 98, 116, 50, 79, 57, 100, 99, 122, 120, 103, 47, 111, 84, 106, 105, 51, 76, 84, 56, 87, 53, 69, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 75, 116, 109, 66, 88, 114, 66, 121, 55, 49, 74, 43, 109, 82, 100, 107, 51, 65, 73, 57, 86, 68, 70, 118, 84, 86, 97, 56, 104, 50, 43, 112, 54, 99, 57, 87, 74, 51, 51, 79, 67, 90, 81, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 68, 68, 114, 56, 121, 89, 72, 57, 57, 79, 89, 52, 111, 68, 106, 111, 57, 80, 79, 111, 51, 103, 83, 47, 56, 75, 43, 114, 48, 56, 99, 86, 66, 110, 77, 107, 110, 88, 121, 89, 117, 43, 109, 119, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 34, 125].to_vec().try_into().unwrap(), + sign: [111, 117, 80, 86, 83, 122, 54, 66, 89, 121, 86, 83, 108, 73, 71, 104, 116, 120, 57, 66, 70, 120, 43, 54, 84, 106, 105, 121, 80, 48, 97, 119, 114, 101, 74, 83, 86, 51, 111, 65, 55, 69, 84, 67, 122, 82, 67, 101, 52, 53, 115, 77, 81, 66, 52, 78, 57, 48, 105, 115, 111, 88, 86, 52, 119, 68, 74, 86, 71, 71, 71, 76, 113, 56, 99, 70, 65, 116, 48, 52, 50, 53, 57, 90, 80, 75, 111, 70, 111, 122, 77, 83, 110, 77, 111, 119, 118, 87, 113, 54, 56, 78, 68, 112, 108, 85, 105, 69, 122, 90, 118, 106, 77, 99, 82, 111, 89, 81, 75, 54, 105, 108, 117, 77, 87, 66, 98, 85, 120, 119, 89, 52, 85, 80, 43, 83, 71, 82, 108, 84, 85, 110, 84, 49, 56, 87, 100, 79, 104, 71, 71, 122, 69, 79, 78, 115, 86, 43, 69, 107, 114, 47, 48, 80, 103, 57, 81, 99, 115, 49, 84, 120, 71, 86, 43, 49, 70, 57, 120, 51, 74, 118, 90, 87, 98, 75, 84, 66, 53, 82, 47, 50, 109, 113, 77, 115, 67, 100, 105, 112, 120, 109, 120, 73, 55, 75, 65, 53, 106, 82, 113, 57, 47, 67, 77, 68, 102, 111, 52, 72, 122, 86, 79, 106, 110, 78, 118, 122, 88, 51, 110, 83, 69, 100, 122, 108, 83, 65, 85, 117, 101, 105, 73, 87, 109, 51, 47, 89, 103, 51, 80, 69, 76, 72, 117, 118, 114, 115, 56, 116, 47, 73, 66, 122, 122, 104, 47, 72, 81, 114, 52, 104, 106, 81, 68, 119, 111, 87, 65, 108, 51, 86, 97, 76, 106, 105, 107, 68, 81, 49, 75, 48, 122, 54, 90, 82, 88, 82, 79, 70, 103, 114, 97, 73, 68, 43, 112, 54, 65, 57, 68, 116, 84, 74, 119, 97, 68, 83, 101, 102, 78, 82, 97, 65, 120, 51, 87, 69, 106, 122, 113, 43, 49, 103, 85, 78, 77, 116, 65, 85, 75, 103, 61, 61].to_vec().try_into().unwrap(), + cert_der: [77, 73, 73, 69, 111, 84, 67, 67, 65, 119, 109, 103, 65, 119, 73, 66, 65, 103, 73, 74, 65, 78, 69, 72, 100, 108, 48, 121, 111, 55, 67, 87, 77, 65, 48, 71, 67, 83, 113, 71, 83, 73, 98, 51, 68, 81, 69, 66, 67, 119, 85, 65, 77, 72, 52, 120, 67, 122, 65, 74, 66, 103, 78, 86, 66, 65, 89, 84, 65, 108, 86, 84, 77, 81, 115, 119, 67, 81, 89, 68, 86, 81, 81, 73, 68, 65, 74, 68, 81, 84, 69, 85, 77, 66, 73, 71, 65, 49, 85, 69, 66, 119, 119, 76, 85, 50, 70, 117, 100, 71, 69, 103, 81, 50, 120, 104, 99, 109, 69, 120, 71, 106, 65, 89, 66, 103, 78, 86, 66, 65, 111, 77, 69, 85, 108, 117, 100, 71, 86, 115, 73, 69, 78, 118, 99, 110, 66, 118, 99, 109, 70, 48, 97, 87, 57, 117, 77, 84, 65, 119, 76, 103, 89, 68, 86, 81, 81, 68, 68, 67, 100, 74, 98, 110, 82, 108, 98, 67, 66, 84, 82, 49, 103, 103, 81, 88, 82, 48, 90, 88, 78, 48, 89, 88, 82, 112, 98, 50, 52, 103, 85, 109, 86, 119, 98, 51, 74, 48, 73, 70, 78, 112, 90, 50, 53, 112, 98, 109, 99, 103, 81, 48, 69, 119, 72, 104, 99, 78, 77, 84, 89, 120, 77, 84, 73, 121, 77, 68, 107, 122, 78, 106, 85, 52, 87, 104, 99, 78, 77, 106, 89, 120, 77, 84, 73, 119, 77, 68, 107, 122, 78, 106, 85, 52, 87, 106, 66, 55, 77, 81, 115, 119, 67, 81, 89, 68, 86, 81, 81, 71, 69, 119, 74, 86, 85, 122, 69, 76, 77, 65, 107, 71, 65, 49, 85, 69, 67, 65, 119, 67, 81, 48, 69, 120, 70, 68, 65, 83, 66, 103, 78, 86, 66, 65, 99, 77, 67, 49, 78, 104, 98, 110, 82, 104, 73, 69, 78, 115, 89, 88, 74, 104, 77, 82, 111, 119, 71, 65, 89, 68, 86, 81, 81, 75, 68, 66, 70, 74, 98, 110, 82, 108, 98, 67, 66, 68, 98, 51, 74, 119, 98, 51, 74, 104, 100, 71, 108, 118, 98, 106, 69, 116, 77, 67, 115, 71, 65, 49, 85, 69, 65, 119, 119, 107, 83, 87, 53, 48, 90, 87, 119, 103, 85, 48, 100, 89, 73, 69, 70, 48, 100, 71, 86, 122, 100, 71, 70, 48, 97, 87, 57, 117, 73, 70, 74, 108, 99, 71, 57, 121, 100, 67, 66, 84, 97, 87, 100, 117, 97, 87, 53, 110, 77, 73, 73, 66, 73, 106, 65, 78, 66, 103, 107, 113, 104, 107, 105, 71, 57, 119, 48, 66, 65, 81, 69, 70, 65, 65, 79, 67, 65, 81, 56, 65, 77, 73, 73, 66, 67, 103, 75, 67, 65, 81, 69, 65, 113, 88, 111, 116, 52, 79, 90, 117, 112, 104, 82, 56, 110, 117, 100, 70, 114, 65, 70, 105, 97, 71, 120, 120, 107, 103, 109, 97, 47, 69, 115, 47, 66, 65, 43, 116, 98, 101, 67, 84, 85, 82, 49, 48, 54, 65, 76, 49, 69, 78, 99, 87, 65, 52, 70, 88, 51, 75, 43, 69, 57, 66, 66, 76, 48, 47, 55, 88, 53, 114, 106, 53, 110, 73, 103, 88, 47, 82, 47, 49, 117, 98, 104, 107, 75, 87, 119, 57, 103, 102, 113, 80, 71, 51, 75, 101, 65, 116, 73, 100, 99, 118, 47, 117, 84, 79, 49, 121, 88, 118, 53, 48, 118, 113, 97, 80, 118, 69, 49, 67, 82, 67, 104, 118, 122, 100, 83, 47, 90, 69, 66, 113, 81, 53, 111, 86, 118, 76, 84, 80, 90, 51, 86, 69, 105, 99, 81, 106, 108, 121, 116, 75, 103, 78, 57, 99, 76, 110, 120, 98, 119, 116, 117, 118, 76, 85, 75, 55, 101, 121, 82, 80, 102, 74, 87, 47, 107, 115, 100, 100, 79, 122, 80, 56, 86, 66, 66, 110, 105, 111, 108, 89, 110, 82, 67, 68, 50, 106, 114, 77, 82, 90, 56, 110, 66, 77, 50, 90, 87, 89, 119, 110, 88, 110, 119, 89, 101, 79, 65, 72, 86, 43, 87, 57, 116, 79, 104, 65, 73, 109, 119, 82, 119, 75, 70, 47, 57, 53, 121, 65, 115, 86, 119, 100, 50, 49, 114, 121, 72, 77, 74, 66, 99, 71, 72, 55, 48, 113, 76, 97, 103, 90, 55, 84, 116, 121, 116, 43, 43, 113, 79, 47, 54, 43, 75, 65, 88, 74, 117, 75, 119, 90, 113, 106, 82, 108, 69, 116, 83, 69, 122, 56, 103, 90, 81, 101, 70, 102, 86, 89, 103, 99, 119, 83, 102, 111, 57, 54, 111, 83, 77, 65, 122, 86, 114, 55, 86, 48, 76, 54, 72, 83, 68, 76, 82, 110, 112, 98, 54, 120, 120, 109, 98, 80, 100, 113, 78, 111, 108, 52, 116, 81, 73, 68, 65, 81, 65, 66, 111, 52, 71, 107, 77, 73, 71, 104, 77, 66, 56, 71, 65, 49, 85, 100, 73, 119, 81, 89, 77, 66, 97, 65, 70, 72, 104, 68, 101, 51, 97, 109, 102, 114, 122, 81, 114, 51, 53, 67, 78, 43, 115, 49, 102, 68, 117, 72, 65, 86, 69, 56, 77, 65, 52, 71, 65, 49, 85, 100, 68, 119, 69, 66, 47, 119, 81, 69, 65, 119, 73, 71, 119, 68, 65, 77, 66, 103, 78, 86, 72, 82, 77, 66, 65, 102, 56, 69, 65, 106, 65, 65, 77, 71, 65, 71, 65, 49, 85, 100, 72, 119, 82, 90, 77, 70, 99, 119, 86, 97, 66, 84, 111, 70, 71, 71, 84, 50, 104, 48, 100, 72, 65, 54, 76, 121, 57, 48, 99, 110, 86, 122, 100, 71, 86, 107, 99, 50, 86, 121, 100, 109, 108, 106, 90, 88, 77, 117, 97, 87, 53, 48, 90, 87, 119, 117, 89, 50, 57, 116, 76, 50, 78, 118, 98, 110, 82, 108, 98, 110, 81, 118, 81, 49, 74, 77, 76, 49, 78, 72, 87, 67, 57, 66, 100, 72, 82, 108, 99, 51, 82, 104, 100, 71, 108, 118, 98, 108, 74, 108, 99, 71, 57, 121, 100, 70, 78, 112, 90, 50, 53, 112, 98, 109, 100, 68, 81, 83, 53, 106, 99, 109, 119, 119, 68, 81, 89, 74, 75, 111, 90, 73, 104, 118, 99, 78, 65, 81, 69, 76, 66, 81, 65, 68, 103, 103, 71, 66, 65, 71, 99, 73, 116, 104, 116, 99, 75, 57, 73, 86, 82, 122, 52, 114, 82, 113, 43, 90, 75, 69, 43, 55, 107, 53, 48, 47, 79, 120, 85, 115, 109, 87, 56, 97, 97, 118, 79, 122, 75, 98, 48, 105, 67, 120, 48, 55, 89, 81, 57, 114, 122, 105, 53, 110, 85, 55, 51, 116, 77, 69, 50, 121, 71, 82, 76, 122, 104, 83, 86, 105, 70, 115, 47, 76, 112, 70, 97, 57, 108, 112, 81, 76, 54, 74, 76, 49, 97, 81, 119, 109, 68, 82, 55, 52, 84, 120, 89, 71, 66, 65, 73, 105, 53, 102, 52, 73, 53, 84, 74, 111, 67, 67, 69, 113, 82, 72, 122, 57, 49, 107, 112, 71, 54, 85, 118, 121, 110, 50, 116, 76, 109, 110, 73, 100, 74, 98, 80, 69, 52, 118, 89, 118, 87, 76, 114, 116, 88, 88, 102, 70, 66, 83, 83, 80, 68, 52, 65, 102, 110, 55, 43, 51, 47, 88, 85, 103, 103, 65, 108, 99, 55, 111, 67, 84, 105, 122, 79, 102, 98, 98, 116, 79, 70, 108, 89, 65, 52, 103, 53, 75, 99, 89, 103, 83, 49, 74, 50, 90, 65, 101, 77, 81, 113, 98, 85, 100, 90, 115, 101, 90, 67, 99, 97, 90, 90, 90, 110, 54, 53, 116, 100, 113, 101, 101, 56, 85, 88, 90, 108, 68, 118, 120, 48, 43, 78, 100, 79, 48, 76, 82, 43, 53, 112, 70, 121, 43, 106, 117, 77, 48, 119, 87, 98, 117, 53, 57, 77, 118, 122, 99, 109, 84, 88, 98, 106, 115, 105, 55, 72, 89, 54, 122, 100, 53, 51, 89, 113, 53, 75, 50, 52, 52, 102, 119, 70, 72, 82, 81, 56, 101, 79, 66, 48, 73, 87, 66, 43, 52, 80, 102, 77, 55, 70, 101, 65, 65, 112, 90, 118, 108, 102, 113, 108, 75, 79, 108, 76, 99, 90, 76, 50, 117, 121, 86, 109, 122, 82, 107, 121, 82, 53, 121, 87, 55, 50, 117, 111, 57, 109, 101, 104, 88, 52, 52, 67, 105, 80, 74, 50, 102, 115, 101, 57, 89, 54, 101, 81, 116, 99, 102, 69, 104, 77, 80, 107, 109, 72, 88, 73, 48, 49, 115, 78, 43, 75, 119, 80, 98, 112, 65, 51, 57, 43, 120, 79, 115, 83, 116, 106, 104, 80, 57, 78, 49, 89, 49, 97, 50, 116, 81, 65, 86, 111, 43, 121, 86, 103, 76, 103, 86, 50, 72, 119, 115, 55, 51, 70, 99, 48, 111, 51, 119, 67, 55, 56, 113, 80, 69, 65, 43, 118, 50, 97, 82, 115, 47, 66, 101, 51, 90, 70, 68, 103, 68, 121, 103, 104, 99, 47, 49, 102, 103, 85, 43, 55, 67, 43, 80, 54, 107, 98, 113, 100, 52, 112, 111, 121, 98, 54, 73, 87, 56, 75, 67, 74, 98, 120, 102, 77, 74, 118, 107, 111, 114, 100, 78, 79, 103, 79, 85, 85, 120, 110, 100, 80, 72, 69, 105, 47, 116, 98, 47, 85, 55, 117, 76, 106, 76, 79, 103, 80, 65, 61, 61].to_vec().try_into().unwrap(), } } @@ -35,7 +35,7 @@ pub fn tee_register() -> Result<(T::AccountId, T::AccountId), &'stati RawOrigin::Signed(controller.clone()).into(), stash.clone(), NODE_PUBLIC_KEY, - [0u8; 38], + PEER_ID, PODR2_PBK, sgx_att_report ).map_err(|_| "tee worker register error")?; @@ -46,7 +46,7 @@ benchmarks! { register { let (stash, controller) = pallet_cess_staking::testing_utils::create_stash_controller::(USER_SEED, 100, Default::default())?; let sgx_att_report = get_report(); - }: _(RawOrigin::Signed(controller.clone()), stash.clone(), NODE_PUBLIC_KEY, [0u8; 38], PODR2_PBK, sgx_att_report) + }: _(RawOrigin::Signed(controller.clone()), stash.clone(), NODE_PUBLIC_KEY, PEER_ID, PODR2_PBK, sgx_att_report) verify { assert!(TeeWorkerMap::::contains_key(&controller)) } diff --git a/c-pallets/tee-worker/src/weights_demo.rs b/c-pallets/tee-worker/src/weights_demo.rs new file mode 100644 index 00000000..f7606619 --- /dev/null +++ b/c-pallets/tee-worker/src/weights_demo.rs @@ -0,0 +1,110 @@ +// This file is part of Substrate. + +// Copyright (C) 2022 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Autogenerated weights for pallet_tee_worker +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-08-28, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("cess-initial-devnet"), DB CACHE: 1024 + +// Executed Command: +// ./target/release/cess-node +// benchmark +// pallet +// --chain +// cess-initial-devnet +// --execution=wasm +// --wasm-execution=compiled +// --pallet +// pallet_tee_worker +// --extrinsic +// * +// --steps +// 50 +// --repeat +// 20 +// --template=./.maintain/frame-weight-template.hbs +// --output=./c-pallets/tee-worker/src/weights_demo.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_tee_worker. +pub trait WeightInfo { + fn register() -> Weight; + fn update_whitelist() -> Weight; + fn exit() -> Weight; +} + +/// Weights for pallet_tee_worker using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + // Storage: Staking Bonded (r:1 w:0) + // Storage: TeeWorker TeeWorkerMap (r:1 w:1) + // Storage: TeeWorker CounterForTeeWorkerMap (r:1 w:1) + // Storage: TeeWorker TeePodr2Pk (r:0 w:1) + fn register() -> Weight { + (1_578_671_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } + // Storage: TeeWorker MrEnclaveWhitelist (r:1 w:1) + fn update_whitelist() -> Weight { + (23_299_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } + // Storage: TeeWorker TeeWorkerMap (r:1 w:1) + // Storage: TeeWorker CounterForTeeWorkerMap (r:1 w:1) + // Storage: TeeWorker TeePodr2Pk (r:0 w:1) + fn exit() -> Weight { + (54_289_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + // Storage: Staking Bonded (r:1 w:0) + // Storage: TeeWorker TeeWorkerMap (r:1 w:1) + // Storage: TeeWorker CounterForTeeWorkerMap (r:1 w:1) + // Storage: TeeWorker TeePodr2Pk (r:0 w:1) + fn register() -> Weight { + (1_578_671_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } + // Storage: TeeWorker MrEnclaveWhitelist (r:1 w:1) + fn update_whitelist() -> Weight { + (23_299_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + // Storage: TeeWorker TeeWorkerMap (r:1 w:1) + // Storage: TeeWorker CounterForTeeWorkerMap (r:1 w:1) + // Storage: TeeWorker TeePodr2Pk (r:0 w:1) + fn exit() -> Weight { + (54_289_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } +} \ No newline at end of file diff --git a/primitives/common/src/lib.rs b/primitives/common/src/lib.rs index b8e50536..06fb1a10 100644 --- a/primitives/common/src/lib.rs +++ b/primitives/common/src/lib.rs @@ -136,7 +136,7 @@ pub type NodePublicKey = sp_core::ed25519::Public; pub type NodeSignature = [u8; 64]; pub type ReportSign = BoundedVec>; -pub type Report = BoundedVec>; +pub type Report = BoundedVec>; pub type Cert = BoundedVec>; #[derive(PartialEq, Eq, Encode, Decode, Clone, RuntimeDebug, MaxEncodedLen, TypeInfo)] diff --git a/primitives/enclave-verify/src/lib.rs b/primitives/enclave-verify/src/lib.rs index fde7e42d..9caadaef 100644 --- a/primitives/enclave-verify/src/lib.rs +++ b/primitives/enclave-verify/src/lib.rs @@ -16,6 +16,7 @@ use rsa::{ PublicKey, Pkcs1v15Sign, pkcs1::DecodeRsaPublicKey, + pkcs8::DecodePrivateKey, }; use sp_core::bounded::BoundedVec; use ic_verify_bls_signature::{ @@ -268,36 +269,34 @@ pub struct PoISKey { use codec::{Decode, Encode}; -// #[test] -// fn cryptos_rsa() { -// // let mut rng = rand::thread_rng(); -// let priv_key_der = [48, 130, 4, 164, 2, 1, 0, 2, 130, 1, 1, 0, 232, 164, 71, 61, 156, 19, 143, 219, 24, 119, 196, 115, 203, 33, 130, 151, 75, 193, 108, 45, 181, 28, 191, 217, 102, 16, 251, 69, 156, 138, 34, 69, 68, 239, 167, 157, 121, 34, 146, 221, 122, 71, 183, 180, 190, 53, 5, 94, 154, 224, 178, 215, 143, 210, 96, 209, 51, 13, 153, 186, 209, 42, 30, 184, 117, 100, 112, 165, 234, 132, 48, 11, 137, 160, 143, 171, 209, 37, 93, 58, 237, 199, 4, 65, 231, 156, 171, 238, 184, 196, 182, 185, 5, 15, 216, 174, 194, 238, 247, 101, 25, 167, 108, 61, 236, 131, 208, 221, 104, 49, 198, 233, 98, 40, 30, 35, 0, 99, 93, 169, 190, 225, 76, 106, 55, 179, 135, 252, 71, 124, 215, 70, 189, 104, 167, 157, 31, 169, 7, 65, 147, 103, 47, 238, 62, 44, 136, 49, 31, 68, 176, 103, 77, 230, 83, 205, 162, 237, 154, 196, 193, 246, 79, 40, 206, 156, 87, 70, 178, 11, 64, 59, 174, 248, 210, 233, 140, 144, 93, 197, 115, 32, 133, 44, 157, 125, 226, 159, 221, 4, 19, 26, 247, 234, 54, 49, 216, 114, 142, 130, 13, 163, 250, 178, 72, 32, 187, 175, 59, 189, 53, 174, 19, 252, 169, 83, 235, 175, 38, 76, 241, 124, 131, 86, 46, 38, 87, 119, 45, 101, 51, 6, 133, 36, 178, 123, 212, 137, 57, 14, 110, 20, 164, 219, 79, 134, 82, 98, 213, 246, 115, 68, 119, 104, 157, 209, 2, 3, 1, 0, 1, 2, 130, 1, 0, 20, 199, 199, 205, 75, 9, 188, 73, 215, 207, 170, 238, 164, 240, 99, 87, 220, 94, 116, 169, 72, 138, 62, 224, 206, 107, 41, 230, 183, 234, 230, 208, 197, 45, 155, 13, 71, 234, 188, 175, 167, 226, 140, 24, 74, 253, 53, 115, 147, 230, 10, 83, 146, 247, 57, 202, 182, 2, 186, 254, 162, 252, 94, 46, 31, 222, 78, 233, 163, 31, 23, 163, 144, 49, 149, 99, 197, 148, 206, 213, 26, 180, 50, 63, 40, 207, 39, 212, 117, 16, 173, 57, 173, 168, 18, 180, 217, 152, 186, 228, 126, 252, 35, 129, 12, 133, 97, 188, 197, 55, 221, 10, 175, 199, 225, 153, 66, 201, 157, 110, 50, 44, 177, 196, 179, 33, 8, 62, 103, 16, 113, 237, 189, 74, 15, 207, 163, 190, 126, 165, 68, 160, 205, 187, 209, 164, 50, 182, 36, 117, 189, 168, 74, 209, 34, 132, 203, 189, 24, 142, 239, 235, 57, 108, 35, 67, 185, 29, 111, 17, 89, 174, 251, 96, 23, 178, 250, 17, 235, 126, 7, 56, 209, 94, 234, 116, 38, 125, 170, 184, 100, 109, 159, 239, 202, 150, 66, 134, 112, 25, 158, 242, 240, 127, 21, 111, 191, 144, 105, 84, 108, 220, 92, 86, 99, 255, 210, 145, 238, 175, 219, 57, 178, 44, 216, 130, 34, 214, 180, 141, 106, 201, 114, 245, 89, 255, 99, 203, 35, 50, 36, 12, 219, 9, 115, 221, 30, 223, 36, 161, 39, 155, 84, 121, 1, 25, 2, 129, 129, 0, 238, 166, 41, 103, 247, 201, 251, 212, 146, 222, 200, 89, 157, 94, 61, 144, 175, 207, 151, 114, 104, 132, 125, 136, 189, 151, 128, 32, 180, 50, 4, 79, 214, 240, 61, 163, 43, 61, 246, 4, 22, 24, 120, 187, 216, 12, 242, 92, 166, 52, 109, 251, 169, 104, 51, 193, 103, 117, 39, 172, 251, 175, 226, 82, 183, 73, 64, 206, 131, 241, 182, 154, 179, 129, 249, 104, 97, 128, 208, 140, 181, 17, 192, 208, 183, 31, 94, 83, 245, 10, 208, 185, 54, 102, 198, 35, 130, 36, 239, 233, 236, 174, 140, 107, 4, 205, 15, 73, 94, 238, 141, 210, 203, 106, 105, 20, 21, 230, 149, 218, 60, 182, 34, 55, 238, 8, 80, 163, 2, 129, 129, 0, 249, 142, 78, 23, 123, 50, 222, 201, 91, 71, 233, 52, 66, 98, 193, 2, 137, 51, 187, 7, 87, 220, 46, 104, 75, 128, 47, 41, 209, 0, 37, 4, 130, 83, 61, 4, 176, 148, 218, 20, 219, 217, 53, 41, 97, 150, 164, 129, 71, 13, 106, 82, 251, 226, 204, 102, 194, 25, 212, 216, 105, 240, 245, 123, 136, 95, 109, 75, 170, 181, 186, 243, 141, 2, 206, 53, 201, 163, 117, 237, 236, 45, 16, 243, 0, 53, 179, 174, 153, 107, 42, 186, 234, 219, 199, 59, 121, 194, 117, 242, 53, 198, 130, 159, 114, 192, 51, 32, 93, 45, 233, 47, 242, 210, 219, 8, 65, 209, 254, 164, 155, 175, 232, 63, 178, 187, 26, 251, 2, 129, 128, 62, 7, 62, 55, 225, 181, 196, 24, 202, 91, 209, 99, 73, 125, 215, 46, 166, 35, 164, 207, 125, 207, 1, 249, 234, 157, 88, 22, 39, 255, 224, 19, 8, 96, 197, 4, 134, 22, 194, 188, 233, 41, 79, 40, 51, 205, 153, 168, 239, 34, 45, 123, 253, 218, 49, 169, 145, 68, 104, 29, 148, 5, 113, 35, 226, 179, 205, 126, 95, 217, 17, 135, 64, 37, 6, 56, 85, 47, 112, 5, 66, 130, 236, 196, 210, 243, 250, 70, 132, 40, 93, 123, 230, 97, 236, 26, 10, 151, 163, 43, 255, 242, 150, 88, 178, 148, 193, 230, 102, 32, 71, 8, 133, 10, 145, 105, 65, 15, 255, 223, 11, 108, 163, 148, 57, 240, 59, 85, 2, 129, 129, 0, 169, 39, 34, 27, 156, 112, 64, 190, 111, 86, 240, 229, 113, 82, 10, 205, 179, 62, 19, 57, 200, 253, 255, 158, 197, 254, 94, 249, 147, 38, 235, 240, 128, 125, 247, 80, 36, 120, 224, 209, 94, 171, 125, 243, 76, 168, 149, 92, 227, 82, 94, 141, 93, 26, 191, 189, 175, 55, 95, 36, 73, 187, 0, 73, 249, 135, 229, 71, 114, 176, 183, 197, 186, 0, 250, 209, 78, 153, 179, 167, 207, 124, 68, 142, 209, 199, 148, 193, 118, 80, 67, 168, 106, 229, 9, 200, 112, 161, 180, 220, 182, 66, 149, 235, 138, 22, 105, 17, 56, 215, 147, 197, 226, 107, 181, 247, 132, 213, 216, 42, 175, 52, 174, 209, 238, 78, 16, 221, 2, 129, 129, 0, 148, 213, 2, 173, 34, 234, 43, 241, 127, 238, 197, 184, 144, 188, 231, 126, 80, 124, 90, 35, 230, 23, 188, 232, 27, 30, 176, 249, 43, 120, 117, 237, 196, 228, 228, 209, 49, 231, 254, 97, 129, 128, 82, 117, 119, 16, 66, 168, 21, 163, 127, 132, 67, 188, 133, 81, 140, 89, 26, 44, 194, 196, 123, 52, 72, 219, 91, 48, 10, 227, 230, 149, 125, 59, 111, 80, 121, 253, 252, 63, 193, 131, 193, 254, 131, 245, 169, 6, 152, 86, 51, 56, 153, 22, 235, 89, 161, 156, 128, 86, 133, 4, 88, 233, 131, 134, 38, 144, 127, 221, 159, 112, 209, 2, 212, 85, 165, 56, 89, 26, 122, 49, 150, 246, 172, 129, 8, 5]; -// // let bits = 2048; -// // let priv_key = RsaPrivateKey::new(&mut rng, bits).expect("failed to generate a key"); -// let priv_key = rsa::RsaPrivateKey::from_pkcs1_der(&priv_key_der).expect("failed to generate a key"); +#[test] +fn cryptos_rsa() { + let priv_key = RsaPrivateKey::from_pkcs8_der(&hex::decode("308204bd020100300d06092a864886f70d0101010500048204a7308204a3020100028201010097f726d8bc510040ef6552b5861e54ab781527c4d852110ae14e5b23b6083201a4ebcec9e9dfae7d8a33460e14c634c7098e41b7fb861672f2cda91c73d55252aa3f39183b88a2e77beabbaff45fe8fe82112ea3c95df4f0b31e2bdd43e2a11635a14ddd7c30153eb56c3f0a07a05caa976f337000b7a8db4e691d2f54229f1176c27304d06e384c16cac868d26166b7563f6c32b315ec93398e4c43f3eba2ca93a394ed07e57afa4bf963f29d2288af4a8c499109833858f9af111a5d480f3255e65b7ceb1a68c8a1a089f903310777cf647f6cd7fbd6e4b4dddf0ca342d6b96454410647f02df76bc1ee44435ca1df012b9689daddd5e8240579203b814b050203010001028201000cc6c4c7581ddf4d9653087f26858a4cd84dbf0837bfbe9b11924aeb57b49cafb2b3f8b0d52eef36b2d5d8bffa5327c0cc36dfa39e4c09bb245ad22b083a192fc60c86ba58d7060b3c49e1f9cb2bfd24d8bea513342ce8190c962ecded953241f1c45c0d911161d7e1dcf5f7dbe849a236152d57ef5781a4de94cbd55cd784540c633f4ce96a053d6a19533b9830c7b8396f190f020099a4e481e24a41022a1191330ac599a7199ca776913db12be96cf5b949ad5d73be9d3b66311a8ba10a48b00a9deedbccc015aace97fb79ae19bbe39fa0103772d4a25bf7e4f35c2ede2943a935423720d4f3059994f171650558bc1bfabf725d10916095c162b8717cc902818100c393e0b47b91321fef951ad8fb1cdc1ec928e73f715f673ff093847d380dcff6c040691ac7cdcac45bf0ed38299a10b1349a56b60178de81e38095251dda7b2bb0ca96c5457fe162daf9b7a0bf30d1a8eae47340d75622dd72c22aa12f3fb45154896b791ab4a5275be06657098bb9def81010297981b0d531af2c4ee08da78b02818100c6ea027695077584eca26d7ef4b4e361f3cc583ff5fff2114daebbb0a6a92dff11861c7596626e86bad32fd11ae7683f8ad45599eefe2cd2117825e0c5590be86e2187e0bb1636a104cde7b6b0a573e169f56c2ae8ff171eece31295964a3426009fc4c2672ace0be0d59c99c427c0fbf8e7e9d4636165e9ba8803c24f53a9af02818100b24e0e8ddd1e09c9cdde6d64a6c3aff72d446a578fdfffbcee733f55fe15b1a4efaf89634e07d3b5e370aa850a8098794650f37ee9a6ad8d53c175b82a187734e4f03e36c9df05b7df95cd10f35de9b78bb70d506f41eb75635b9c0be98cb5b37453f8b4a7614c34aef1cdbbca4b26011ebd5e4ec1a5387795dd7392d1ecb37302818045146fd68edb104d21812755b7d63a418251ad344952a1d6b08bc6530b0e2613371ac437720aad27cd2a1aa91c16d1757fd94e012fa6c61a0e4713a083e8f0e1bf9d957ace7e606a7b28a7182330d295ae1eb57a1180c59ecfd5ec5656e35e48f45e880e9b959a093603f966cd60a0fce0ec69a081030a49a9a622e8107495b10281806de9944afeb9670b92eb33b3afcd4890c20b3ba9f7d055305d5027b2ccd5d8f565488b3f56342f04968d29cdaee716ad333868beecbd7df5cd2aeeba0c1c4d810f78162e0a02e3c1aa54ee9103469efc6cf3542e9292bddffc8d328996a8bb67f78a7701e9f113ad790bdfd981d39cf116b5ee41dd5e42fcc2b1f3d11e6a7d15").unwrap()).unwrap(); + // let skey = RsaPrivateKey::new(&mut rng, bits).expect("failed to generate a key"); + let pub_key = RsaPublicKey::from(&priv_key); + println!("{:?}",hex::encode(pub_key.to_pkcs1_der().unwrap().to_vec())); -// let pub_key = RsaPublicKey::from(&priv_key); + let original_text = [193, 246, 62, 231, 50, 88, 107, 103, 221, 158, 61, 148, 6, 248, 29, 248, 56, 172, 222, 109, 191, 170, 225, 72, 211, 29, 42, 18, 51, 234, 205, 136]; -// let original_text = [222, 201, 105, 133, 69, 187, 238, 44, 118, 21, 214, 187, 215, 163, 51, 204, 51, 181, 37, 205, 211, 139, 32, 225, 147, 212, 106, 77, 202, 251, 95, 144]; + // let priv_key_der = priv_key.to_pkcs1_der().unwrap(); + // println!("priv_key_der: {:?}", priv_key_der.as_bytes()); + // println!(); -// let priv_key_der = priv_key.to_pkcs1_der().unwrap(); -// // println!("priv_key_der: {:?}", priv_key_der.as_bytes()); -// // println!(); + let doc = pub_key.to_pkcs1_der().unwrap(); + // println!("pub_key: {:?}, length: {}", doc.as_bytes(), doc.as_bytes().len()); -// let doc = pub_key.to_pkcs1_der().unwrap(); -// // println!("pub_key: {:?}, length: {}", doc.as_bytes(), doc.as_bytes().len()); + let pk = rsa::RsaPublicKey::from_pkcs1_der(doc.as_bytes()).unwrap(); -// let pk = rsa::RsaPublicKey::from_pkcs1_der(doc.as_bytes()).unwrap(); + let msg = "hello world!".as_bytes(); + let binding = priv_key.sign(Pkcs1v15Sign::new_raw(), &original_text).unwrap(); + let sig: &[u8] = binding.as_ref(); + println!("sig is: {:?}, sig is length: {:?}", sig, sig.len()); -// let msg = "hello world!".as_bytes(); -// let binding = priv_key.sign(Pkcs1v15Sign::new_raw(), &original_text).unwrap(); -// let sig: &[u8] = binding.as_ref(); -// println!("sig is: {:?}, sig is length: {:?}", sig, sig.len()); + let result = pk.verify(Pkcs1v15Sign::new_raw(), &original_text, &sig); -// let result = pk.verify(Pkcs1v15Sign::new_raw(), &original_text, &sig); + println!("result: {:?}", result); +} -// println!("result: {:?}", result); -// } #[derive(Debug)] pub enum EnclaveError { InvalidQuoteDataSize, @@ -338,9 +337,9 @@ impl TryFrom<&[u8]> for QuoteReport { // #[test] // fn anaylize_cert() { -// let report_json_raw: Report = "{\"id\":\"120464590878458865341505907007650476931\",\"timestamp\":\"2023-08-18T10:52:50.831736\",\"version\":4,\"epidPseudonym\":\"7+Jpi5RSDua6q1rmZHMpKdtPhfgoQj+74Ujo11SCqvYk/U1/s08H2mCekn5wkR/5rG7B1zrhJ1kyveR/kHxb/GmKG3Tc4SVJnN7K+/a0Pn6y+jBKhj4OJemfXKThm1hYz4LAq5xESRyDLYoGRY/90vgaAYZmh5oUo0Abbo1cAfw=\",\"advisoryURL\":\"https://security-center.intel.com\",\"advisoryIDs\":[\"INTEL-SA-00334\",\"INTEL-SA-00381\",\"INTEL-SA-00389\",\"INTEL-SA-00477\",\"INTEL-SA-00614\",\"INTEL-SA-00615\",\"INTEL-SA-00617\"],\"isvEnclaveQuoteStatus\":\"GROUP_OUT_OF_DATE\",\"platformInfoBlob\":\"1502006504000100000E0E020201800E0000000000000000000D00000C000000020000000000000BE4D0AF39F62AF776A5D7A1D8EE17155C7609D23B80BA849131DBC895379E323290614C050018FC2CC0AD383BC2D322B852632B70B52BA719691CC661ACCF1ADEA3\",\"isvEnclaveQuoteBody\":\"AgABAOQLAAAOAA4AAAAAAB6Xh0EMRY+We+07AgcxosUAAAAAAAAAAAAAAAAAAAAACg7/BweABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAABXkcVvPyuhVAraJjcWaKF/MsRD02z3qc9Nl2oPHqaj9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACKtmBXrBy71J+mRdk3AI9VDFvTVa8h2+p6c9WJ33OCZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADDr8yYH99OY4oDjo9POo3gS/8K+r08cVBnMknXyYu+mwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}".as_bytes().to_vec().try_into().unwrap(); -// let ias_cert: Cert = "MIIEoTCCAwmgAwIBAgIJANEHdl0yo7CWMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTEUMBIGA1UEBwwLU2FudGEgQ2xhcmExGjAYBgNVBAoMEUludGVsIENvcnBvcmF0aW9uMTAwLgYDVQQDDCdJbnRlbCBTR1ggQXR0ZXN0YXRpb24gUmVwb3J0IFNpZ25pbmcgQ0EwHhcNMTYxMTIyMDkzNjU4WhcNMjYxMTIwMDkzNjU4WjB7MQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExFDASBgNVBAcMC1NhbnRhIENsYXJhMRowGAYDVQQKDBFJbnRlbCBDb3Jwb3JhdGlvbjEtMCsGA1UEAwwkSW50ZWwgU0dYIEF0dGVzdGF0aW9uIFJlcG9ydCBTaWduaW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqXot4OZuphR8nudFrAFiaGxxkgma/Es/BA+tbeCTUR106AL1ENcWA4FX3K+E9BBL0/7X5rj5nIgX/R/1ubhkKWw9gfqPG3KeAtIdcv/uTO1yXv50vqaPvE1CRChvzdS/ZEBqQ5oVvLTPZ3VEicQjlytKgN9cLnxbwtuvLUK7eyRPfJW/ksddOzP8VBBniolYnRCD2jrMRZ8nBM2ZWYwnXnwYeOAHV+W9tOhAImwRwKF/95yAsVwd21ryHMJBcGH70qLagZ7Ttyt++qO/6+KAXJuKwZqjRlEtSEz8gZQeFfVYgcwSfo96oSMAzVr7V0L6HSDLRnpb6xxmbPdqNol4tQIDAQABo4GkMIGhMB8GA1UdIwQYMBaAFHhDe3amfrzQr35CN+s1fDuHAVE8MA4GA1UdDwEB/wQEAwIGwDAMBgNVHRMBAf8EAjAAMGAGA1UdHwRZMFcwVaBToFGGT2h0dHA6Ly90cnVzdGVkc2VydmljZXMuaW50ZWwuY29tL2NvbnRlbnQvQ1JML1NHWC9BdHRlc3RhdGlvblJlcG9ydFNpZ25pbmdDQS5jcmwwDQYJKoZIhvcNAQELBQADggGBAGcIthtcK9IVRz4rRq+ZKE+7k50/OxUsmW8aavOzKb0iCx07YQ9rzi5nU73tME2yGRLzhSViFs/LpFa9lpQL6JL1aQwmDR74TxYGBAIi5f4I5TJoCCEqRHz91kpG6Uvyn2tLmnIdJbPE4vYvWLrtXXfFBSSPD4Afn7+3/XUggAlc7oCTizOfbbtOFlYA4g5KcYgS1J2ZAeMQqbUdZseZCcaZZZn65tdqee8UXZlDvx0+NdO0LR+5pFy+juM0wWbu59MvzcmTXbjsi7HY6zd53Yq5K244fwFHRQ8eOB0IWB+4PfM7FeAApZvlfqlKOlLcZL2uyVmzRkyR5yW72uo9mehX44CiPJ2fse9Y6eQtcfEhMPkmHXI01sN+KwPbpA39+xOsStjhP9N1Y1a2tQAVo+yVgLgV2Hws73Fc0o3wC78qPEA+v2aRs/Be3ZFDgDyghc/1fgU+7C+P6kbqd4poyb6IW8KCJbxfMJvkordNOgOUUxndPHEi/tb/U7uLjLOgPA==".as_bytes().to_vec().try_into().unwrap(); -// let ias_sig: ReportSign = "BmZuuPvvG/eA3lIXoANFvgNK+arpWXDbppD4yrm/F2F+hahPfSuOwZRvKTkVfJtmPt1eIlLmbO7f0cjKczHNd/dCkzGy+hBk+0qUlrolu1E8WSkMLIvXnRlnieK7MvGzIBl0WjyyoP5H1BFN15Lg5LBeW1iz+wg5FAaK65qSPc7uGELYXwdjj2WDrQ9mqh9QMT/hQvS2C65QJ3kSWbUtCXdIyrKtseaBjIHDgqwbQVi3NP9l+fK7PqWy8Ri6p+QLceWn9IJ49XRRHafUAIW8x8FwDS/Vr9/QIUnnFzu3c20t1N8HKWHPJMXTnunuhjLjd0adg4wEOPzwCv51ZVcuMw==".as_bytes().to_vec().try_into().unwrap(); +// let report_json_raw: Report = [123, 34, 105, 100, 34, 58, 34, 49, 52, 53, 48, 49, 48, 48, 56, 52, 50, 57, 55, 53, 48, 51, 56, 53, 56, 57, 54, 54, 52, 56, 56, 57, 56, 49, 53, 53, 52, 52, 51, 53, 56, 48, 48, 55, 53, 56, 34, 44, 34, 116, 105, 109, 101, 115, 116, 97, 109, 112, 34, 58, 34, 50, 48, 50, 51, 45, 48, 56, 45, 50, 54, 84, 48, 50, 58, 48, 56, 58, 52, 51, 46, 53, 51, 52, 57, 53, 55, 34, 44, 34, 118, 101, 114, 115, 105, 111, 110, 34, 58, 52, 44, 34, 101, 112, 105, 100, 80, 115, 101, 117, 100, 111, 110, 121, 109, 34, 58, 34, 55, 43, 74, 112, 105, 53, 82, 83, 68, 117, 97, 54, 113, 49, 114, 109, 90, 72, 77, 112, 75, 100, 116, 80, 104, 102, 103, 111, 81, 106, 43, 55, 52, 85, 106, 111, 49, 49, 83, 67, 113, 118, 89, 107, 47, 85, 49, 47, 115, 48, 56, 72, 50, 109, 67, 101, 107, 110, 53, 119, 107, 82, 47, 53, 114, 71, 55, 66, 49, 122, 114, 104, 74, 49, 107, 121, 118, 101, 82, 47, 107, 72, 120, 98, 47, 71, 109, 75, 71, 51, 84, 99, 52, 83, 86, 74, 110, 78, 55, 75, 43, 47, 97, 48, 80, 110, 54, 121, 43, 106, 66, 75, 104, 106, 52, 79, 74, 101, 109, 102, 88, 75, 84, 104, 109, 49, 104, 89, 122, 52, 76, 65, 113, 53, 120, 69, 83, 82, 121, 68, 76, 89, 111, 71, 82, 89, 47, 57, 48, 118, 103, 97, 65, 89, 90, 109, 104, 53, 111, 85, 111, 48, 65, 98, 98, 111, 49, 99, 65, 102, 119, 61, 34, 44, 34, 97, 100, 118, 105, 115, 111, 114, 121, 85, 82, 76, 34, 58, 34, 104, 116, 116, 112, 115, 58, 47, 47, 115, 101, 99, 117, 114, 105, 116, 121, 45, 99, 101, 110, 116, 101, 114, 46, 105, 110, 116, 101, 108, 46, 99, 111, 109, 34, 44, 34, 97, 100, 118, 105, 115, 111, 114, 121, 73, 68, 115, 34, 58, 91, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 51, 51, 52, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 51, 56, 49, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 51, 56, 57, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 52, 55, 55, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 54, 49, 52, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 54, 49, 53, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 54, 49, 55, 34, 44, 34, 73, 78, 84, 69, 76, 45, 83, 65, 45, 48, 48, 56, 50, 56, 34, 93, 44, 34, 105, 115, 118, 69, 110, 99, 108, 97, 118, 101, 81, 117, 111, 116, 101, 83, 116, 97, 116, 117, 115, 34, 58, 34, 71, 82, 79, 85, 80, 95, 79, 85, 84, 95, 79, 70, 95, 68, 65, 84, 69, 34, 44, 34, 112, 108, 97, 116, 102, 111, 114, 109, 73, 110, 102, 111, 66, 108, 111, 98, 34, 58, 34, 49, 53, 48, 50, 48, 48, 54, 53, 48, 52, 48, 48, 48, 49, 48, 48, 48, 48, 48, 70, 48, 70, 48, 50, 48, 50, 48, 49, 56, 48, 48, 69, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 68, 48, 48, 48, 48, 48, 67, 48, 48, 48, 48, 48, 48, 48, 50, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 66, 69, 52, 57, 65, 66, 51, 55, 55, 53, 56, 66, 70, 50, 67, 49, 65, 48, 70, 56, 52, 68, 66, 66, 56, 67, 67, 66, 48, 49, 52, 57, 67, 68, 50, 53, 69, 48, 51, 65, 56, 68, 66, 69, 48, 67, 50, 51, 70, 70, 66, 51, 49, 56, 66, 69, 70, 48, 68, 48, 66, 65, 49, 70, 53, 56, 51, 49, 52, 57, 55, 52, 49, 49, 67, 65, 55, 51, 70, 53, 56, 55, 49, 48, 65, 57, 52, 54, 66, 66, 70, 53, 66, 52, 56, 52, 66, 66, 66, 49, 67, 70, 69, 67, 54, 50, 49, 55, 67, 54, 55, 67, 70, 48, 56, 68, 68, 52, 69, 50, 70, 56, 67, 50, 56, 66, 69, 53, 52, 49, 66, 34, 44, 34, 105, 115, 118, 69, 110, 99, 108, 97, 118, 101, 81, 117, 111, 116, 101, 66, 111, 100, 121, 34, 58, 34, 65, 103, 65, 66, 65, 79, 81, 76, 65, 65, 65, 79, 65, 65, 52, 65, 65, 65, 65, 65, 65, 66, 54, 88, 104, 48, 69, 77, 82, 89, 43, 87, 101, 43, 48, 55, 65, 103, 99, 120, 111, 115, 85, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 103, 55, 47, 66, 119, 101, 65, 66, 103, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 66, 119, 65, 65, 65, 65, 65, 65, 65, 65, 65, 72, 65, 65, 65, 65, 65, 65, 65, 65, 65, 75, 116, 102, 122, 78, 76, 100, 106, 54, 79, 100, 85, 99, 83, 87, 50, 77, 54, 66, 106, 83, 98, 116, 50, 79, 57, 100, 99, 122, 120, 103, 47, 111, 84, 106, 105, 51, 76, 84, 56, 87, 53, 69, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 67, 75, 116, 109, 66, 88, 114, 66, 121, 55, 49, 74, 43, 109, 82, 100, 107, 51, 65, 73, 57, 86, 68, 70, 118, 84, 86, 97, 56, 104, 50, 43, 112, 54, 99, 57, 87, 74, 51, 51, 79, 67, 90, 81, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 68, 68, 114, 56, 121, 89, 72, 57, 57, 79, 89, 52, 111, 68, 106, 111, 57, 80, 79, 111, 51, 103, 83, 47, 56, 75, 43, 114, 48, 56, 99, 86, 66, 110, 77, 107, 110, 88, 121, 89, 117, 43, 109, 119, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 34, 125].to_vec().try_into().unwrap(); +// let ias_cert: Cert = [77, 73, 73, 69, 111, 84, 67, 67, 65, 119, 109, 103, 65, 119, 73, 66, 65, 103, 73, 74, 65, 78, 69, 72, 100, 108, 48, 121, 111, 55, 67, 87, 77, 65, 48, 71, 67, 83, 113, 71, 83, 73, 98, 51, 68, 81, 69, 66, 67, 119, 85, 65, 77, 72, 52, 120, 67, 122, 65, 74, 66, 103, 78, 86, 66, 65, 89, 84, 65, 108, 86, 84, 77, 81, 115, 119, 67, 81, 89, 68, 86, 81, 81, 73, 68, 65, 74, 68, 81, 84, 69, 85, 77, 66, 73, 71, 65, 49, 85, 69, 66, 119, 119, 76, 85, 50, 70, 117, 100, 71, 69, 103, 81, 50, 120, 104, 99, 109, 69, 120, 71, 106, 65, 89, 66, 103, 78, 86, 66, 65, 111, 77, 69, 85, 108, 117, 100, 71, 86, 115, 73, 69, 78, 118, 99, 110, 66, 118, 99, 109, 70, 48, 97, 87, 57, 117, 77, 84, 65, 119, 76, 103, 89, 68, 86, 81, 81, 68, 68, 67, 100, 74, 98, 110, 82, 108, 98, 67, 66, 84, 82, 49, 103, 103, 81, 88, 82, 48, 90, 88, 78, 48, 89, 88, 82, 112, 98, 50, 52, 103, 85, 109, 86, 119, 98, 51, 74, 48, 73, 70, 78, 112, 90, 50, 53, 112, 98, 109, 99, 103, 81, 48, 69, 119, 72, 104, 99, 78, 77, 84, 89, 120, 77, 84, 73, 121, 77, 68, 107, 122, 78, 106, 85, 52, 87, 104, 99, 78, 77, 106, 89, 120, 77, 84, 73, 119, 77, 68, 107, 122, 78, 106, 85, 52, 87, 106, 66, 55, 77, 81, 115, 119, 67, 81, 89, 68, 86, 81, 81, 71, 69, 119, 74, 86, 85, 122, 69, 76, 77, 65, 107, 71, 65, 49, 85, 69, 67, 65, 119, 67, 81, 48, 69, 120, 70, 68, 65, 83, 66, 103, 78, 86, 66, 65, 99, 77, 67, 49, 78, 104, 98, 110, 82, 104, 73, 69, 78, 115, 89, 88, 74, 104, 77, 82, 111, 119, 71, 65, 89, 68, 86, 81, 81, 75, 68, 66, 70, 74, 98, 110, 82, 108, 98, 67, 66, 68, 98, 51, 74, 119, 98, 51, 74, 104, 100, 71, 108, 118, 98, 106, 69, 116, 77, 67, 115, 71, 65, 49, 85, 69, 65, 119, 119, 107, 83, 87, 53, 48, 90, 87, 119, 103, 85, 48, 100, 89, 73, 69, 70, 48, 100, 71, 86, 122, 100, 71, 70, 48, 97, 87, 57, 117, 73, 70, 74, 108, 99, 71, 57, 121, 100, 67, 66, 84, 97, 87, 100, 117, 97, 87, 53, 110, 77, 73, 73, 66, 73, 106, 65, 78, 66, 103, 107, 113, 104, 107, 105, 71, 57, 119, 48, 66, 65, 81, 69, 70, 65, 65, 79, 67, 65, 81, 56, 65, 77, 73, 73, 66, 67, 103, 75, 67, 65, 81, 69, 65, 113, 88, 111, 116, 52, 79, 90, 117, 112, 104, 82, 56, 110, 117, 100, 70, 114, 65, 70, 105, 97, 71, 120, 120, 107, 103, 109, 97, 47, 69, 115, 47, 66, 65, 43, 116, 98, 101, 67, 84, 85, 82, 49, 48, 54, 65, 76, 49, 69, 78, 99, 87, 65, 52, 70, 88, 51, 75, 43, 69, 57, 66, 66, 76, 48, 47, 55, 88, 53, 114, 106, 53, 110, 73, 103, 88, 47, 82, 47, 49, 117, 98, 104, 107, 75, 87, 119, 57, 103, 102, 113, 80, 71, 51, 75, 101, 65, 116, 73, 100, 99, 118, 47, 117, 84, 79, 49, 121, 88, 118, 53, 48, 118, 113, 97, 80, 118, 69, 49, 67, 82, 67, 104, 118, 122, 100, 83, 47, 90, 69, 66, 113, 81, 53, 111, 86, 118, 76, 84, 80, 90, 51, 86, 69, 105, 99, 81, 106, 108, 121, 116, 75, 103, 78, 57, 99, 76, 110, 120, 98, 119, 116, 117, 118, 76, 85, 75, 55, 101, 121, 82, 80, 102, 74, 87, 47, 107, 115, 100, 100, 79, 122, 80, 56, 86, 66, 66, 110, 105, 111, 108, 89, 110, 82, 67, 68, 50, 106, 114, 77, 82, 90, 56, 110, 66, 77, 50, 90, 87, 89, 119, 110, 88, 110, 119, 89, 101, 79, 65, 72, 86, 43, 87, 57, 116, 79, 104, 65, 73, 109, 119, 82, 119, 75, 70, 47, 57, 53, 121, 65, 115, 86, 119, 100, 50, 49, 114, 121, 72, 77, 74, 66, 99, 71, 72, 55, 48, 113, 76, 97, 103, 90, 55, 84, 116, 121, 116, 43, 43, 113, 79, 47, 54, 43, 75, 65, 88, 74, 117, 75, 119, 90, 113, 106, 82, 108, 69, 116, 83, 69, 122, 56, 103, 90, 81, 101, 70, 102, 86, 89, 103, 99, 119, 83, 102, 111, 57, 54, 111, 83, 77, 65, 122, 86, 114, 55, 86, 48, 76, 54, 72, 83, 68, 76, 82, 110, 112, 98, 54, 120, 120, 109, 98, 80, 100, 113, 78, 111, 108, 52, 116, 81, 73, 68, 65, 81, 65, 66, 111, 52, 71, 107, 77, 73, 71, 104, 77, 66, 56, 71, 65, 49, 85, 100, 73, 119, 81, 89, 77, 66, 97, 65, 70, 72, 104, 68, 101, 51, 97, 109, 102, 114, 122, 81, 114, 51, 53, 67, 78, 43, 115, 49, 102, 68, 117, 72, 65, 86, 69, 56, 77, 65, 52, 71, 65, 49, 85, 100, 68, 119, 69, 66, 47, 119, 81, 69, 65, 119, 73, 71, 119, 68, 65, 77, 66, 103, 78, 86, 72, 82, 77, 66, 65, 102, 56, 69, 65, 106, 65, 65, 77, 71, 65, 71, 65, 49, 85, 100, 72, 119, 82, 90, 77, 70, 99, 119, 86, 97, 66, 84, 111, 70, 71, 71, 84, 50, 104, 48, 100, 72, 65, 54, 76, 121, 57, 48, 99, 110, 86, 122, 100, 71, 86, 107, 99, 50, 86, 121, 100, 109, 108, 106, 90, 88, 77, 117, 97, 87, 53, 48, 90, 87, 119, 117, 89, 50, 57, 116, 76, 50, 78, 118, 98, 110, 82, 108, 98, 110, 81, 118, 81, 49, 74, 77, 76, 49, 78, 72, 87, 67, 57, 66, 100, 72, 82, 108, 99, 51, 82, 104, 100, 71, 108, 118, 98, 108, 74, 108, 99, 71, 57, 121, 100, 70, 78, 112, 90, 50, 53, 112, 98, 109, 100, 68, 81, 83, 53, 106, 99, 109, 119, 119, 68, 81, 89, 74, 75, 111, 90, 73, 104, 118, 99, 78, 65, 81, 69, 76, 66, 81, 65, 68, 103, 103, 71, 66, 65, 71, 99, 73, 116, 104, 116, 99, 75, 57, 73, 86, 82, 122, 52, 114, 82, 113, 43, 90, 75, 69, 43, 55, 107, 53, 48, 47, 79, 120, 85, 115, 109, 87, 56, 97, 97, 118, 79, 122, 75, 98, 48, 105, 67, 120, 48, 55, 89, 81, 57, 114, 122, 105, 53, 110, 85, 55, 51, 116, 77, 69, 50, 121, 71, 82, 76, 122, 104, 83, 86, 105, 70, 115, 47, 76, 112, 70, 97, 57, 108, 112, 81, 76, 54, 74, 76, 49, 97, 81, 119, 109, 68, 82, 55, 52, 84, 120, 89, 71, 66, 65, 73, 105, 53, 102, 52, 73, 53, 84, 74, 111, 67, 67, 69, 113, 82, 72, 122, 57, 49, 107, 112, 71, 54, 85, 118, 121, 110, 50, 116, 76, 109, 110, 73, 100, 74, 98, 80, 69, 52, 118, 89, 118, 87, 76, 114, 116, 88, 88, 102, 70, 66, 83, 83, 80, 68, 52, 65, 102, 110, 55, 43, 51, 47, 88, 85, 103, 103, 65, 108, 99, 55, 111, 67, 84, 105, 122, 79, 102, 98, 98, 116, 79, 70, 108, 89, 65, 52, 103, 53, 75, 99, 89, 103, 83, 49, 74, 50, 90, 65, 101, 77, 81, 113, 98, 85, 100, 90, 115, 101, 90, 67, 99, 97, 90, 90, 90, 110, 54, 53, 116, 100, 113, 101, 101, 56, 85, 88, 90, 108, 68, 118, 120, 48, 43, 78, 100, 79, 48, 76, 82, 43, 53, 112, 70, 121, 43, 106, 117, 77, 48, 119, 87, 98, 117, 53, 57, 77, 118, 122, 99, 109, 84, 88, 98, 106, 115, 105, 55, 72, 89, 54, 122, 100, 53, 51, 89, 113, 53, 75, 50, 52, 52, 102, 119, 70, 72, 82, 81, 56, 101, 79, 66, 48, 73, 87, 66, 43, 52, 80, 102, 77, 55, 70, 101, 65, 65, 112, 90, 118, 108, 102, 113, 108, 75, 79, 108, 76, 99, 90, 76, 50, 117, 121, 86, 109, 122, 82, 107, 121, 82, 53, 121, 87, 55, 50, 117, 111, 57, 109, 101, 104, 88, 52, 52, 67, 105, 80, 74, 50, 102, 115, 101, 57, 89, 54, 101, 81, 116, 99, 102, 69, 104, 77, 80, 107, 109, 72, 88, 73, 48, 49, 115, 78, 43, 75, 119, 80, 98, 112, 65, 51, 57, 43, 120, 79, 115, 83, 116, 106, 104, 80, 57, 78, 49, 89, 49, 97, 50, 116, 81, 65, 86, 111, 43, 121, 86, 103, 76, 103, 86, 50, 72, 119, 115, 55, 51, 70, 99, 48, 111, 51, 119, 67, 55, 56, 113, 80, 69, 65, 43, 118, 50, 97, 82, 115, 47, 66, 101, 51, 90, 70, 68, 103, 68, 121, 103, 104, 99, 47, 49, 102, 103, 85, 43, 55, 67, 43, 80, 54, 107, 98, 113, 100, 52, 112, 111, 121, 98, 54, 73, 87, 56, 75, 67, 74, 98, 120, 102, 77, 74, 118, 107, 111, 114, 100, 78, 79, 103, 79, 85, 85, 120, 110, 100, 80, 72, 69, 105, 47, 116, 98, 47, 85, 55, 117, 76, 106, 76, 79, 103, 80, 65, 61, 61].to_vec().try_into().unwrap(); +// let ias_sig: ReportSign = [111, 117, 80, 86, 83, 122, 54, 66, 89, 121, 86, 83, 108, 73, 71, 104, 116, 120, 57, 66, 70, 120, 43, 54, 84, 106, 105, 121, 80, 48, 97, 119, 114, 101, 74, 83, 86, 51, 111, 65, 55, 69, 84, 67, 122, 82, 67, 101, 52, 53, 115, 77, 81, 66, 52, 78, 57, 48, 105, 115, 111, 88, 86, 52, 119, 68, 74, 86, 71, 71, 71, 76, 113, 56, 99, 70, 65, 116, 48, 52, 50, 53, 57, 90, 80, 75, 111, 70, 111, 122, 77, 83, 110, 77, 111, 119, 118, 87, 113, 54, 56, 78, 68, 112, 108, 85, 105, 69, 122, 90, 118, 106, 77, 99, 82, 111, 89, 81, 75, 54, 105, 108, 117, 77, 87, 66, 98, 85, 120, 119, 89, 52, 85, 80, 43, 83, 71, 82, 108, 84, 85, 110, 84, 49, 56, 87, 100, 79, 104, 71, 71, 122, 69, 79, 78, 115, 86, 43, 69, 107, 114, 47, 48, 80, 103, 57, 81, 99, 115, 49, 84, 120, 71, 86, 43, 49, 70, 57, 120, 51, 74, 118, 90, 87, 98, 75, 84, 66, 53, 82, 47, 50, 109, 113, 77, 115, 67, 100, 105, 112, 120, 109, 120, 73, 55, 75, 65, 53, 106, 82, 113, 57, 47, 67, 77, 68, 102, 111, 52, 72, 122, 86, 79, 106, 110, 78, 118, 122, 88, 51, 110, 83, 69, 100, 122, 108, 83, 65, 85, 117, 101, 105, 73, 87, 109, 51, 47, 89, 103, 51, 80, 69, 76, 72, 117, 118, 114, 115, 56, 116, 47, 73, 66, 122, 122, 104, 47, 72, 81, 114, 52, 104, 106, 81, 68, 119, 111, 87, 65, 108, 51, 86, 97, 76, 106, 105, 107, 68, 81, 49, 75, 48, 122, 54, 90, 82, 88, 82, 79, 70, 103, 114, 97, 73, 68, 43, 112, 54, 65, 57, 68, 116, 84, 74, 119, 97, 68, 83, 101, 102, 78, 82, 97, 65, 120, 51, 87, 69, 106, 122, 113, 43, 49, 103, 85, 78, 77, 116, 65, 85, 75, 103, 61, 61].to_vec().try_into().unwrap(); // let ias_cert_dec = match base64::decode_config(ias_cert, base64::STANDARD) { // Ok(c) => c, @@ -391,13 +390,13 @@ impl TryFrom<&[u8]> for QuoteReport { // println!("quote_report mr_enclave:{:?}", quote_report.report_body.mr_enclave); // println!("quote_report mr_signer:{:?}", quote_report.report_body.mr_signer); // println!("quote_report report_data:{:?}", quote_report.report_body.report_data); -// let text = "e_report.report_body.report_data[0..64]; -// println!("quote_report report_data slice:{:?}", text); -// println!("quote_report report_data slice convert to bytes:{:?}, len:{:?}", text.as_bytes(), text.as_bytes().len()); -// let text = sp_io::hashing::sha2_256(text.as_bytes()); -// let text_hex_str = hex::encode(text); -// println!("quote_report report_data slice hashing:{:?}, len:{:?}", text, text.len()); -// println!("quote_report report_data text_hex_str hashing:{:?}, text_hex_str length:{:?}", text_hex_str, text_hex_str.len()); +// // let text = "e_report.report_body.report_data[0..64]; +// // println!("quote_report report_data slice:{:?}", text); +// // println!("quote_report report_data slice convert to bytes:{:?}, len:{:?}", text.as_bytes(), text.as_bytes().len()); +// // let text = sp_io::hashing::sha2_256(text.as_bytes()); +// // let text_hex_str = hex::encode(text); +// // println!("quote_report report_data slice hashing:{:?}, len:{:?}", text, text.len()); +// // println!("quote_report report_data text_hex_str hashing:{:?}, text_hex_str length:{:?}", text_hex_str, text_hex_str.len()); // } // // Some(1) // } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 76dc507b..46231535 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -172,7 +172,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 105, + spec_version: 106, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -1593,8 +1593,10 @@ mod benches { // [pallet_oss, Oss] [pallet_cacher, Cacher] [pallet_storage_handler, StorageHandler] + [pallet_audit, AuditBench::] [pallet_file_bank, FileBankBench::] [pallet_tee_worker, TeeWorkerBench::] + [pallet_oss, Oss] // [pallet_audit, Audit] [pallet_collective::, Council] [pallet_collective::, TechnicalCommittee] @@ -2095,6 +2097,7 @@ impl_runtime_apis! { use pallet_file_bank::benchmarking::Pallet as FileBankBench; use pallet_evm::Pallet as PalletEvmBench; use pallet_sminer::benchmarking::Pallet as SminerBench; + use pallet_audit::benchmarking::Pallet as AuditBench; use baseline::Pallet as BaselineBench; let mut list = Vec::::new(); @@ -2115,11 +2118,13 @@ impl_runtime_apis! { use pallet_file_bank::benchmarking::Pallet as FileBankBench; use pallet_sminer::benchmarking::Pallet as SminerBench; use baseline::Pallet as BaselineBench; + use pallet_audit::benchmarking::Pallet as AuditBench; use frame_support::traits::WhitelistedStorageKeys; impl frame_system_benchmarking::Config for Runtime {} impl pallet_tee_worker::benchmarking::Config for Runtime{} impl pallet_sminer::benchmarking::Config for Runtime{} impl pallet_file_bank::benchmarking::Config for Runtime{} + impl pallet_audit::benchmarking::Config for Runtime{} // impl pallet_file_bank::benchmarking::Config for Runtime{} impl baseline::Config for Runtime {}