Make genesis state locally-available on light client (#1622)

* make genesis state available on light client

* RemoteOrLocalCallExecutor

* code_is_executed_locally_or_remotely

* OnDemandOrGenesisState tests

* some comments
This commit is contained in:
Svyatoslav Nikolsky
2019-02-01 12:27:54 +03:00
committed by Gav Wood
parent 5d82cf243e
commit 381cf26f55
8 changed files with 510 additions and 79 deletions
+13 -5
View File
@@ -199,12 +199,20 @@ pub mod tests {
Err(ClientErrorKind::Backend("Test error".into()).into())
}
fn number(&self, _hash: Hash) -> ClientResult<Option<NumberFor<Block>>> {
Err(ClientErrorKind::Backend("Test error".into()).into())
fn number(&self, hash: Hash) -> ClientResult<Option<NumberFor<Block>>> {
if hash == Default::default() {
Ok(Some(Default::default()))
} else {
Err(ClientErrorKind::Backend("Test error".into()).into())
}
}
fn hash(&self, _number: u64) -> ClientResult<Option<Hash>> {
Err(ClientErrorKind::Backend("Test error".into()).into())
fn hash(&self, number: u64) -> ClientResult<Option<Hash>> {
if number == 0 {
Ok(Some(Default::default()))
} else {
Err(ClientErrorKind::Backend("Test error".into()).into())
}
}
}
@@ -235,7 +243,7 @@ pub mod tests {
_state: NewBlockState,
_aux_ops: Vec<(Vec<u8>, Option<Vec<u8>>)>,
) -> ClientResult<()> {
Err(ClientErrorKind::Backend("Test error".into()).into())
Ok(())
}
fn finalize_header(&self, _block: BlockId<Block>) -> ClientResult<()> {