From 98e4af41b66304869803096d9774012a05bcc3d8 Mon Sep 17 00:00:00 2001 From: Xiliang Chen Date: Tue, 3 Oct 2023 13:29:08 +1300 Subject: [PATCH] update orml and fix clippy (#2626) --- Cargo.lock | 125 ++------------------------- Cargo.toml | 7 +- node/service/Cargo.toml | 2 - node/service/src/client.rs | 7 +- orml | 2 +- runtime/acala/Cargo.toml | 8 +- runtime/acala/src/lib.rs | 4 +- runtime/acala/src/xcm_config.rs | 4 +- runtime/integration-tests/Cargo.toml | 2 +- runtime/karura/Cargo.toml | 8 +- runtime/karura/src/lib.rs | 4 +- runtime/mandala/Cargo.toml | 8 +- runtime/mandala/src/lib.rs | 4 +- 13 files changed, 34 insertions(+), 151 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de7c8139c3..c2d473668f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -171,11 +171,11 @@ dependencies = [ "orml-benchmarking", "orml-nft", "orml-oracle", - "orml-oracle-rpc-runtime-api", + "orml-oracle-runtime-api", "orml-parameters", "orml-rewards", "orml-tokens", - "orml-tokens-rpc-runtime-api", + "orml-tokens-runtime-api", "orml-traits", "orml-unknown-tokens", "orml-utilities", @@ -267,8 +267,6 @@ dependencies = [ "karura-runtime", "log", "mandala-runtime", - "orml-oracle-rpc", - "orml-tokens-rpc", "pallet-transaction-payment-rpc-runtime-api", "parity-scale-codec", "polkadot-cli", @@ -4008,10 +4006,6 @@ name = "futures-timer" version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" -dependencies = [ - "gloo-timers", - "send_wrapper", -] [[package]] name = "futures-util" @@ -4151,51 +4145,6 @@ dependencies = [ "regex", ] -[[package]] -name = "gloo-net" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9902a044653b26b99f7e3693a42f171312d9be8b26b5697bd1e43ad1f8a35e10" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "gloo-utils", - "js-sys", - "pin-project", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gloo-utils" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "group" version = "0.12.1" @@ -4798,13 +4747,11 @@ version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "367a292944c07385839818bb71c8d76611138e2dedb0677d035b8da21d29c78b" dependencies = [ - "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-http-client", "jsonrpsee-proc-macros", "jsonrpsee-server", "jsonrpsee-types", - "jsonrpsee-wasm-client", "jsonrpsee-ws-client", "tracing", ] @@ -4815,11 +4762,7 @@ version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8b3815d9f5d5de348e5f162b316dc9cdf4548305ebb15b4eb9328e66cf27d7a" dependencies = [ - "anyhow", - "futures-channel", - "futures-timer", "futures-util", - "gloo-net", "http", "jsonrpsee-core", "jsonrpsee-types", @@ -4860,7 +4803,6 @@ dependencies = [ "thiserror", "tokio", "tracing", - "wasm-bindgen-futures", ] [[package]] @@ -4931,17 +4873,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "jsonrpsee-wasm-client" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5df77c8f625d36e4cfb583c5a674eccebe32403fcfe42f7ceff7fac9324dd" -dependencies = [ - "jsonrpsee-client-transport", - "jsonrpsee-core", - "jsonrpsee-types", -] - [[package]] name = "jsonrpsee-ws-client" version = "0.16.3" @@ -5037,11 +4968,11 @@ dependencies = [ "orml-benchmarking", "orml-nft", "orml-oracle", - "orml-oracle-rpc-runtime-api", + "orml-oracle-runtime-api", "orml-parameters", "orml-rewards", "orml-tokens", - "orml-tokens-rpc-runtime-api", + "orml-tokens-runtime-api", "orml-traits", "orml-unknown-tokens", "orml-utilities", @@ -6029,12 +5960,12 @@ dependencies = [ "orml-benchmarking", "orml-nft", "orml-oracle", - "orml-oracle-rpc-runtime-api", + "orml-oracle-runtime-api", "orml-parameters", "orml-payments", "orml-rewards", "orml-tokens", - "orml-tokens-rpc-runtime-api", + "orml-tokens-runtime-api", "orml-traits", "orml-unknown-tokens", "orml-utilities", @@ -7681,21 +7612,7 @@ dependencies = [ ] [[package]] -name = "orml-oracle-rpc" -version = "0.4.1-dev" -dependencies = [ - "jsonrpsee", - "orml-oracle-rpc-runtime-api", - "parity-scale-codec", - "sp-api", - "sp-blockchain", - "sp-runtime", - "tracing", - "tracing-core", -] - -[[package]] -name = "orml-oracle-rpc-runtime-api" +name = "orml-oracle-runtime-api" version = "0.4.1-dev" dependencies = [ "parity-scale-codec", @@ -7774,28 +7691,10 @@ dependencies = [ ] [[package]] -name = "orml-tokens-rpc" +name = "orml-tokens-runtime-api" version = "0.4.1-dev" dependencies = [ "frame-support", - "jsonrpsee", - "orml-tokens-rpc-runtime-api", - "parity-scale-codec", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", - "tracing", - "tracing-core", -] - -[[package]] -name = "orml-tokens-rpc-runtime-api" -version = "0.4.1-dev" -dependencies = [ - "frame-support", - "orml-tokens", "parity-scale-codec", "sp-api", "sp-runtime", @@ -11634,7 +11533,7 @@ dependencies = [ "orml-benchmarking", "orml-nft", "orml-oracle", - "orml-oracle-rpc-runtime-api", + "orml-oracle-runtime-api", "orml-rewards", "orml-tokens", "orml-traits", @@ -13221,12 +13120,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -[[package]] -name = "send_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" - [[package]] name = "serde" version = "1.0.188" diff --git a/Cargo.toml b/Cargo.toml index eed755157a..68d25fe993 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,12 +27,10 @@ members = [ "orml/gradually-update", "orml/nft", "orml/oracle", - "orml/oracle/rpc", "orml/parameters", "orml/rewards", "orml/tokens", - "orml/tokens/rpc", - "orml/tokens/rpc/runtime-api", + "orml/tokens/runtime-api", "orml/traits", "orml/unknown-tokens", "orml/utilities", @@ -40,7 +38,7 @@ members = [ "orml/xcm-support", "orml/xcm", "orml/xtokens", - "orml/oracle/rpc/runtime-api", + "orml/oracle/runtime-api", "ecosystem-modules/stable-asset/lib/stable-asset", "evm-tests/jsontests", @@ -94,7 +92,6 @@ hmac = { opt-level = 3 } httparse = { opt-level = 3 } integer-sqrt = { opt-level = 3 } keccak = { opt-level = 3 } -libm = { opt-level = 3 } librocksdb-sys = { opt-level = 3 } libsecp256k1 = { opt-level = 3 } libz-sys = { opt-level = 3 } diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 1df4b9f1ae..602534becd 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -81,8 +81,6 @@ polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "relea polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" } polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" } -orml-oracle-rpc = { path = "../../orml/oracle/rpc" } -orml-tokens-rpc = { path = "../../orml/tokens/rpc" } acala-primitives = { path = "../../primitives" } acala-rpc = { path = "../../rpc" } diff --git a/node/service/src/client.rs b/node/service/src/client.rs index 1527fba9bc..917676bedf 100644 --- a/node/service/src/client.rs +++ b/node/service/src/client.rs @@ -18,8 +18,7 @@ //! Acala Client abstractions. -use acala_primitives::{AccountId, Balance, Block, BlockNumber, CurrencyId, DataProviderId, Hash, Header, Nonce}; -use runtime_common::TimeStampedPrice; +use acala_primitives::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce}; use sc_client_api::{Backend as BackendT, BlockchainEvents, KeysIter, PairsIter}; use sp_api::{CallApiAt, NumberFor, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; @@ -39,8 +38,6 @@ pub trait RuntimeApiCollection: + sp_block_builder::BlockBuilder + frame_system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi - + orml_oracle_rpc::OracleRuntimeApi - + orml_tokens_rpc::TokensRuntimeApi + sp_api::Metadata + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys @@ -57,8 +54,6 @@ where + sp_block_builder::BlockBuilder + frame_system_rpc_runtime_api::AccountNonceApi + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi - + orml_oracle_rpc::OracleRuntimeApi - + orml_tokens_rpc::TokensRuntimeApi + sp_api::Metadata + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys diff --git a/orml b/orml index 5680303914..22a4f7b7d1 160000 --- a/orml +++ b/orml @@ -1 +1 @@ -Subproject commit 56803039140d968f41a10431d5d6a66133dd200a +Subproject commit 22a4f7b7d1066c1a138222f4546d527d32aa4047 diff --git a/runtime/acala/Cargo.toml b/runtime/acala/Cargo.toml index 000e8e7275..c1b071c552 100644 --- a/runtime/acala/Cargo.toml +++ b/runtime/acala/Cargo.toml @@ -77,11 +77,11 @@ orml-authority = { path = "../../orml/authority", default-features = false } orml-benchmarking = { path = "../../orml/benchmarking", default-features = false, optional = true } orml-nft= { path = "../../orml/nft", default-features = false } orml-oracle = { path = "../../orml/oracle", default-features = false } -orml-oracle-rpc-runtime-api = { path = "../../orml/oracle/rpc/runtime-api", default-features = false } +orml-oracle-runtime-api = { path = "../../orml/oracle/runtime-api", default-features = false } orml-parameters = { path = "../../orml/parameters", default-features = false } orml-rewards = { path = "../../orml/rewards", default-features = false } orml-tokens = { path = "../../orml/tokens", default-features = false } -orml-tokens-rpc-runtime-api = { path = "../../orml/tokens/rpc/runtime-api", default-features = false } +orml-tokens-runtime-api = { path = "../../orml/tokens/runtime-api", default-features = false } orml-traits = { path = "../../orml/traits", default-features = false } orml-unknown-tokens = { path = "../../orml/unknown-tokens", default-features = false } orml-utilities = { path = "../../orml/utilities", default-features = false } @@ -211,11 +211,11 @@ std = [ "orml-authority/std", "orml-benchmarking/std", "orml-nft/std", - "orml-oracle-rpc-runtime-api/std", + "orml-oracle-runtime-api/std", "orml-oracle/std", "orml-parameters/std", "orml-rewards/std", - "orml-tokens-rpc-runtime-api/std", + "orml-tokens-runtime-api/std", "orml-tokens/std", "orml-traits/std", "orml-unknown-tokens/std", diff --git a/runtime/acala/src/lib.rs b/runtime/acala/src/lib.rs index 227e269e43..30ae36e8b3 100644 --- a/runtime/acala/src/lib.rs +++ b/runtime/acala/src/lib.rs @@ -2024,7 +2024,7 @@ sp_api::impl_runtime_apis! { } } - impl orml_oracle_rpc_runtime_api::OracleApi< + impl orml_oracle_runtime_api::OracleApi< Block, DataProviderId, CurrencyId, @@ -2045,7 +2045,7 @@ sp_api::impl_runtime_apis! { } } - impl orml_tokens_rpc_runtime_api::TokensApi< + impl orml_tokens_runtime_api::TokensApi< Block, CurrencyId, Balance, diff --git a/runtime/acala/src/xcm_config.rs b/runtime/acala/src/xcm_config.rs index fd4c4857b0..8723067a9c 100644 --- a/runtime/acala/src/xcm_config.rs +++ b/runtime/acala/src/xcm_config.rs @@ -260,9 +260,9 @@ impl Convert> for CurrencyIdConvert { match location { MultiLocation { - parents, + parents: 1, interior: X2(Parachain(para_id), GeneralKey { data, length }), - } if parents == 1 => { + } => { match (para_id, &data[..data.len().min(length as usize)]) { (id, key) if id == u32::from(ParachainInfo::get()) => { // Acala diff --git a/runtime/integration-tests/Cargo.toml b/runtime/integration-tests/Cargo.toml index e2027713d8..35e204cab3 100644 --- a/runtime/integration-tests/Cargo.toml +++ b/runtime/integration-tests/Cargo.toml @@ -74,7 +74,7 @@ orml-auction = { path = "../../orml/auction" } orml-authority = { path = "../../orml/authority" } orml-benchmarking = { path = "../../orml/benchmarking", optional = true } orml-oracle = { path = "../../orml/oracle" } -orml-oracle-rpc-runtime-api = { path = "../../orml/oracle/rpc/runtime-api" } +orml-oracle-runtime-api = { path = "../../orml/oracle/runtime-api" } orml-tokens = { path = "../../orml/tokens" } orml-traits = { path = "../../orml/traits" } orml-vesting = { path = "../../orml/vesting" } diff --git a/runtime/karura/Cargo.toml b/runtime/karura/Cargo.toml index 4c3b082224..3675ab2459 100644 --- a/runtime/karura/Cargo.toml +++ b/runtime/karura/Cargo.toml @@ -77,11 +77,11 @@ orml-authority = { path = "../../orml/authority", default-features = false } orml-benchmarking = { path = "../../orml/benchmarking", default-features = false, optional = true } orml-nft= { path = "../../orml/nft", default-features = false } orml-oracle = { path = "../../orml/oracle", default-features = false } -orml-oracle-rpc-runtime-api = { path = "../../orml/oracle/rpc/runtime-api", default-features = false } +orml-oracle-runtime-api = { path = "../../orml/oracle/runtime-api", default-features = false } orml-parameters = { path = "../../orml/parameters", default-features = false } orml-rewards = { path = "../../orml/rewards", default-features = false } orml-tokens = { path = "../../orml/tokens", default-features = false } -orml-tokens-rpc-runtime-api = { path = "../../orml/tokens/rpc/runtime-api", default-features = false } +orml-tokens-runtime-api = { path = "../../orml/tokens/runtime-api", default-features = false } orml-traits = { path = "../../orml/traits", default-features = false } orml-unknown-tokens = { path = "../../orml/unknown-tokens", default-features = false } orml-utilities = { path = "../../orml/utilities", default-features = false } @@ -212,11 +212,11 @@ std = [ "orml-authority/std", "orml-benchmarking/std", "orml-nft/std", - "orml-oracle-rpc-runtime-api/std", + "orml-oracle-runtime-api/std", "orml-oracle/std", "orml-parameters/std", "orml-rewards/std", - "orml-tokens-rpc-runtime-api/std", + "orml-tokens-runtime-api/std", "orml-tokens/std", "orml-traits/std", "orml-unknown-tokens/std", diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index d0e1df3cd9..c622fa2bd0 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -2028,7 +2028,7 @@ impl_runtime_apis! { } } - impl orml_oracle_rpc_runtime_api::OracleApi< + impl orml_oracle_runtime_api::OracleApi< Block, DataProviderId, CurrencyId, @@ -2049,7 +2049,7 @@ impl_runtime_apis! { } } - impl orml_tokens_rpc_runtime_api::TokensApi< + impl orml_tokens_runtime_api::TokensApi< Block, CurrencyId, Balance, diff --git a/runtime/mandala/Cargo.toml b/runtime/mandala/Cargo.toml index ee474e7a6b..d08273592d 100644 --- a/runtime/mandala/Cargo.toml +++ b/runtime/mandala/Cargo.toml @@ -81,12 +81,12 @@ orml-authority = { path = "../../orml/authority", default-features = false } orml-benchmarking = { path = "../../orml/benchmarking", default-features = false, optional = true } orml-nft= { path = "../../orml/nft", default-features = false } orml-oracle = { path = "../../orml/oracle", default-features = false } -orml-oracle-rpc-runtime-api = { path = "../../orml/oracle/rpc/runtime-api", default-features = false } +orml-oracle-runtime-api = { path = "../../orml/oracle/runtime-api", default-features = false } orml-parameters = { path = "../../orml/parameters", default-features = false } orml-payments = { path = "../../orml/payments", default-features = false } orml-rewards = { path = "../../orml/rewards", default-features = false } orml-tokens = { path = "../../orml/tokens", default-features = false } -orml-tokens-rpc-runtime-api = { path = "../../orml/tokens/rpc/runtime-api", default-features = false } +orml-tokens-runtime-api = { path = "../../orml/tokens/runtime-api", default-features = false } orml-traits = { path = "../../orml/traits", default-features = false } orml-unknown-tokens = { path = "../../orml/unknown-tokens", default-features = false } orml-utilities = { path = "../../orml/utilities", default-features = false } @@ -226,12 +226,12 @@ std = [ "orml-authority/std", "orml-benchmarking/std", "orml-nft/std", - "orml-oracle-rpc-runtime-api/std", + "orml-oracle-runtime-api/std", "orml-oracle/std", "orml-parameters/std", "orml-payments/std", "orml-rewards/std", - "orml-tokens-rpc-runtime-api/std", + "orml-tokens-runtime-api/std", "orml-tokens/std", "orml-traits/std", "orml-unknown-tokens/std", diff --git a/runtime/mandala/src/lib.rs b/runtime/mandala/src/lib.rs index 16a5630f0b..db15cda417 100644 --- a/runtime/mandala/src/lib.rs +++ b/runtime/mandala/src/lib.rs @@ -2251,7 +2251,7 @@ impl_runtime_apis! { } } - impl orml_oracle_rpc_runtime_api::OracleApi< + impl orml_oracle_runtime_api::OracleApi< Block, DataProviderId, CurrencyId, @@ -2272,7 +2272,7 @@ impl_runtime_apis! { } } - impl orml_tokens_rpc_runtime_api::TokensApi< + impl orml_tokens_runtime_api::TokensApi< Block, CurrencyId, Balance,