Don't include :code by default in storage proofs (#5179)

* Don't include `:code` by default in storage proofs (#5060)

* Adds test to verify that the runtime currently is always contained in
the proof

* Start passing the runtime wasm code from the outside

* Fix compilation

* More build fixes

* Make the test work as expected now :)

* Last fixes

* Fixes benchmarks

* Review feedback

* Apply suggestions from code review

Co-Authored-By: Sergei Pepyakin <sergei@parity.io>

* Review feedback

* Fix compilation

Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>

* Fix compilation and change the way `RuntimeCode` works

* Fix tests

* Switch to `Cow`

Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
This commit is contained in:
Bastian Köcher
2020-03-10 11:13:20 +01:00
committed by GitHub
parent 0cc3b96076
commit 1cfcf5cbfe
39 changed files with 597 additions and 363 deletions
@@ -25,7 +25,10 @@ use serde::{Deserialize, Serialize};
use sp_std::prelude::*;
use sp_core::RuntimeDebug;
use crate::codec::{Codec, Encode, Decode};
use crate::traits::{self, Member, Block as BlockT, Header as HeaderT, MaybeSerialize, MaybeMallocSizeOf};
use crate::traits::{
self, Member, Block as BlockT, Header as HeaderT, MaybeSerialize, MaybeMallocSizeOf,
NumberFor,
};
use crate::Justification;
/// Something to identify a block.
@@ -35,9 +38,9 @@ use crate::Justification;
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub enum BlockId<Block: BlockT> {
/// Identify by block header hash.
Hash(<<Block as BlockT>::Header as HeaderT>::Hash),
Hash(Block::Hash),
/// Identify by block number.
Number(<<Block as BlockT>::Header as HeaderT>::Number),
Number(NumberFor<Block>),
}
impl<Block: BlockT> BlockId<Block> {
@@ -47,7 +50,7 @@ impl<Block: BlockT> BlockId<Block> {
}
/// Create a block ID from a number.
pub fn number(number: <Block::Header as HeaderT>::Number) -> Self {
pub fn number(number: NumberFor<Block>) -> Self {
BlockId::Number(number)
}
}