WIP: Update Substrate & Polkadot (#496)

* WIP: Update Substrate

* Update Substrate & Polkadot

* fixes

* more fixes

* few missing origins

* use spawn_essential_handle

* bump polkadot dep

* remove newlines

* fix test

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Sergei Shulepov
2021-06-17 08:37:03 +01:00
committed by GitHub
parent f45c55be3b
commit 1f3458a0e3
20 changed files with 494 additions and 477 deletions
@@ -19,7 +19,7 @@
use frame_support::traits::{ExecuteBlock, ExtrinsicCall, IsSubType, Get};
use sp_runtime::traits::{Block as BlockT, Extrinsic, HashFor, Header as HeaderT, NumberFor};
use sp_io::KillChildStorageResult;
use sp_io::KillStorageResult;
use sp_std::prelude::*;
use polkadot_parachain::primitives::{HeadData, ValidationParams, ValidationResult};
@@ -220,8 +220,14 @@ fn host_storage_root() -> Vec<u8> {
with_externalities(|ext| ext.storage_root())
}
fn host_storage_clear_prefix(prefix: &[u8]) {
with_externalities(|ext| ext.clear_prefix(prefix))
fn host_storage_clear_prefix(prefix: &[u8], limit: Option<u32>) -> KillStorageResult {
with_externalities(|ext| {
let (all_removed, num_removed) = ext.clear_prefix(prefix, limit);
match all_removed {
true => KillStorageResult::AllRemoved(num_removed),
false => KillStorageResult::SomeRemaining(num_removed),
}
})
}
fn host_storage_changes_root(parent_hash: &[u8]) -> Option<Vec<u8>> {
@@ -289,13 +295,13 @@ fn host_default_child_storage_clear(storage_key: &[u8], key: &[u8]) {
fn host_default_child_storage_storage_kill(
storage_key: &[u8],
limit: Option<u32>,
) -> KillChildStorageResult {
) -> KillStorageResult {
let child_info = ChildInfo::new_default(storage_key);
with_externalities(|ext| {
let (all_removed, num_removed) = ext.kill_child_storage(&child_info, limit);
match all_removed {
true => KillChildStorageResult::AllRemoved(num_removed),
false => KillChildStorageResult::SomeRemaining(num_removed),
true => KillStorageResult::AllRemoved(num_removed),
false => KillStorageResult::SomeRemaining(num_removed),
}
})
}
@@ -305,9 +311,15 @@ fn host_default_child_storage_exists(storage_key: &[u8], key: &[u8]) -> bool {
with_externalities(|ext| ext.exists_child_storage(&child_info, key))
}
fn host_default_child_storage_clear_prefix(storage_key: &[u8], prefix: &[u8]) {
fn host_default_child_storage_clear_prefix(storage_key: &[u8], prefix: &[u8], limit: Option<u32>) -> KillStorageResult {
let child_info = ChildInfo::new_default(storage_key);
with_externalities(|ext| ext.clear_child_prefix(&child_info, prefix))
with_externalities(|ext| {
let (all_removed, num_removed) = ext.clear_child_prefix(&child_info, prefix, limit);
match all_removed {
true => KillStorageResult::AllRemoved(num_removed),
false => KillStorageResult::SomeRemaining(num_removed),
}
})
}
fn host_default_child_storage_root(storage_key: &[u8]) -> Vec<u8> {