Networking and in-memory client (#38)

* Networking crate draft

* Started work on syncing algo

* Fixed query range

* BlockCollection tests

* In-mem client backend

* Fixed tests

* Renamed Transaction

* Removed stray println

* Docs
This commit is contained in:
Arkadiy Paronyan
2018-01-30 18:49:52 +01:00
committed by Robert Habermeier
parent 8e554129ec
commit 44499550d9
31 changed files with 2689 additions and 154 deletions
+7 -5
View File
@@ -18,14 +18,15 @@ use super::*;
use polkadot_executor as executor;
use self::error::{Error, ErrorKind};
use test_helpers::Blockchain;
use client;
#[test]
fn should_return_storage() {
let client = Client::new(Blockchain::default(), executor::executor());
let client = client::new_in_mem(executor::executor()).unwrap();
let genesis_hash = "11265ce45dd2baaaf071f6df8c5a44f0ed1d85a50e71451ff2d4345e57d12e3a".into();
assert_matches!(
StateApi::storage(&client, StorageKey(vec![10]), 0.into()),
StateApi::storage(&client, StorageKey(vec![10]), genesis_hash),
Ok(ref x) if x.0.is_empty()
)
}
@@ -34,10 +35,11 @@ fn should_return_storage() {
#[ignore] // TODO: [ToDr] reenable once we can properly mock the wasm executor env
fn should_call_contract() {
// TODO [ToDr] Fix test after we are able to mock state.
let client = Client::new(Blockchain::default(), executor::executor());
let client = client::new_in_mem(executor::executor()).unwrap();
let genesis_hash = "11265ce45dd2baaaf071f6df8c5a44f0ed1d85a50e71451ff2d4345e57d12e3a".into();
assert_matches!(
StateApi::call(&client, "balanceOf".into(), CallData(vec![1,2,3]), 0.into()),
StateApi::call(&client, "balanceOf".into(), CallData(vec![1,2,3]), genesis_hash),
Err(Error(ErrorKind::Client(client::error::ErrorKind::Execution(_)), _))
)
}