diff --git a/Cargo.toml b/Cargo.toml index b7cd6ca276..0d212a1cd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,5 @@ members = [ "macro", "subxt", "test-runtime", - # TODO(niklasad1): remove to separate repo - "client" ] +exclude = ["client"] diff --git a/client/Cargo.toml b/client/Cargo.toml index f65193e37e..a9ca4e830e 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -22,23 +22,28 @@ log = "0.4.13" thiserror = "1.0.23" serde_json = "1" -sc-client-db = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sp-keyring = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "master" } -sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" } +sc-client-db = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } +sp-keyring = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } +sc-network = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } +sc-service = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } tokio = { version = "1.16", features = ["rt-multi-thread"] } [target.'cfg(target_arch="x86_64")'.dependencies] -sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false, features = [ - "wasmtime", -] } +sc-service = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0", features = ["wasmtime"] } [dev-dependencies] async-std = { version = "1.8.0", features = ["attributes"] } env_logger = "0.9" tracing-subscriber = { version = "0.3.3", features = ["env-filter"] } -node-cli = { git = "https://github.com/paritytech/substrate.git", branch = "master", default-features = false } +node-cli = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0", default-features = false } tempdir = "0.3.7" subxt = { path = "../subxt" } +# TODO(niklasad1): we should probably generate some other runtime because of the +# tag i.e. not "master". test-runtime = { path = "../test-runtime" } + +[patch.crates-io] +sp-core = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } +sp-runtime = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } +sp-version = { git = "https://github.com/paritytech/substrate.git", tag = "publish-sp-version-v4.0.0" } diff --git a/client/src/lib.rs b/client/src/lib.rs index 76091ab851..4e5b21eb6b 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -35,6 +35,7 @@ use jsonrpsee::core::{ async_trait, client::{ Client as JsonRpcClient, + ClientBuilder as JsonRpcClientBuilder, TransportReceiverT, TransportSenderT, }, @@ -153,7 +154,9 @@ impl SubxtClient { impl From for JsonRpcClient { fn from(client: SubxtClient) -> Self { - (client.sender, client.receiver).into() + JsonRpcClientBuilder::default() + .request_timeout(std::time::Duration::from_secs(5 * 60)) + .build(client.sender, client.receiver) } } diff --git a/client/src/tests.rs b/client/src/tests.rs index 218c99be5e..4cb86e0f0c 100644 --- a/client/src/tests.rs +++ b/client/src/tests.rs @@ -31,6 +31,7 @@ use subxt::{ DefaultExtra }; use tempdir::TempDir; +use test_runtime::node_runtime::{self, system}; #[async_std::test] pub async fn test_embedded_client() { @@ -56,7 +57,7 @@ pub async fn test_embedded_client() { chain_spec: node_cli::chain_spec::development_config(), role: Role::Authority(AccountKeyring::Alice), telemetry: None, - wasm_method: WasmExecutionMethod::Compiled, + wasm_method: WasmExecutionMethod::Interpreted, tokio_handle: tokio::runtime::Handle::current(), }; @@ -75,7 +76,7 @@ pub async fn test_embedded_client() { .await .unwrap(); - let api: test_runtime::node_runtime::RuntimeApi> = ext_client.clone().to_runtime_api(); + let api: node_runtime::RuntimeApi> = ext_client.clone().to_runtime_api(); // verify that we can read storage api.storage() @@ -88,7 +89,7 @@ pub async fn test_embedded_client() { let bob_address = AccountKeyring::Bob.to_account_id().into(); // verify that we can call dispatchable functions - let events = api + let success = api .tx() .balances() .transfer(bob_address, 100_000) @@ -97,10 +98,10 @@ pub async fn test_embedded_client() { .unwrap() .wait_for_finalized_success() .await + .unwrap() + .has_event::() .unwrap(); - panic!("{:?}", events); - // verify that we receive events - // assert!(success); + assert!(success); }