Merge branch 'master' into gav-storage-root-verify

This commit is contained in:
Gav
2018-01-30 20:57:33 +01:00
31 changed files with 2689 additions and 154 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ impl error::Error for Void {
/// In-memory backend. Fully recomputes tries on each commit but useful for
/// tests.
#[derive(Default)]
#[derive(Default, Clone)]
pub struct InMemory {
inner: MemoryState, // keeps all the state in memory.
}
@@ -82,7 +82,7 @@ impl InMemory {
impl Backend for InMemory {
type Error = Void;
fn storage(&self, key: &[u8]) -> Result<&[u8], Void> {
fn storage(&self, key: &[u8]) -> Result<&[u8], Self::Error> {
Ok(self.inner.storage(key).unwrap_or(&[]))
}
+2 -2
View File
@@ -48,7 +48,7 @@ pub enum Update {
}
// in-memory section of the state.
#[derive(Default)]
#[derive(Default, Clone)]
struct MemoryState {
storage: HashMap<Vec<u8>, Vec<u8>>,
}
@@ -160,7 +160,7 @@ pub trait Externalities {
}
/// Code execution engine.
pub trait CodeExecutor: Sized {
pub trait CodeExecutor: Sized + Send + Sync {
/// Externalities error type.
type Error: Error;