Companion for Substrate #6815 (Dynamic Whitelist) (#1612)

* Enable Dynamic Whitelisting

* "Update Substrate"

Co-authored-by: parity-processbot <>
This commit is contained in:
Shawn Tabrizi
2020-08-19 22:05:33 +02:00
committed by GitHub
parent 2fe0a8a4dc
commit 222520acc5
5 changed files with 172 additions and 174 deletions
+142 -139
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -23,7 +23,7 @@
use std::any::{TypeId, Any}; use std::any::{TypeId, Any};
use crate::primitives::{ValidationParams, ValidationResult}; use crate::primitives::{ValidationParams, ValidationResult};
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use sp_core::{storage::ChildInfo, traits::{CallInWasm, SpawnNamed}}; use sp_core::{storage::{ChildInfo, TrackedStorageKey}, traits::{CallInWasm, SpawnNamed}};
use sp_externalities::Extensions; use sp_externalities::Extensions;
use sp_wasm_interface::HostFunctions as _; use sp_wasm_interface::HostFunctions as _;
@@ -305,7 +305,11 @@ impl sp_externalities::Externalities for ValidationExternalities {
panic!("reset_read_write_count: unsupported feature for parachain validation") panic!("reset_read_write_count: unsupported feature for parachain validation")
} }
fn set_whitelist(&mut self, _: Vec<Vec<u8>>) { fn get_whitelist(&self) -> Vec<TrackedStorageKey> {
panic!("get_whitelist: unsupported feature for parachain validation")
}
fn set_whitelist(&mut self, _: Vec<TrackedStorageKey>) {
panic!("set_whitelist: unsupported feature for parachain validation") panic!("set_whitelist: unsupported feature for parachain validation")
} }
+8 -11
View File
@@ -1204,7 +1204,7 @@ sp_api::impl_runtime_apis! {
repeat: u32, repeat: u32,
extra: bool, extra: bool,
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> { ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark}; use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
// Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues. // Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues.
// To get around that, we separated the Session benchmarks into its own crate, which is why // To get around that, we separated the Session benchmarks into its own crate, which is why
// we need these two lines below. // we need these two lines below.
@@ -1216,22 +1216,19 @@ sp_api::impl_runtime_apis! {
impl pallet_offences_benchmarking::Trait for Runtime {} impl pallet_offences_benchmarking::Trait for Runtime {}
impl frame_system_benchmarking::Trait for Runtime {} impl frame_system_benchmarking::Trait for Runtime {}
let whitelist: Vec<Vec<u8>> = vec![ let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number // Block Number
// frame_system::Number::<Runtime>::hashed_key().to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec(),
// Total Issuance // Total Issuance
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec(), hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
// Execution Phase // Execution Phase
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
// Event Count // Event Count
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
// System Events // System Events
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
// Caller 0 Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec(),
// Treasury Account // Treasury Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
]; ];
let mut batches = Vec::<BenchmarkBatch>::new(); let mut batches = Vec::<BenchmarkBatch>::new();
+8 -11
View File
@@ -1345,7 +1345,7 @@ sp_api::impl_runtime_apis! {
repeat: u32, repeat: u32,
extra: bool, extra: bool,
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> { ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark}; use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
// Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues. // Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues.
// To get around that, we separated the Session benchmarks into its own crate, which is why // To get around that, we separated the Session benchmarks into its own crate, which is why
// we need these two lines below. // we need these two lines below.
@@ -1357,22 +1357,19 @@ sp_api::impl_runtime_apis! {
impl pallet_offences_benchmarking::Trait for Runtime {} impl pallet_offences_benchmarking::Trait for Runtime {}
impl frame_system_benchmarking::Trait for Runtime {} impl frame_system_benchmarking::Trait for Runtime {}
let whitelist: Vec<Vec<u8>> = vec![ let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number // Block Number
// frame_system::Number::<Runtime>::hashed_key().to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec(),
// Total Issuance // Total Issuance
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec(), hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
// Execution Phase // Execution Phase
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
// Event Count // Event Count
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
// System Events // System Events
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
// Caller 0 Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec(),
// Treasury Account // Treasury Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
]; ];
let mut batches = Vec::<BenchmarkBatch>::new(); let mut batches = Vec::<BenchmarkBatch>::new();
+8 -11
View File
@@ -1001,7 +1001,7 @@ sp_api::impl_runtime_apis! {
repeat: u32, repeat: u32,
extra: bool, extra: bool,
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> { ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark}; use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
// Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues. // Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues.
// To get around that, we separated the Session benchmarks into its own crate, which is why // To get around that, we separated the Session benchmarks into its own crate, which is why
// we need these two lines below. // we need these two lines below.
@@ -1013,22 +1013,19 @@ sp_api::impl_runtime_apis! {
impl pallet_offences_benchmarking::Trait for Runtime {} impl pallet_offences_benchmarking::Trait for Runtime {}
impl frame_system_benchmarking::Trait for Runtime {} impl frame_system_benchmarking::Trait for Runtime {}
let whitelist: Vec<Vec<u8>> = vec![ let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number // Block Number
// frame_system::Number::<Runtime>::hashed_key().to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec(),
// Total Issuance // Total Issuance
hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec(), hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),
// Execution Phase // Execution Phase
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),
// Event Count // Event Count
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),
// System Events // System Events
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),
// Caller 0 Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da946c154ffd9992e395af90b5b13cc6f295c77033fce8a9045824a6690bbf99c6db269502f0a8d1d2a008542d5690a0749").to_vec(),
// Treasury Account // Treasury Account
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec(), hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da95ecffd7b6c0f78751baa9d281e0bfa3a6d6f646c70792f74727372790000000000000000000000000000000000000000").to_vec().into(),
]; ];
let mut batches = Vec::<BenchmarkBatch>::new(); let mut batches = Vec::<BenchmarkBatch>::new();