Clean up random seed to make a bit more flexible (#2456)

* Reformulate random seed to be more random

- First 80 random values come from cycling the incomplete series (
  instead of filling with zeroes)
- Calculate random material each usage (use a single amalgamated
  ring buffer to store them for avoiding 81 lookups each time)
- Mutate inputs by hashing each with:
  - its index (into the 81)
  - an additional "subject" key provided by caller

This keeps the final output low-influence while still allowing
it to be used as the seed to independent contexts. (Hashing the
result to give the final seed is no better than using parent_hash).

* Docs

* Bump runtime

* Update notes

* Remove feature(alloc)

* Update srml/system/src/lib.rs

Co-Authored-By: gavofyork <github@gavwood.com>
This commit is contained in:
Gavin Wood
2019-05-06 13:57:30 +02:00
committed by Sergei Pepyakin
parent b42e37589e
commit adba89913e
13 changed files with 61 additions and 36 deletions
-1
View File
@@ -1,7 +1,6 @@
#![no_std]
#![cfg_attr(feature = "strict", deny(warnings))]
#![feature(alloc)]
extern crate alloc;
use alloc::vec::Vec;
use alloc::slice;
@@ -17,7 +17,6 @@
//! Primitives for GRANDPA integration, suitable for WASM compilation.
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#[cfg(not(feature = "std"))]
extern crate alloc;
-1
View File
@@ -19,7 +19,6 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
/// Initialize a key-value collection from array.
///
-1
View File
@@ -22,7 +22,6 @@
#![cfg_attr(not(feature = "std"), feature(lang_items))]
#![cfg_attr(not(feature = "std"), feature(alloc_error_handler))]
#![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#![cfg_attr(feature = "std", doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")]
#![cfg_attr(not(feature = "std"), doc = "Substrate's runtime standard library as compiled without Rust's standard library.")]
-1
View File
@@ -37,7 +37,6 @@
#![warn(missing_docs)]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
#![cfg_attr(not(feature = "std"), feature(alloc))]
use rstd::prelude::*;
-1
View File
@@ -19,7 +19,6 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
#![cfg_attr(not(feature = "std"), feature(alloc))]
#![cfg_attr(feature = "std", doc = "Substrate runtime standard library as compiled when linked with Rust's standard library.")]
#![cfg_attr(not(feature = "std"), doc = "Substrate's runtime standard library as compiled without Rust's standard library.")]
-1
View File
@@ -17,7 +17,6 @@
//! Utility functions to interact with Substrate's Base-16 Modified Merkle Patricia tree ("trie").
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(not(feature = "std"), feature(alloc))]
mod error;
mod node_header;