Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

favor imports from api-client-types crate & fix api-client features; remove unused jsonrpsee dependency #1271

Merged
merged 7 commits into from
Apr 6, 2023
220 changes: 19 additions & 201 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
3 changes: 2 additions & 1 deletion core-primitives/node-api/api-client-extensions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
3 changes: 2 additions & 1 deletion core-primitives/node-api/api-client-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +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,
storage_key, AssetTip, CallIndex, ExtrinsicParams, GenericAdditionalParams,
GenericExtrinsicParams, GenericSignedExtra, InvalidMetadataError, Metadata, MetadataError,
PlainTip, StaticExtrinsicSigner, UncheckedExtrinsicV4,
};

Expand Down
8 changes: 4 additions & 4 deletions core-primitives/node-api/metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion core-primitives/node-api/metadata/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> = core::result::Result<T, Error>;
2 changes: 1 addition & 1 deletion core-primitives/node-api/metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 0 additions & 5 deletions core-primitives/stf-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down Expand Up @@ -69,8 +66,6 @@ std = [
# crates.io
"log/std",
"codec/std",
# scs
"substrate-api-client/std",
# substrate
"sp-core/std",
"sp-runtime/std",
Expand Down
4 changes: 0 additions & 4 deletions core/parentchain/indirect-calls-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down Expand Up @@ -67,7 +64,6 @@ std = [
"binary-merkle-tree/std",
"sp-core/std",
"sp-runtime/std",
"substrate-api-client/std",
"thiserror",
]
sgx = [
Expand Down
4 changes: 2 additions & 2 deletions core/parentchain/indirect-calls-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand All @@ -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<ShieldingCryptoMock>;
type TestStfEnclaveSigner = StfEnclaveSignerMock;
Expand Down
3 changes: 1 addition & 2 deletions core/rpc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@ 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" }
thiserror = { version = "1.0" }
url = { version = "2.0.0" }
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" }
Expand Down
2 changes: 1 addition & 1 deletion core/rpc-client/src/direct_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,7 +34,6 @@ use std::{
thread,
thread::JoinHandle,
};
use substrate_api_client::metadata::Metadata;

pub use crate::error::{Error, Result};

Expand Down
2 changes: 1 addition & 1 deletion core/rpc-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion core/rpc-client/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion core/rpc-client/src/ws_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions enclave-runtime/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,6 @@ dependencies = [
"sp-core",
"sp-runtime",
"sp-std",
"substrate-api-client",
"webpki",
]

Expand Down Expand Up @@ -1693,7 +1692,6 @@ dependencies = [
"sgx_types",
"sp-core",
"sp-runtime",
"substrate-api-client",
"thiserror 1.0.9",
]

Expand Down Expand Up @@ -1910,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]]
Expand Down Expand Up @@ -2049,7 +2047,6 @@ dependencies = [
"sgx_types",
"sp-core",
"sp-runtime",
"substrate-api-client",
"thiserror 1.0.9",
]

Expand Down Expand Up @@ -4605,7 +4602,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",
]
Expand Down
1 change: 0 additions & 1 deletion enclave-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion enclave-runtime/src/test/on_chain_ocall_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions enclave-runtime/src/test/top_pool_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down