From a87c17e9da2c5e55eb5ba281e68b64b2536faf4e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Jun 2020 07:46:30 +0100 Subject: [PATCH 1/8] Upgrade to substrate rc4 release --- Cargo.toml | 24 +++++++++---------- client/Cargo.toml | 6 ++--- proc-macro/Cargo.toml | 2 +- test-node/Cargo.toml | 40 +++++++++++++++---------------- test-node/runtime/Cargo.toml | 46 ++++++++++++++++++------------------ test-node/runtime/src/lib.rs | 2 ++ 6 files changed, 61 insertions(+), 59 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 68164b77dc..3df339da23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,16 +30,16 @@ serde_json = "1.0.55" url = "2.1.1" codec = { package = "parity-scale-codec", version = "1.3", default-features = false, features = ["derive", "full"] } -frame-metadata = { version = "11.0.0-rc3", package = "frame-metadata" } -frame-support = { version = "2.0.0-rc3", package = "frame-support" } -sp-runtime = { version = "2.0.0-rc3", package = "sp-runtime" } -sp-version = { version = "2.0.0-rc3", package = "sp-version" } -pallet-indices = { version = "2.0.0-rc3", package = "pallet-indices" } +frame-metadata = { version = "11.0.0-rc4", package = "frame-metadata" } +frame-support = { version = "2.0.0-rc4", package = "frame-support" } +sp-runtime = { version = "2.0.0-rc4", package = "sp-runtime" } +sp-version = { version = "2.0.0-rc4", package = "sp-version" } +pallet-indices = { version = "2.0.0-rc4", package = "pallet-indices" } hex = "0.4.2" -sp-rpc = { version = "2.0.0-rc3", package = "sp-rpc" } -sp-core = { version = "2.0.0-rc3", package = "sp-core" } -sc-rpc-api = { version = "0.8.0-rc3", package = "sc-rpc-api" } -sp-transaction-pool = { version = "2.0.0-rc3", package = "sp-transaction-pool" } +sp-rpc = { version = "2.0.0-rc4", package = "sp-rpc" } +sp-core = { version = "2.0.0-rc4", package = "sp-core" } +sc-rpc-api = { version = "0.8.0-rc4", package = "sc-rpc-api" } +sp-transaction-pool = { version = "2.0.0-rc4", package = "sp-transaction-pool" } substrate-subxt-client = { version = "0.1.0", path = "client", optional = true } substrate-subxt-proc-macro = { version = "0.9.0", path = "proc-macro" } @@ -47,9 +47,9 @@ substrate-subxt-proc-macro = { version = "0.9.0", path = "proc-macro" } async-std = { version = "=1.5.0", features = ["attributes"] } env_logger = "0.7.1" wabt = "0.9.2" -frame-system = { version = "2.0.0-rc3", package = "frame-system" } -pallet-balances = { version = "2.0.0-rc3", package = "pallet-balances" } -sp-keyring = { version = "2.0.0-rc3", package = "sp-keyring" } +frame-system = { version = "2.0.0-rc4", package = "frame-system" } +pallet-balances = { version = "2.0.0-rc4", package = "pallet-balances" } +sp-keyring = { version = "2.0.0-rc4", package = "sp-keyring" } substrate-subxt-client = { version = "0.1.0", path = "client" } tempdir = "0.3.7" test-node = { path = "test-node" } diff --git a/client/Cargo.toml b/client/Cargo.toml index 821cced7a7..3e6fefed4a 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -17,10 +17,10 @@ futures = { version = "0.3.5", features = ["compat"] } futures01 = { package = "futures", version = "0.1.29" } jsonrpsee = "0.1.0" log = "0.4.8" -sc-network = { version = "0.8.0-rc3", default-features = false } -sc-service = { version = "0.8.0-rc3", default-features = false } +sc-network = { version = "0.8.0-rc4", default-features = false } +sc-service = { version = "0.8.0-rc4", default-features = false } serde_json = "1.0.55" -sp-keyring = "2.0.0-rc3" +sp-keyring = "2.0.0-rc4" thiserror = "1.0.20" [dev-dependencies] diff --git a/proc-macro/Cargo.toml b/proc-macro/Cargo.toml index 0a6d6d983a..cfd6a07b50 100644 --- a/proc-macro/Cargo.toml +++ b/proc-macro/Cargo.toml @@ -28,7 +28,7 @@ async-std = { version = "=1.5.0", features = ["attributes"] } codec = { package = "parity-scale-codec", version = "1.3.0", features = ["derive"] } env_logger = "0.7.1" pretty_assertions = "0.6.1" -sp-keyring = "2.0.0-rc3" +sp-keyring = "2.0.0-rc4" substrate-subxt = { path = ".." } trybuild = "1.0.30" diff --git a/test-node/Cargo.toml b/test-node/Cargo.toml index 9691a2053d..e286e01eec 100644 --- a/test-node/Cargo.toml +++ b/test-node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test-node" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Anonymous"] description = "Substrate Node template" edition = "2018" @@ -18,25 +18,25 @@ log = "0.4.8" structopt = "0.3.15" parking_lot = "0.11.0" -sc-cli = { version = "0.8.0-rc3", features = ["wasmtime"] } -sp-core = "2.0.0-rc3" -sc-executor = { version = "0.8.0-rc3", features = ["wasmtime"] } -sc-service = { version = "0.8.0-rc3", features = ["wasmtime"] } -sp-inherents = "2.0.0-rc3" -sc-transaction-pool = "2.0.0-rc3" -sp-transaction-pool = "2.0.0-rc3" -sc-network = "0.8.0-rc3" -sc-consensus-aura = "0.8.0-rc3" -sp-consensus-aura = "0.8.0-rc3" -sp-consensus = "0.8.0-rc3" -sc-consensus = "0.8.0-rc3" -sc-finality-grandpa = "0.8.0-rc3" -sp-finality-grandpa = "2.0.0-rc3" -sc-client-api = "2.0.0-rc3" -sp-runtime = "2.0.0-rc3" -sc-basic-authorship = "0.8.0-rc3" +sc-cli = { version = "0.8.0-rc4", features = ["wasmtime"] } +sp-core = "2.0.0-rc4" +sc-executor = { version = "0.8.0-rc4", features = ["wasmtime"] } +sc-service = { version = "0.8.0-rc4", features = ["wasmtime"] } +sp-inherents = "2.0.0-rc4" +sc-transaction-pool = "2.0.0-rc4" +sp-transaction-pool = "2.0.0-rc4" +sc-network = "0.8.0-rc4" +sc-consensus-aura = "0.8.0-rc4" +sp-consensus-aura = "0.8.0-rc4" +sp-consensus = "0.8.0-rc4" +sc-consensus = "0.8.0-rc4" +sc-finality-grandpa = "0.8.0-rc4" +sp-finality-grandpa = "2.0.0-rc4" +sc-client-api = "2.0.0-rc4" +sp-runtime = "2.0.0-rc4" +sc-basic-authorship = "0.8.0-rc4" -test-node-runtime = { version = "2.0.0-rc3", path = "runtime" } +test-node-runtime = { version = "2.0.0-rc4", path = "runtime" } [build-dependencies] -substrate-build-script-utils = "2.0.0-rc3" +substrate-build-script-utils = "2.0.0-rc4" diff --git a/test-node/runtime/Cargo.toml b/test-node/runtime/Cargo.toml index f5c3a9e6fc..99009a7003 100644 --- a/test-node/runtime/Cargo.toml +++ b/test-node/runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "test-node-runtime" -version = "2.0.0-rc3" +version = "2.0.0-rc4" authors = ["Anonymous"] edition = "2018" license = "Unlicense" @@ -13,29 +13,29 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "1.3.1", default-features = false, features = ["derive"] } -aura = { version = "2.0.0-rc3", default-features = false, package = "pallet-aura" } -balances = { version = "2.0.0-rc3", default-features = false, package = "pallet-balances" } -frame-support = { version = "2.0.0-rc3", default-features = false } -grandpa = { version = "2.0.0-rc3", default-features = false, package = "pallet-grandpa" } -randomness-collective-flip = { version = "2.0.0-rc3", default-features = false, package = "pallet-randomness-collective-flip" } -sudo = { version = "2.0.0-rc3", default-features = false, package = "pallet-sudo" } -system = { version = "2.0.0-rc3", default-features = false, package = "frame-system" } -timestamp = { version = "2.0.0-rc3", default-features = false, package = "pallet-timestamp" } -transaction-payment = { version = "2.0.0-rc3", default-features = false, package = "pallet-transaction-payment" } -frame-executive = { version = "2.0.0-rc3", default-features = false } +aura = { version = "2.0.0-rc4", default-features = false, package = "pallet-aura" } +balances = { version = "2.0.0-rc4", default-features = false, package = "pallet-balances" } +frame-support = { version = "2.0.0-rc4", default-features = false } +grandpa = { version = "2.0.0-rc4", default-features = false, package = "pallet-grandpa" } +randomness-collective-flip = { version = "2.0.0-rc4", default-features = false, package = "pallet-randomness-collective-flip" } +sudo = { version = "2.0.0-rc4", default-features = false, package = "pallet-sudo" } +system = { version = "2.0.0-rc4", default-features = false, package = "frame-system" } +timestamp = { version = "2.0.0-rc4", default-features = false, package = "pallet-timestamp" } +transaction-payment = { version = "2.0.0-rc4", default-features = false, package = "pallet-transaction-payment" } +frame-executive = { version = "2.0.0-rc4", default-features = false } serde = { version = "1.0.114", optional = true, features = ["derive"] } -sp-api = { version = "2.0.0-rc3", default-features = false } -sp-block-builder = { default-features = false, version = "2.0.0-rc3" } -sp-consensus-aura = { version = "0.8.0-rc3", default-features = false } -sp-core = { version = "2.0.0-rc3", default-features = false } -sp-inherents = { default-features = false, version = "2.0.0-rc3" } -sp-io = { version = "2.0.0-rc3", default-features = false } -sp-offchain = { version = "2.0.0-rc3", default-features = false } -sp-runtime = { version = "2.0.0-rc3", default-features = false } -sp-session = { version = "2.0.0-rc3", default-features = false } -sp-std = { version = "2.0.0-rc3", default-features = false } -sp-transaction-pool = { version = "2.0.0-rc3", default-features = false } -sp-version = { version = "2.0.0-rc3", default-features = false } +sp-api = { version = "2.0.0-rc4", default-features = false } +sp-block-builder = { default-features = false, version = "2.0.0-rc4" } +sp-consensus-aura = { version = "0.8.0-rc4", default-features = false } +sp-core = { version = "2.0.0-rc4", default-features = false } +sp-inherents = { default-features = false, version = "2.0.0-rc4" } +sp-io = { version = "2.0.0-rc4", default-features = false } +sp-offchain = { version = "2.0.0-rc4", default-features = false } +sp-runtime = { version = "2.0.0-rc4", default-features = false } +sp-session = { version = "2.0.0-rc4", default-features = false } +sp-std = { version = "2.0.0-rc4", default-features = false } +sp-transaction-pool = { version = "2.0.0-rc4", default-features = false } +sp-version = { version = "2.0.0-rc4", default-features = false } [build-dependencies] wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner" } diff --git a/test-node/runtime/src/lib.rs b/test-node/runtime/src/lib.rs index 140aabdbdf..23858fa174 100644 --- a/test-node/runtime/src/lib.rs +++ b/test-node/runtime/src/lib.rs @@ -181,6 +181,8 @@ parameter_types! { } impl system::Trait for Runtime { + /// The basic call filter to use in dispatchable. + type BaseCallFilter = (); /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. From 69c3d1de85c5dbee1d8a8aaee58c3f6260d5aad5 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Jun 2020 08:11:20 +0100 Subject: [PATCH 2/8] Fix up test-node/service --- test-node/src/service.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test-node/src/service.rs b/test-node/src/service.rs index 599f149f66..7a3880f094 100644 --- a/test-node/src/service.rs +++ b/test-node/src/service.rs @@ -145,7 +145,7 @@ pub fn new_full(config: Configuration) -> Result>; Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) })? - .build()?; + .build_full()?; if role.is_authority() { let proposer = sc_basic_authorship::ProposerFactory::new( @@ -177,19 +177,19 @@ pub fn new_full(config: Configuration) -> Result Result Result>; Ok(Arc::new(GrandpaFinalityProofProvider::new(backend, provider)) as _) })? - .build() + .build_light() } From b6814db524e33095d70629c473dc27d7999a851c Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Jun 2020 08:11:38 +0100 Subject: [PATCH 3/8] Fix up client node config --- client/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index a5176b0607..dafcdff90b 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -208,12 +208,12 @@ fn start_subxt_client( impl_version: config.impl_version, chain_spec: Box::new(config.chain_spec), role: config.role.into(), - task_executor: std::sync::Arc::new(move |fut, ty| { + task_executor: (move |fut, ty| { match ty { TaskType::Async => task::spawn(fut), TaskType::Blocking => task::spawn_blocking(|| task::block_on(fut)), }; - }), + }).into(), database: config.db, keystore: KeystoreConfig::InMemory, max_runtime_instances: 8, @@ -231,6 +231,7 @@ fn start_subxt_client( pruning: Default::default(), rpc_cors: Default::default(), rpc_http: Default::default(), + rpc_ipc: Default::default(), rpc_ws: Default::default(), rpc_ws_max_connections: Default::default(), rpc_methods: Default::default(), @@ -240,6 +241,8 @@ fn start_subxt_client( tracing_targets: Default::default(), transaction_pool: Default::default(), wasm_method: Default::default(), + base_path: Default::default(), + informant_output_format: Default::default(), }; log::info!("{}", service_config.impl_name); @@ -329,6 +332,7 @@ mod tests { test_node::chain_spec::ChainSpec::from_json_bytes(bytes).unwrap(); let tmp = TempDir::new("subxt-").expect("failed to create tempdir"); let config = SubxtClientConfig { + // base_path: impl_name: "substrate-subxt-light-client", impl_version: "0.0.1", author: "David Craven", From f40c8bfa3d402bc665a332598e1ba6cdfdc61f8d Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Jun 2020 08:19:45 +0100 Subject: [PATCH 4/8] Fix up remaining compilation errors --- src/frame/system.rs | 3 ++- src/lib.rs | 2 +- src/rpc.rs | 25 +++++++------------------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/frame/system.rs b/src/frame/system.rs index bc1b8297ff..b6ae0626bd 100644 --- a/src/frame/system.rs +++ b/src/frame/system.rs @@ -30,6 +30,7 @@ use serde::de::DeserializeOwned; use sp_runtime::{ traits::{ AtLeast32Bit, + AtLeast32BitUnsigned, Bounded, CheckEqual, Extrinsic, @@ -67,7 +68,7 @@ pub trait System { + MaybeSerializeDeserialize + Debug + MaybeDisplay - + AtLeast32Bit + + AtLeast32BitUnsigned + Default + Bounded + Copy diff --git a/src/lib.rs b/src/lib.rs index 689851488d..aed74958d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -244,7 +244,7 @@ impl Client { /// Get a block hash. By default returns the latest block hash pub async fn block_hash( &self, - block_number: Option>, + block_number: Option, ) -> Result, Error> { let hash = self.rpc.block_hash(block_number).await?; Ok(hash) diff --git a/src/rpc.rs b/src/rpc.rs index 3663b07177..95e176ae32 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -37,7 +37,6 @@ use jsonrpsee::{ }, Client, }; -use num_traits::bounds::Bounded; use sc_rpc_api::state::ReadProof; use serde::Serialize; use sp_core::{ @@ -83,23 +82,15 @@ pub type ChainBlock = /// Wrapper for NumberOrHex to allow custom From impls #[derive(Serialize)] -#[serde(bound = "::BlockNumber: Serialize")] -pub struct BlockNumber(NumberOrHex<::BlockNumber>); - -impl From::BlockNumber>> for BlockNumber -where - T: System, -{ - fn from(x: NumberOrHex<::BlockNumber>) -> Self { +pub struct BlockNumber(NumberOrHex); + +impl From for BlockNumber { + fn from(x: NumberOrHex) -> Self { BlockNumber(x) } } -impl From for BlockNumber -where - T: System, - ::BlockNumber: From, -{ +impl From for BlockNumber { fn from(x: u32) -> Self { NumberOrHex::Number(x.into()).into() } @@ -160,9 +151,7 @@ impl Rpc { /// Fetch the genesis hash pub async fn genesis_hash(&self) -> Result { - let block_zero = Some(ListOrValue::Value(NumberOrHex::Number( - T::BlockNumber::min_value(), - ))); + let block_zero = Some(ListOrValue::Value(NumberOrHex::Number(0))); let params = Params::Array(vec![to_json_value(block_zero)?]); let list_or_value: ListOrValue> = self.client.request("chain_getBlockHash", params).await?; @@ -198,7 +187,7 @@ impl Rpc { /// Get a block hash, returns hash of latest block by default pub async fn block_hash( &self, - block_number: Option>, + block_number: Option, ) -> Result, Error> { let block_number = block_number.map(ListOrValue::Value); let params = Params::Array(vec![to_json_value(block_number)?]); From fb5c0ec3ca64627ffebd018cf8f4df1434009d13 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Fri, 26 Jun 2020 08:23:09 +0100 Subject: [PATCH 5/8] Fmt --- client/src/lib.rs | 3 ++- test-node/src/service.rs | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index dafcdff90b..ee76bbab3b 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -213,7 +213,8 @@ fn start_subxt_client( TaskType::Async => task::spawn(fut), TaskType::Blocking => task::spawn_blocking(|| task::block_on(fut)), }; - }).into(), + }) + .into(), database: config.db, keystore: KeystoreConfig::InMemory, max_runtime_instances: 8, diff --git a/test-node/src/service.rs b/test-node/src/service.rs index 7a3880f094..09bce82832 100644 --- a/test-node/src/service.rs +++ b/test-node/src/service.rs @@ -177,7 +177,9 @@ pub fn new_full(config: Configuration) -> Result Result Date: Fri, 26 Jun 2020 08:27:35 +0100 Subject: [PATCH 6/8] Remove fixme --- test-node/src/service.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/test-node/src/service.rs b/test-node/src/service.rs index 09bce82832..5aba8d00bb 100644 --- a/test-node/src/service.rs +++ b/test-node/src/service.rs @@ -191,7 +191,6 @@ pub fn new_full(config: Configuration) -> Result Date: Mon, 29 Jun 2020 08:31:56 +0100 Subject: [PATCH 7/8] Fix test --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index ae28b402d2..bce4734da3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -578,7 +578,7 @@ mod tests { // create raw payload with AccoundId and sign it let raw_payload = client - .create_unsigned( + .create_payload( balances::TransferCall { to: &dest, amount: 10_000, From e38ccd78b244659957e4ceb10b58be12dc415644 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Mon, 29 Jun 2020 09:10:05 +0100 Subject: [PATCH 8/8] Release v0.10.0 --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da102618d8..c7840dde94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Version 0.10.0 (2020-06-19) + +* Upgrade to substrate rc4 release [#131](https://github.com/paritytech/substrate-subxt/pull/131) +* Support unsigned extrinsics. [#130](https://github.com/paritytech/substrate-subxt/pull/130) + # Version 0.9.0 (2020-06-25) * Events sub [#126](https://github.com/paritytech/substrate-subxt/pull/126) diff --git a/Cargo.toml b/Cargo.toml index 3df339da23..7feb4655b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [".", "client", "proc-macro", "test-node"] [package] name = "substrate-subxt" -version = "0.9.0" +version = "0.10.0" authors = ["Parity Technologies "] edition = "2018"