From 4766fa11a3160b1208d930d8a60c4ddc035f0349 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 11:47:34 +0200 Subject: [PATCH 1/7] update api-client feature flags to remove unused jsonrpsee dependency. --- Cargo.lock | 216 ++---------------- cli/Cargo.toml | 3 +- .../node-api/api-client-extensions/Cargo.toml | 3 +- core-primitives/stf-executor/Cargo.toml | 5 - .../indirect-calls-executor/Cargo.toml | 4 - core/rpc-client/Cargo.toml | 3 +- service/Cargo.toml | 3 +- 7 files changed, 25 insertions(+), 212 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e592dfb01f..9d11d8ee7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -229,15 +229,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" -[[package]] -name = "async-lock" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" -dependencies = [ - "event-listener", -] - [[package]] name = "async-trait" version = "0.1.68" @@ -344,12 +335,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - [[package]] name = "base64ct" version = "1.6.0" @@ -1406,12 +1391,6 @@ dependencies = [ "uint", ] -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - [[package]] name = "evm" version = "0.37.0" @@ -2519,9 +2498,9 @@ dependencies = [ "hyper", "log 0.4.17", "rustls 0.19.1", - "rustls-native-certs 0.5.0", + "rustls-native-certs", "tokio", - "tokio-rustls 0.22.0", + "tokio-rustls", "webpki 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2790,7 +2769,7 @@ dependencies = [ "its-rpc-handler", "its-storage", "its-test", - "jsonrpsee 0.2.0", + "jsonrpsee", "lazy_static", "log 0.4.17", "mockall", @@ -3096,7 +3075,6 @@ dependencies = [ "sgx_types", "sp-core", "sp-runtime", - "substrate-api-client", "thiserror 1.0.40", "thiserror 1.0.9", ] @@ -3207,7 +3185,7 @@ dependencies = [ "its-rpc-handler", "its-storage", "its-test", - "jsonrpsee 0.2.0", + "jsonrpsee", "log 0.4.17", "parity-scale-codec", "serde_json 1.0.94", @@ -3590,7 +3568,6 @@ dependencies = [ "sgx_types", "sp-core", "sp-runtime", - "substrate-api-client", "thiserror 1.0.40", "thiserror 1.0.9", ] @@ -3956,7 +3933,7 @@ dependencies = [ "its-rpc-handler", "its-storage", "its-test", - "jsonrpsee 0.2.0", + "jsonrpsee", "log 0.4.17", "serde 1.0.158", "serde_json 1.0.94", @@ -4134,66 +4111,12 @@ dependencies = [ "jsonrpsee-http-client", "jsonrpsee-http-server", "jsonrpsee-proc-macros", - "jsonrpsee-types 0.2.0", + "jsonrpsee-types", "jsonrpsee-utils", "jsonrpsee-ws-client", "jsonrpsee-ws-server", ] -[[package]] -name = "jsonrpsee" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types 0.16.2", -] - -[[package]] -name = "jsonrpsee-client-transport" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" -dependencies = [ - "futures-util 0.3.27", - "http 0.2.9", - "jsonrpsee-core", - "jsonrpsee-types 0.16.2", - "pin-project", - "rustls-native-certs 0.6.2", - "soketto 0.7.1", - "thiserror 1.0.40", - "tokio", - "tokio-rustls 0.23.4", - "tokio-util 0.7.7", - "tracing", - "webpki-roots 0.22.6", -] - -[[package]] -name = "jsonrpsee-core" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" -dependencies = [ - "anyhow", - "async-lock", - "async-trait", - "beef", - "futures-channel 0.3.27", - "futures-timer", - "futures-util 0.3.27", - "jsonrpsee-types 0.16.2", - "rustc-hash", - "serde 1.0.158", - "serde_json 1.0.94", - "thiserror 1.0.40", - "tokio", - "tracing", -] - [[package]] name = "jsonrpsee-http-client" version = "0.2.0" @@ -4204,7 +4127,7 @@ dependencies = [ "fnv 1.0.7", "hyper", "hyper-rustls", - "jsonrpsee-types 0.2.0", + "jsonrpsee-types", "jsonrpsee-utils", "log 0.4.17", "serde 1.0.158", @@ -4223,7 +4146,7 @@ dependencies = [ "futures-util 0.3.27", "globset", "hyper", - "jsonrpsee-types 0.2.0", + "jsonrpsee-types", "jsonrpsee-utils", "lazy_static", "log 0.4.17", @@ -4262,24 +4185,10 @@ dependencies = [ "log 0.4.17", "serde 1.0.158", "serde_json 1.0.94", - "soketto 0.5.0", + "soketto", "thiserror 1.0.40", ] -[[package]] -name = "jsonrpsee-types" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" -dependencies = [ - "anyhow", - "beef", - "serde 1.0.158", - "serde_json 1.0.94", - "thiserror 1.0.40", - "tracing", -] - [[package]] name = "jsonrpsee-utils" version = "0.2.0" @@ -4289,7 +4198,7 @@ dependencies = [ "futures-channel 0.3.27", "futures-util 0.3.27", "hyper", - "jsonrpsee-types 0.2.0", + "jsonrpsee-types", "log 0.4.17", "parking_lot 0.11.2", "rand 0.8.5", @@ -4308,17 +4217,17 @@ dependencies = [ "async-trait", "fnv 1.0.7", "futures 0.3.27", - "jsonrpsee-types 0.2.0", + "jsonrpsee-types", "log 0.4.17", "pin-project", "rustls 0.19.1", - "rustls-native-certs 0.5.0", + "rustls-native-certs", "serde 1.0.158", "serde_json 1.0.94", - "soketto 0.5.0", + "soketto", "thiserror 1.0.40", "tokio", - "tokio-rustls 0.22.0", + "tokio-rustls", "tokio-util 0.6.10", "url 2.3.1", ] @@ -4331,13 +4240,13 @@ checksum = "b512c3c679a89d20f97802f69188a2d01f6234491b7513076e21e8424efccafe" dependencies = [ "futures-channel 0.3.27", "futures-util 0.3.27", - "jsonrpsee-types 0.2.0", + "jsonrpsee-types", "jsonrpsee-utils", "log 0.4.17", "rustc-hash", "serde 1.0.158", "serde_json 1.0.94", - "soketto 0.5.0", + "soketto", "thiserror 1.0.40", "tokio", "tokio-stream", @@ -6682,18 +6591,6 @@ dependencies = [ "webpki 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log 0.4.17", - "ring 0.16.20 (registry+https://github.com/rust-lang/crates.io-index)", - "sct 0.7.0", - "webpki 0.22.0", -] - [[package]] name = "rustls-native-certs" version = "0.5.0" @@ -6706,18 +6603,6 @@ dependencies = [ "security-framework", ] -[[package]] -name = "rustls-native-certs" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.2", - "schannel", - "security-framework", -] - [[package]] name = "rustls-pemfile" version = "0.2.1" @@ -6727,15 +6612,6 @@ dependencies = [ "base64 0.13.1", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" -dependencies = [ - "base64 0.21.0", -] - [[package]] name = "rustversion" version = "1.0.12" @@ -6898,16 +6774,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring 0.16.20 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted", -] - [[package]] name = "sec1" version = "0.3.0" @@ -7516,21 +7382,6 @@ dependencies = [ "sha-1 0.9.8", ] -[[package]] -name = "soketto" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" -dependencies = [ - "base64 0.13.1", - "bytes 1.4.0", - "futures 0.3.27", - "httparse 1.8.0", - "log 0.4.17", - "rand 0.8.5", - "sha-1 0.9.8", -] - [[package]] name = "sp-api" version = "4.0.0-dev" @@ -8215,9 +8066,7 @@ dependencies = [ "derive_more", "frame-metadata 15.1.0", "frame-support", - "futures 0.3.27", "hex", - "jsonrpsee 0.16.2", "log 0.4.17", "parity-scale-codec", "serde 1.0.158", @@ -8566,17 +8415,6 @@ dependencies = [ "webpki 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls 0.20.8", - "tokio", - "webpki 0.22.0", -] - [[package]] name = "tokio-stream" version = "0.1.12" @@ -8623,7 +8461,6 @@ checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes 1.4.0", "futures-core 0.3.27", - "futures-io 0.3.27", "futures-sink 0.3.27", "pin-project-lite", "tokio", @@ -9089,7 +8926,7 @@ dependencies = [ "multipart", "percent-encoding 2.2.0", "pin-project", - "rustls-pemfile 0.2.1", + "rustls-pemfile", "scoped-tls", "serde 1.0.158", "serde_json 1.0.94", @@ -9477,16 +9314,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring 0.16.20 (registry+https://github.com/rust-lang/crates.io-index)", - "untrusted", -] - [[package]] name = "webpki-roots" version = "0.21.0" @@ -9514,15 +9341,6 @@ dependencies = [ "webpki 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki 0.22.0", -] - [[package]] name = "wide" version = "0.7.8" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 7c4065a7fd..49181dde7d 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -28,7 +28,8 @@ ws = { version = "0.9.1", features = ["ssl"] } my-node-runtime = { package = "integritee-node-runtime", git = "https://github.com/integritee-network/integritee-node.git", branch = "polkadot-v0.9.39" } pallet-evm = { optional = true, git = "https://github.com/integritee-network/frontier.git", branch = "polkadot-v0.9.39" } pallet-teerex = { git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.39" } -substrate-api-client = { features = ["ws-client"], git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } +# `default-features = false` to remove the jsonrpsee dependency. +substrate-api-client = { default-features = false, features = ["std", "ws-client"], git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } substrate-client-keystore = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } teerex-primitives = { git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.39" } diff --git a/core-primitives/node-api/api-client-extensions/Cargo.toml b/core-primitives/node-api/api-client-extensions/Cargo.toml index 27e4c4eea4..8514d29317 100644 --- a/core-primitives/node-api/api-client-extensions/Cargo.toml +++ b/core-primitives/node-api/api-client-extensions/Cargo.toml @@ -15,7 +15,8 @@ sp-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", bra sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } # scs -substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } +# `default-features = false` to remove the jsonrpsee dependency. +substrate-api-client = { default-features = false, features = ["std"], git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } # local deps itp-api-client-types = { path = "../api-client-types" } diff --git a/core-primitives/stf-executor/Cargo.toml b/core-primitives/stf-executor/Cargo.toml index a1af492e19..43baf31659 100644 --- a/core-primitives/stf-executor/Cargo.toml +++ b/core-primitives/stf-executor/Cargo.toml @@ -25,9 +25,6 @@ itp-time-utils = { path = "../time-utils", default-features = false } itp-top-pool-author = { path = "../top-pool-author", default-features = false } itp-types = { path = "../types", default-features = false } -# scs -substrate-api-client = { default-features = false, git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } - # sgx enabled external libraries thiserror_sgx = { optional = true, package = "thiserror", git = "https://github.com/mesalock-linux/thiserror-sgx", tag = "sgx_1.1.3" } @@ -69,8 +66,6 @@ std = [ # crates.io "log/std", "codec/std", - # scs - "substrate-api-client/std", # substrate "sp-core/std", "sp-runtime/std", diff --git a/core/parentchain/indirect-calls-executor/Cargo.toml b/core/parentchain/indirect-calls-executor/Cargo.toml index dea5905ffa..c91a908b5e 100644 --- a/core/parentchain/indirect-calls-executor/Cargo.toml +++ b/core/parentchain/indirect-calls-executor/Cargo.toml @@ -37,9 +37,6 @@ binary-merkle-tree = { default-features = false, git = "https://github.com/parit sp-core = { default-features = false, features = ["full_crypto"], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.39" } -# scs/integritee -substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39", default-features = false } - [dev-dependencies] env_logger = "0.9.0" itp-node-api = { path = "../../../core-primitives/node-api", features = ["mocks"] } @@ -67,7 +64,6 @@ std = [ "binary-merkle-tree/std", "sp-core/std", "sp-runtime/std", - "substrate-api-client/std", "thiserror", ] sgx = [ diff --git a/core/rpc-client/Cargo.toml b/core/rpc-client/Cargo.toml index b3e42adf80..0e06364115 100644 --- a/core/rpc-client/Cargo.toml +++ b/core/rpc-client/Cargo.toml @@ -13,7 +13,8 @@ parking_lot = "0.12.1" serde_derive = "1.0" serde_json = "1.0" sgx_crypto_helper = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git" } -substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } +# `default-features = false` to remove the jsonrpsee dependency. +substrate-api-client = { default-features = false, features = ["std", "ws-client"], git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } thiserror = { version = "1.0" } url = { version = "2.0.0" } ws = { version = "0.9.1", features = ["ssl"] } diff --git a/service/Cargo.toml b/service/Cargo.toml index 381f2238d0..1da4b473c4 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -60,7 +60,8 @@ its-storage = { path = "../sidechain/storage" } my-node-runtime = { package = "integritee-node-runtime", git = "https://github.com/integritee-network/integritee-node.git", branch = "polkadot-v0.9.39" } sgx-verify = { git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.39" } -substrate-api-client = { git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } +# `default-features = false` to remove the jsonrpsee dependency. +substrate-api-client = { default-features = false, features = ["std", "ws-client"], git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } teerex-primitives = { git = "https://github.com/integritee-network/pallets.git", branch = "polkadot-v0.9.39" } # Substrate dependencies From fe8551485abdf56f9b1d922187348c7e9595fd64 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 11:50:23 +0200 Subject: [PATCH 2/7] update enclave Cargo.lock --- enclave-runtime/Cargo.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/enclave-runtime/Cargo.lock b/enclave-runtime/Cargo.lock index acbfd039c6..81b139b537 100644 --- a/enclave-runtime/Cargo.lock +++ b/enclave-runtime/Cargo.lock @@ -1693,7 +1693,6 @@ dependencies = [ "sgx_types", "sp-core", "sp-runtime", - "substrate-api-client", "thiserror 1.0.9", ] @@ -2049,7 +2048,6 @@ dependencies = [ "sgx_types", "sp-core", "sp-runtime", - "substrate-api-client", "thiserror 1.0.9", ] @@ -4605,7 +4603,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "digest 0.10.6", "static_assertions", ] From d1762bdd55cb47e6653bb40a78901437bd1f7492 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 14:23:43 +0200 Subject: [PATCH 3/7] [itp-api-client-types] re-export extrinsic params trait. --- core-primitives/node-api/api-client-types/src/lib.rs | 4 ++-- core/parentchain/indirect-calls-executor/src/executor.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core-primitives/node-api/api-client-types/src/lib.rs b/core-primitives/node-api/api-client-types/src/lib.rs index fa3335e27b..3e7ad4f94b 100644 --- a/core-primitives/node-api/api-client-types/src/lib.rs +++ b/core-primitives/node-api/api-client-types/src/lib.rs @@ -26,8 +26,8 @@ pub use itp_types::parentchain::{ AccountId, Address, Balance, Hash, Index, Signature as PairSignature, }; pub use substrate_api_client::{ - AssetTip, CallIndex, GenericAdditionalParams, GenericExtrinsicParams, GenericSignedExtra, - PlainTip, StaticExtrinsicSigner, UncheckedExtrinsicV4, + AssetTip, CallIndex, ExtrinsicParams, GenericAdditionalParams, GenericExtrinsicParams, + GenericSignedExtra, PlainTip, StaticExtrinsicSigner, UncheckedExtrinsicV4, }; pub type ParentchainPlainTip = PlainTip; diff --git a/core/parentchain/indirect-calls-executor/src/executor.rs b/core/parentchain/indirect-calls-executor/src/executor.rs index 84bd294d2c..e449210310 100644 --- a/core/parentchain/indirect-calls-executor/src/executor.rs +++ b/core/parentchain/indirect-calls-executor/src/executor.rs @@ -235,7 +235,8 @@ mod test { use itc_parentchain_test::parentchain_block_builder::ParentchainBlockBuilder; use itp_node_api::{ api_client::{ - ParentchainAdditionalParams, ParentchainExtrinsicParams, ParentchainUncheckedExtrinsic, + ExtrinsicParams, ParentchainAdditionalParams, ParentchainExtrinsicParams, + ParentchainUncheckedExtrinsic, }, metadata::{metadata_mocks::NodeMetadataMock, provider::NodeMetadataRepository}, }; @@ -250,7 +251,6 @@ mod test { use sp_core::{ed25519, Pair}; use sp_runtime::{MultiSignature, OpaqueExtrinsic}; use std::assert_matches::assert_matches; - use substrate_api_client::ExtrinsicParams; type TestShieldingKeyRepo = KeyRepositoryMock; type TestStfEnclaveSigner = StfEnclaveSignerMock; From 75d7565666c2b4c8d5693f8c64e26719ce50e04c Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 14:31:02 +0200 Subject: [PATCH 4/7] [itp-node-api-metadata] use Metadata from itp-api-client-types instead of from api-client --- Cargo.lock | 2 +- core-primitives/node-api/api-client-types/src/lib.rs | 3 ++- core-primitives/node-api/metadata/Cargo.toml | 8 ++++---- core-primitives/node-api/metadata/src/error.rs | 2 +- core-primitives/node-api/metadata/src/lib.rs | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9d11d8ee7b..680706d5dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3424,9 +3424,9 @@ name = "itp-node-api-metadata" version = "0.9.0" dependencies = [ "derive_more", + "itp-api-client-types", "parity-scale-codec", "sp-core", - "substrate-api-client", ] [[package]] diff --git a/core-primitives/node-api/api-client-types/src/lib.rs b/core-primitives/node-api/api-client-types/src/lib.rs index 3e7ad4f94b..84393ea95f 100644 --- a/core-primitives/node-api/api-client-types/src/lib.rs +++ b/core-primitives/node-api/api-client-types/src/lib.rs @@ -27,7 +27,8 @@ pub use itp_types::parentchain::{ }; pub use substrate_api_client::{ AssetTip, CallIndex, ExtrinsicParams, GenericAdditionalParams, GenericExtrinsicParams, - GenericSignedExtra, PlainTip, StaticExtrinsicSigner, UncheckedExtrinsicV4, + GenericSignedExtra, Metadata, MetadataError, PlainTip, StaticExtrinsicSigner, + UncheckedExtrinsicV4, }; pub type ParentchainPlainTip = PlainTip; diff --git a/core-primitives/node-api/metadata/Cargo.toml b/core-primitives/node-api/metadata/Cargo.toml index 84d39d7f28..3798a5ac47 100644 --- a/core-primitives/node-api/metadata/Cargo.toml +++ b/core-primitives/node-api/metadata/Cargo.toml @@ -9,18 +9,18 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } derive_more = { version = "0.99.5" } +# local +itp-api-client-types = { default-features = false, path = "../api-client-types" } + # substrate sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.39" } -# scs -substrate-api-client = { default-features = false, git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } - [features] default = ["std"] std = [ "codec/std", + "itp-api-client-types/std", "sp-core/std", - "substrate-api-client/std", ] # used for unit testing only! diff --git a/core-primitives/node-api/metadata/src/error.rs b/core-primitives/node-api/metadata/src/error.rs index e4418555f0..660dbb2346 100644 --- a/core-primitives/node-api/metadata/src/error.rs +++ b/core-primitives/node-api/metadata/src/error.rs @@ -21,7 +21,7 @@ pub enum Error { /// Metadata has not been set MetadataNotSet, /// Api-client metadata error - NodeMetadata(substrate_api_client::MetadataError), + NodeMetadata(itp_api_client_types::MetadataError), } pub type Result = core::result::Result; diff --git a/core-primitives/node-api/metadata/src/lib.rs b/core-primitives/node-api/metadata/src/lib.rs index 98470e62e3..f63c496c15 100644 --- a/core-primitives/node-api/metadata/src/lib.rs +++ b/core-primitives/node-api/metadata/src/lib.rs @@ -23,8 +23,8 @@ use crate::{ error::Result, pallet_sidechain::SidechainCallIndexes, pallet_teerex::TeerexCallIndexes, }; use codec::{Decode, Encode}; +use itp_api_client_types::{Metadata, MetadataError}; use sp_core::storage::StorageKey; -use substrate_api_client::{Metadata, MetadataError}; pub use crate::error::Error; From 673eb0284b3fb56405ee6c36f704748b6792df05 Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 14:33:42 +0200 Subject: [PATCH 5/7] [enclave-runtime] remove unnecessary dependency on the substrate-api-client --- enclave-runtime/Cargo.lock | 3 +-- enclave-runtime/Cargo.toml | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/enclave-runtime/Cargo.lock b/enclave-runtime/Cargo.lock index 81b139b537..f63461dfcd 100644 --- a/enclave-runtime/Cargo.lock +++ b/enclave-runtime/Cargo.lock @@ -742,7 +742,6 @@ dependencies = [ "sp-core", "sp-runtime", "sp-std", - "substrate-api-client", "webpki", ] @@ -1909,9 +1908,9 @@ name = "itp-node-api-metadata" version = "0.9.0" dependencies = [ "derive_more", + "itp-api-client-types", "parity-scale-codec", "sp-core", - "substrate-api-client", ] [[package]] diff --git a/enclave-runtime/Cargo.toml b/enclave-runtime/Cargo.toml index 5f9f3f1319..3d0b3eb6c6 100644 --- a/enclave-runtime/Cargo.toml +++ b/enclave-runtime/Cargo.toml @@ -70,7 +70,6 @@ primitive-types = { version = "0.12.1", default-features = false, features = ["c # scs / integritee jsonrpc-core = { default-features = false, git = "https://github.com/scs/jsonrpc", branch = "no_std_v18" } -substrate-api-client = { default-features = false, git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } # mesalock env_logger = { git = "https://github.com/integritee-network/env_logger-sgx" } From 0a00581c4579bfe87bb45ac5e81b38120be1b0aa Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 14:39:19 +0200 Subject: [PATCH 6/7] [itc-rpc-client] uses now the types from itp-api-client-types --- Cargo.lock | 2 +- core-primitives/node-api/api-client-types/src/lib.rs | 4 ++-- core/rpc-client/Cargo.toml | 4 +--- core/rpc-client/src/direct_client.rs | 2 +- core/rpc-client/src/error.rs | 2 +- core/rpc-client/src/mock.rs | 2 +- core/rpc-client/src/ws_client.rs | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 680706d5dc..fe45180763 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3153,6 +3153,7 @@ dependencies = [ "env_logger 0.9.3", "frame-metadata 15.1.0", "itc-tls-websocket-server", + "itp-api-client-types", "itp-networking-utils", "itp-rpc", "itp-types", @@ -3165,7 +3166,6 @@ dependencies = [ "serde_derive 1.0.158", "serde_json 1.0.94", "sgx_crypto_helper", - "substrate-api-client", "thiserror 1.0.40", "url 2.3.1", "ws", diff --git a/core-primitives/node-api/api-client-types/src/lib.rs b/core-primitives/node-api/api-client-types/src/lib.rs index 84393ea95f..94de5c87e8 100644 --- a/core-primitives/node-api/api-client-types/src/lib.rs +++ b/core-primitives/node-api/api-client-types/src/lib.rs @@ -27,8 +27,8 @@ pub use itp_types::parentchain::{ }; pub use substrate_api_client::{ AssetTip, CallIndex, ExtrinsicParams, GenericAdditionalParams, GenericExtrinsicParams, - GenericSignedExtra, Metadata, MetadataError, PlainTip, StaticExtrinsicSigner, - UncheckedExtrinsicV4, + GenericSignedExtra, InvalidMetadataError, Metadata, MetadataError, PlainTip, + StaticExtrinsicSigner, UncheckedExtrinsicV4, }; pub type ParentchainPlainTip = PlainTip; diff --git a/core/rpc-client/Cargo.toml b/core/rpc-client/Cargo.toml index 0e06364115..8b17a26e60 100644 --- a/core/rpc-client/Cargo.toml +++ b/core/rpc-client/Cargo.toml @@ -13,8 +13,6 @@ parking_lot = "0.12.1" serde_derive = "1.0" serde_json = "1.0" sgx_crypto_helper = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git" } -# `default-features = false` to remove the jsonrpsee dependency. -substrate-api-client = { default-features = false, features = ["std", "ws-client"], git = "https://github.com/scs/substrate-api-client.git", branch = "polkadot-v0.9.39" } thiserror = { version = "1.0" } url = { version = "2.0.0" } ws = { version = "0.9.1", features = ["ssl"] } @@ -22,8 +20,8 @@ ws = { version = "0.9.1", features = ["ssl"] } # parity frame-metadata = { git = "https://github.com/paritytech/frame-metadata", features = ["v14"] } - # local +itp-api-client-types = { path = "../../core-primitives/node-api/api-client-types" } itp-rpc = { path = "../../core-primitives/rpc" } itp-types = { path = "../../core-primitives/types" } itp-utils = { path = "../../core-primitives/utils" } diff --git a/core/rpc-client/src/direct_client.rs b/core/rpc-client/src/direct_client.rs index 281e592f5c..c473a0cdfb 100644 --- a/core/rpc-client/src/direct_client.rs +++ b/core/rpc-client/src/direct_client.rs @@ -20,6 +20,7 @@ use crate::ws_client::{WsClient, WsClientControl}; use codec::Decode; use frame_metadata::RuntimeMetadataPrefixed; +use itp_api_client_types::Metadata; use itp_rpc::{RpcRequest, RpcResponse, RpcReturnValue}; use itp_types::DirectRequestStatus; use itp_utils::FromHexPrefixed; @@ -33,7 +34,6 @@ use std::{ thread, thread::JoinHandle, }; -use substrate_api_client::metadata::Metadata; pub use crate::error::{Error, Result}; diff --git a/core/rpc-client/src/error.rs b/core/rpc-client/src/error.rs index 5f4d0d5d1d..f5ef6541c8 100644 --- a/core/rpc-client/src/error.rs +++ b/core/rpc-client/src/error.rs @@ -15,9 +15,9 @@ */ use codec::Error as CodecError; +use itp_api_client_types::InvalidMetadataError; use serde_json::Error as JsonError; use std::{boxed::Box, sync::mpsc::RecvError}; -use substrate_api_client::metadata::InvalidMetadataError; use thiserror; use ws::Error as WsClientError; diff --git a/core/rpc-client/src/mock.rs b/core/rpc-client/src/mock.rs index c66c311071..dd4c7d6b80 100644 --- a/core/rpc-client/src/mock.rs +++ b/core/rpc-client/src/mock.rs @@ -20,9 +20,9 @@ use crate::{direct_client::DirectApi, error::Result}; use codec::Decode; use frame_metadata::RuntimeMetadataPrefixed; +use itp_api_client_types::Metadata; use sgx_crypto_helper::rsa3072::Rsa3072PubKey; use std::{sync::mpsc::Sender as MpscSender, thread::JoinHandle}; -use substrate_api_client::Metadata; #[derive(Clone, Default)] pub struct DirectClientMock { diff --git a/core/rpc-client/src/ws_client.rs b/core/rpc-client/src/ws_client.rs index 6e5b3d34b0..690adc1686 100644 --- a/core/rpc-client/src/ws_client.rs +++ b/core/rpc-client/src/ws_client.rs @@ -15,11 +15,11 @@ */ -use crate::error::{Error, Result as RpcClientResult}; ///! Websocket client implementation to access the direct-rpc-server running inside an enclave. /// /// This should be replaced with the `jsonrpsee::WsClient`as soon as available in no-std: /// https://github.com/paritytech/jsonrpsee/issues/1 +use crate::error::{Error, Result as RpcClientResult}; use log::*; use openssl::ssl::{SslConnector, SslMethod, SslStream, SslVerifyMode}; use parking_lot::Mutex; From 2d7ad50417be7380749760cf5b8948cdd777f9cd Mon Sep 17 00:00:00 2001 From: Christian Langenbacher Date: Wed, 5 Apr 2023 14:50:19 +0200 Subject: [PATCH 7/7] [enclave-runtime] fix api-client dependencies in tests. --- core-primitives/node-api/api-client-types/src/lib.rs | 6 +++--- enclave-runtime/src/test/on_chain_ocall_tests.rs | 2 +- enclave-runtime/src/test/top_pool_tests.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core-primitives/node-api/api-client-types/src/lib.rs b/core-primitives/node-api/api-client-types/src/lib.rs index 94de5c87e8..834514cac1 100644 --- a/core-primitives/node-api/api-client-types/src/lib.rs +++ b/core-primitives/node-api/api-client-types/src/lib.rs @@ -26,9 +26,9 @@ pub use itp_types::parentchain::{ AccountId, Address, Balance, Hash, Index, Signature as PairSignature, }; pub use substrate_api_client::{ - AssetTip, CallIndex, ExtrinsicParams, GenericAdditionalParams, GenericExtrinsicParams, - GenericSignedExtra, InvalidMetadataError, Metadata, MetadataError, PlainTip, - StaticExtrinsicSigner, UncheckedExtrinsicV4, + storage_key, AssetTip, CallIndex, ExtrinsicParams, GenericAdditionalParams, + GenericExtrinsicParams, GenericSignedExtra, InvalidMetadataError, Metadata, MetadataError, + PlainTip, StaticExtrinsicSigner, UncheckedExtrinsicV4, }; pub type ParentchainPlainTip = PlainTip; diff --git a/enclave-runtime/src/test/on_chain_ocall_tests.rs b/enclave-runtime/src/test/on_chain_ocall_tests.rs index 782674eb72..bd5ad1156b 100644 --- a/enclave-runtime/src/test/on_chain_ocall_tests.rs +++ b/enclave-runtime/src/test/on_chain_ocall_tests.rs @@ -17,11 +17,11 @@ */ use crate::ocall::OcallApi; +use itp_node_api::api_client::storage_key; use itp_ocall_api::EnclaveOnChainOCallApi; use itp_types::{WorkerRequest, WorkerResponse}; use log::*; use std::vec::Vec; -use substrate_api_client::storage_key; #[allow(unused)] fn test_ocall_worker_request() { diff --git a/enclave-runtime/src/test/top_pool_tests.rs b/enclave-runtime/src/test/top_pool_tests.rs index 0e325dba4f..bf49804d63 100644 --- a/enclave-runtime/src/test/top_pool_tests.rs +++ b/enclave-runtime/src/test/top_pool_tests.rs @@ -44,7 +44,8 @@ use itc_parentchain_test::{ }; use itp_node_api::{ api_client::{ - ParentchainAdditionalParams, ParentchainExtrinsicParams, ParentchainUncheckedExtrinsic, + ExtrinsicParams, ParentchainAdditionalParams, ParentchainExtrinsicParams, + ParentchainUncheckedExtrinsic, }, metadata::{ metadata_mocks::NodeMetadataMock, pallet_teerex::TeerexCallIndexes, @@ -64,7 +65,6 @@ use sgx_crypto_helper::RsaKeyPair; use sp_core::{ed25519, Pair}; use sp_runtime::{MultiSignature, OpaqueExtrinsic}; use std::{sync::Arc, vec::Vec}; -use substrate_api_client::ExtrinsicParams; pub fn process_indirect_call_in_top_pool() { let _ = env_logger::builder().is_test(true).try_init();