Do not include :code in the storage proof if not required (#480)

This is basically a hack that prevents the inclusion of `:code` in the
storage proof. A proper fix requires some changes to the trie crate to
not include nodes that aren't read.
This commit is contained in:
Bastian Köcher
2021-06-07 16:17:19 +02:00
committed by GitHub
parent 33908c1414
commit 794bc23de4
10 changed files with 59 additions and 8 deletions
@@ -442,7 +442,7 @@ construct_runtime! {
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned} = 20,
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
+1 -1
View File
@@ -226,7 +226,7 @@ construct_runtime! {
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>, ValidateUnsigned},
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>, ValidateUnsigned},
ParachainInfo: parachain_info::{Pallet, Storage, Config},
// DMP handler.
+5
View File
@@ -178,6 +178,7 @@ fn testnet_genesis(
authorities: initial_authorities,
},
cumulus_pallet_aura_ext: Default::default(),
cumulus_pallet_parachain_system: Default::default(),
}
}
@@ -190,6 +191,7 @@ fn shell_testnet_genesis(parachain_id: ParaId) -> shell_runtime::GenesisConfig {
changes_trie_config: Default::default(),
},
parachain_info: shell_runtime::ParachainInfoConfig { parachain_id },
cumulus_pallet_parachain_system: Default::default(),
}
}
@@ -366,6 +368,7 @@ fn statemint_genesis(
// of this.
pallet_aura: Default::default(),
cumulus_pallet_aura_ext: Default::default(),
cumulus_pallet_parachain_system: Default::default(),
}
}
@@ -540,6 +543,7 @@ fn statemine_genesis(
},
pallet_aura: Default::default(),
cumulus_pallet_aura_ext: Default::default(),
cumulus_pallet_parachain_system: Default::default(),
}
}
@@ -722,5 +726,6 @@ fn westmint_genesis(
// of this.
pallet_aura: Default::default(),
cumulus_pallet_aura_ext: Default::default(),
cumulus_pallet_parachain_system: Default::default(),
}
}
@@ -672,7 +672,7 @@ construct_runtime!(
{
// System support stuff.
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 1,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>} = 1,
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
@@ -734,8 +734,17 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
OnRuntimeUpgrade,
>;
pub struct OnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for OnRuntimeUpgrade {
fn on_runtime_upgrade() -> u64 {
sp_io::storage::set(b":c", &[]);
RocksDbWeight::get().writes(1)
}
}
impl_runtime_apis! {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {
@@ -615,7 +615,7 @@ construct_runtime!(
{
// System support stuff.
System: frame_system::{Pallet, Call, Config, Storage, Event<T>} = 0,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 1,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>} = 1,
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage} = 2,
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3,
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4,
@@ -605,7 +605,7 @@ construct_runtime!(
{
// System support stuff;
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>},
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Config, Storage, Inherent, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
ParachainInfo: parachain_info::{Pallet, Storage, Config},
@@ -665,8 +665,17 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
OnRuntimeUpgrade
>;
pub struct OnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for OnRuntimeUpgrade {
fn on_runtime_upgrade() -> u64 {
sp_io::storage::set(b":c", &[]);
RocksDbWeight::get().writes(1)
}
}
impl_runtime_apis! {
impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
fn slot_duration() -> sp_consensus_aura::SlotDuration {