diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cc3df27e..7b7f30b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Breaking changes ### Features +- [\#529](https://github.com/Manta-Network/Manta/pull/529) Add RPC for MantaPay to synchronize with latest ledger state ### Improvements [\#481](https://github.com/Manta-Network/Manta/pull/481) Update upstream dependencies to v0.9.18. diff --git a/Cargo.lock b/Cargo.lock index 2242a303c..28ac6830e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -551,9 +551,9 @@ checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" [[package]] name = "attohttpc" -version = "0.18.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e69e13a99a7e6e070bb114f7ff381e58c7ccc188630121fc4c2fe4bcf24cd072" +checksum = "262c3f7f5d61249d8c00e5546e2685cd15ebeeb1bc0f3cc5449350a1cb07319e" dependencies = [ "flate2", "http", @@ -2311,6 +2311,41 @@ dependencies = [ "zeroize", ] +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -3692,6 +3727,12 @@ dependencies = [ "tokio-native-tls", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.1.5" @@ -5197,6 +5238,7 @@ dependencies = [ "log", "manta-primitives", "manta-runtime", + "pallet-manta-pay", "pallet-transaction-payment-rpc", "parity-scale-codec", "polkadot-cli", @@ -5243,7 +5285,7 @@ dependencies = [ [[package]] name = "manta-accounting" version = "0.4.0" -source = "git+https://github.com/manta-network/manta-rs.git#c6567af7e017a37c20b0f099993deb9f3227279c" +source = "git+https://github.com/manta-network/manta-rs.git#ebf935276c4bb172d23d6748e0b9d11a48d409b7" dependencies = [ "derivative", "derive_more", @@ -5252,7 +5294,6 @@ dependencies = [ "manta-crypto", "manta-util", "parking_lot 0.12.0", - "rand 0.8.5", "statrs", ] @@ -5286,17 +5327,18 @@ dependencies = [ [[package]] name = "manta-crypto" version = "0.4.0" -source = "git+https://github.com/manta-network/manta-rs.git#c6567af7e017a37c20b0f099993deb9f3227279c" +source = "git+https://github.com/manta-network/manta-rs.git#ebf935276c4bb172d23d6748e0b9d11a48d409b7" dependencies = [ "derivative", "manta-util", + "rand 0.8.5", "rand_core 0.6.3", ] [[package]] name = "manta-pay" version = "0.4.0" -source = "git+https://github.com/manta-network/manta-rs.git#c6567af7e017a37c20b0f099993deb9f3227279c" +source = "git+https://github.com/manta-network/manta-rs.git#ebf935276c4bb172d23d6748e0b9d11a48d409b7" dependencies = [ "aes-gcm", "ark-bls12-381", @@ -5408,7 +5450,7 @@ dependencies = [ [[package]] name = "manta-sdk" version = "0.5.0" -source = "git+https://github.com/manta-network/sdk.git#fef5dc1868f6dea4911c8bb03cb6b29399810063" +source = "git+https://github.com/manta-network/sdk.git#4695cffb2cbb65f9a2efc24d54c11c801785b006" dependencies = [ "anyhow", "attohttpc", @@ -5420,7 +5462,11 @@ dependencies = [ [[package]] name = "manta-util" version = "0.4.0" -source = "git+https://github.com/manta-network/manta-rs.git#c6567af7e017a37c20b0f099993deb9f3227279c" +source = "git+https://github.com/manta-network/manta-rs.git#ebf935276c4bb172d23d6748e0b9d11a48d409b7" +dependencies = [ + "serde", + "serde_with", +] [[package]] name = "maplit" @@ -6580,6 +6626,9 @@ dependencies = [ "frame-support", "frame-system", "indoc", + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", "lazy_static", "manta-accounting", "manta-crypto", @@ -6593,6 +6642,8 @@ dependencies = [ "parity-scale-codec", "rand 0.8.5", "scale-info", + "sp-api", + "sp-blockchain", "sp-core", "sp-io", "sp-runtime", @@ -10368,9 +10419,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fe4ca2b2295d5519b364579162b8e18f4902f6c9e8a975e7d05e7ef63622f5" +checksum = "c46be926081c9f4dd5dd9b6f1d3e3229f2360bc6502dd8836f84a93b7c75e99a" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -10382,9 +10433,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e767e52f2d5b2e71e86b1c82976bf4c3acdef88d72af7fa3498cef31cd9708cb" +checksum = "50e334bb10a245e28e5fd755cabcafd96cfcd167c99ae63a46924ca8d8703a3c" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -10619,6 +10670,28 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha-1" version = "0.8.2" @@ -12261,9 +12334,9 @@ version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ee73e6e4924fe940354b8d4d98cad5231175d615cd855b758adc658c0aac6a0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "digest 0.10.3", - "rand 0.8.5", + "rand 0.7.3", "static_assertions", ] diff --git a/Cargo.toml b/Cargo.toml index 68d8da57d..41e0d28fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,3 @@ - [workspace] resolver = "2" members = [ diff --git a/node/Cargo.toml b/node/Cargo.toml index c7a8d88d5..6fd2f4080 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -9,6 +9,7 @@ license = 'GPL-3.0' name = 'manta' repository = 'https://github.com/Manta-Network/Manta/' version = '3.1.5' +default-run = "manta" [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -89,9 +90,10 @@ xcm = { git = "https://github.com/paritytech/polkadot.git", branch = "release-v0 # Self dependencies calamari-runtime = { path = '../runtime/calamari' } -manta-runtime = { path = '../runtime/manta' } dolphin-runtime = { path = '../runtime/dolphin' } manta-primitives = { path = '../primitives' } +manta-runtime = { path = '../runtime/manta' } +pallet-manta-pay = { path = '../pallets/manta-pay', features = ["rpc", "runtime"] } [build-dependencies] substrate-build-script-utils = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" } diff --git a/node/src/chain_specs/calamari.rs b/node/src/chain_specs/calamari.rs index d9bf413b7..de414f7e4 100644 --- a/node/src/chain_specs/calamari.rs +++ b/node/src/chain_specs/calamari.rs @@ -16,8 +16,7 @@ use super::*; use crate::command::CALAMARI_PARACHAIN_ID; - -use calamari_runtime::{CouncilConfig, DemocracyConfig, GenesisConfig, TechnicalCommitteeConfig}; +use calamari_runtime::{CouncilConfig, DemocracyConfig, TechnicalCommitteeConfig}; use manta_primitives::helpers::{get_account_id_from_seed, get_collator_keys_from_seed}; /// Specialized `ChainSpec` for the normal parachain runtime. diff --git a/node/src/chain_specs/dolphin.rs b/node/src/chain_specs/dolphin.rs index b18bfc28e..69542f159 100644 --- a/node/src/chain_specs/dolphin.rs +++ b/node/src/chain_specs/dolphin.rs @@ -16,15 +16,12 @@ use super::*; use crate::command::DOLPHIN_PARACHAIN_ID; - -use dolphin_runtime::{ - AssetManagerConfig, CouncilConfig, DemocracyConfig, GenesisConfig, TechnicalCommitteeConfig, -}; +use dolphin_runtime::{CouncilConfig, DemocracyConfig, GenesisConfig, TechnicalCommitteeConfig}; use manta_primitives::helpers::{get_account_id_from_seed, get_collator_keys_from_seed}; /// Specialized `ChainSpec` for the normal parachain runtime. pub type DolphinChainSpec = - sc_service::GenericChainSpec; + sc_service::GenericChainSpec; const DOLPHIN_PROTOCOL_ID: &str = "dolphin"; // for p2p network configuration const KUSAMA_RELAYCHAIN_LOCAL_NET: &str = "kusama-local"; diff --git a/node/src/chain_specs/manta.rs b/node/src/chain_specs/manta.rs index 0274d2180..dbb45c9ca 100644 --- a/node/src/chain_specs/manta.rs +++ b/node/src/chain_specs/manta.rs @@ -16,8 +16,6 @@ use super::*; use crate::command::MANTA_PARACHAIN_ID; - -pub type MantaChainSpec = sc_service::GenericChainSpec; use manta_primitives::helpers::{get_account_id_from_seed, get_collator_keys_from_seed}; const MANTA_PROTOCOL_ID: &str = "manta"; // for p2p network configuration @@ -29,6 +27,8 @@ const POLKADOT_RELAYCHAIN_MAIN_NET: &str = "polkadot"; /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = 2; +pub type MantaChainSpec = sc_service::GenericChainSpec; + /// Generate the manta session keys from individual elements. /// /// The input must be a tuple of individual keys (a single arg for now since we have just one key). @@ -48,7 +48,6 @@ pub fn manta_properties() -> Properties { // manta chain spec pub fn manta_development_config() -> MantaChainSpec { let properties = manta_properties(); - MantaChainSpec::from_genesis( // Name "Manta Parachain Development", @@ -85,7 +84,6 @@ pub fn manta_development_config() -> MantaChainSpec { pub fn manta_local_config() -> MantaChainSpec { let properties = manta_properties(); - MantaChainSpec::from_genesis( // Name "Manta Parachain Local", diff --git a/node/src/chain_specs/mod.rs b/node/src/chain_specs/mod.rs index 9f2333966..82c823853 100644 --- a/node/src/chain_specs/mod.rs +++ b/node/src/chain_specs/mod.rs @@ -14,29 +14,25 @@ // You should have received a copy of the GNU General Public License // along with Manta. If not, see . -#![allow(unused_imports)] #![allow(dead_code)] -use cumulus_primitives_core::ParaId; -use hex_literal::hex; + use manta_primitives::{ constants, - types::{AccountId, AuraId, Balance, Signature}, + types::{AccountId, AuraId, Balance}, }; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::{ChainType, Properties}; use serde::{Deserialize, Serialize}; -use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public}; -use sp_runtime::traits::{IdentifyAccount, Verify}; +use sp_core::sr25519; pub mod calamari; -pub use self::calamari::*; -pub use calamari_runtime::currency::KMA; -pub mod manta; -pub use self::manta::*; -pub use manta_runtime::currency::MANTA; pub mod dolphin; -pub use self::dolphin::*; +pub mod manta; + +pub use self::{calamari::*, dolphin::*, manta::*}; +pub use calamari_runtime::currency::KMA; pub use dolphin_runtime::currency::DOL; +pub use manta_runtime::currency::MANTA; const CALAMARI_ENDOWMENT: Balance = 1_000_000_000 * KMA; // 10 endowment so that total supply is 10B diff --git a/node/src/command.rs b/node/src/command.rs index 51ccb84fc..f37f3aab9 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -17,14 +17,13 @@ use crate::{ chain_specs, cli::{Cli, RelayChainCli, Subcommand}, + rpc::{self, Builder}, service::{new_partial, CalamariRuntimeExecutor, DolphinRuntimeExecutor, MantaRuntimeExecutor}, }; - use codec::Encode; use cumulus_client_service::genesis::generate_genesis_block; use cumulus_primitives_core::ParaId; use log::info; - use manta_primitives::types::{AuraId, Header}; use polkadot_parachain::primitives::AccountIdConversion; use sc_cli::{ @@ -199,9 +198,9 @@ impl SubstrateCli for RelayChainCli { } } +#[allow(clippy::borrowed_box)] fn extract_genesis_wasm(chain_spec: &Box) -> Result> { let mut storage = chain_spec.build_storage()?; - storage .top .remove(sp_core::storage::well_known_keys::CODE) @@ -393,7 +392,7 @@ pub fn run_with(cli: Cli) -> Result<()> { runner.run_node_until_exit(|config| async move { let para_id = crate::chain_specs::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain extension in chain-spec.")?; + .ok_or("Could not find parachain extension in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -437,7 +436,10 @@ pub fn run_with(cli: Cli) -> Result<()> { manta_runtime::RuntimeApi, MantaRuntimeExecutor, AuraId, - >(config, polkadot_config, collator_options, id) + _, + >(config, polkadot_config, collator_options, id, |c, p| { + Box::new(Builder::new(c, p)) + }) .await .map(|r| r.0) .map_err(Into::into) @@ -446,7 +448,10 @@ pub fn run_with(cli: Cli) -> Result<()> { calamari_runtime::RuntimeApi, CalamariRuntimeExecutor, AuraId, - >(config, polkadot_config, collator_options, id) + _, + >(config, polkadot_config, collator_options, id, |c, p| { + Box::new(Builder::new(c, p)) + }) .await .map(|r| r.0) .map_err(Into::into) @@ -455,7 +460,10 @@ pub fn run_with(cli: Cli) -> Result<()> { dolphin_runtime::RuntimeApi, DolphinRuntimeExecutor, AuraId, - >(config, polkadot_config, collator_options, id) + _, + >(config, polkadot_config, collator_options, id, |c, p| { + Box::new(Builder::<_, _, rpc::Dolphin>::new(c, p)) + }) .await .map(|r| r.0) .map_err(Into::into) diff --git a/node/src/lib.rs b/node/src/lib.rs deleted file mode 100644 index c3de5a567..000000000 --- a/node/src/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2020-2022 Manta Network. -// This file is part of Manta. -// -// Manta is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Manta is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Manta. If not, see . - -//! Manta/Calamari Parachain CLI - -#![allow(missing_docs)] - -pub mod chain_specs; -pub mod cli; -pub mod command; -pub mod rpc; -pub mod service; diff --git a/node/src/main.rs b/node/src/main.rs index 555fdcca3..8485e00b2 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -16,6 +16,16 @@ //! Manta/Calamari Parachain CLI +#![warn(missing_docs)] + +extern crate alloc; + +mod chain_specs; +mod cli; +mod command; +mod rpc; +mod service; + fn main() -> sc_cli::Result<()> { - manta::command::run() + command::run() } diff --git a/node/src/rpc.rs b/node/src/rpc.rs deleted file mode 100644 index 084da1357..000000000 --- a/node/src/rpc.rs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2020-2022 Manta Network. -// This file is part of Manta. -// -// Manta is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Manta is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Manta. If not, see . - -//! Parachain-specific RPCs implementation. - -use std::sync::Arc; - -use sc_client_api::AuxStore; -pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; -use sc_transaction_pool_api::TransactionPool; -use sp_api::ProvideRuntimeApi; -use sp_block_builder::BlockBuilder; -use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; - -use manta_primitives::types::{AccountId, Balance, Block, Index as Nonce}; - -/// A type representing all RPC extensions. -pub type RpcExtension = jsonrpc_core::IoHandler; - -/// Full client dependencies -pub struct FullDeps { - /// The client instance to use. - pub client: Arc, - /// Transaction pool instance. - pub pool: Arc

, - /// Whether to deny unsafe calls - pub deny_unsafe: DenyUnsafe, -} - -/// Instantiate all RPC extensions. -pub fn create_full(deps: FullDeps) -> RpcExtension -where - C: ProvideRuntimeApi - + HeaderBackend - + AuxStore - + HeaderMetadata - + Send - + Sync - + 'static, - C::Api: frame_rpc_system::AccountNonceApi, - C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, - C::Api: BlockBuilder, - P: TransactionPool + Sync + Send + 'static, -{ - use frame_rpc_system::{FullSystem, SystemApi}; - use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi}; - - let mut io = jsonrpc_core::IoHandler::default(); - let FullDeps { - client, - pool, - deny_unsafe, - } = deps; - - io.extend_with(SystemApi::to_delegate(FullSystem::new( - client.clone(), - pool, - deny_unsafe, - ))); - io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new( - client, - ))); - - io -} diff --git a/node/src/rpc/common.rs b/node/src/rpc/common.rs new file mode 100644 index 000000000..ff27c5e05 --- /dev/null +++ b/node/src/rpc/common.rs @@ -0,0 +1,54 @@ +// Copyright 2020-2022 Manta Network. +// This file is part of Manta. +// +// Manta is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Manta is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Manta. If not, see . + +//! Common RPC Extensions + +use crate::rpc::{Builder, RpcExtension}; +use frame_rpc_system::{AccountNonceApi, FullSystem, SystemApi}; +use manta_primitives::types::{AccountId, Balance, Block, Index as Nonce}; +use pallet_transaction_payment_rpc::{ + TransactionPayment, TransactionPaymentApi, TransactionPaymentRuntimeApi, +}; +use sc_client_api::HeaderBackend; +use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +use sc_service::{Error, RpcExtensionBuilder}; +use sc_transaction_pool_api::TransactionPool; +use sp_api::ProvideRuntimeApi; +use sp_block_builder::BlockBuilder; + +/// Common RPC Extension Marker +pub struct Common; + +impl RpcExtensionBuilder for Builder +where + C: 'static + ProvideRuntimeApi + HeaderBackend, + C::Api: BlockBuilder + + AccountNonceApi + + TransactionPaymentRuntimeApi, + P: 'static + TransactionPool, +{ + type Output = RpcExtension; + + #[inline] + fn build(&self, deny: DenyUnsafe, _: SubscriptionTaskExecutor) -> Result { + let mut io = RpcExtension::default(); + io.extend_with( + FullSystem::new(self.client.clone(), self.transaction_pool.clone(), deny).to_delegate(), + ); + io.extend_with(TransactionPayment::new(self.client.clone()).to_delegate()); + Ok(io) + } +} diff --git a/node/src/rpc/dolphin.rs b/node/src/rpc/dolphin.rs new file mode 100644 index 000000000..49813a030 --- /dev/null +++ b/node/src/rpc/dolphin.rs @@ -0,0 +1,58 @@ +// Copyright 2020-2022 Manta Network. +// This file is part of Manta. +// +// Manta is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Manta is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Manta. If not, see . + +//! Dolphin RPC Extensions + +use crate::rpc::{common::Common, Builder, RpcExtension}; +use frame_rpc_system::AccountNonceApi; +use manta_primitives::types::{AccountId, Balance, Block, Index as Nonce}; +use pallet_manta_pay::{ + rpc::{Pull, PullApi}, + runtime::PullLedgerDiffApi, +}; +use pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi; +use sc_client_api::HeaderBackend; +use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +use sc_service::{Error, RpcExtensionBuilder}; +use sc_transaction_pool_api::TransactionPool; +use sp_api::ProvideRuntimeApi; +use sp_block_builder::BlockBuilder; + +/// Dolphin RPC Extension Marker +pub struct Dolphin; + +impl RpcExtensionBuilder for Builder +where + C: 'static + ProvideRuntimeApi + HeaderBackend, + C::Api: BlockBuilder + + AccountNonceApi + + PullLedgerDiffApi + + TransactionPaymentRuntimeApi, + P: 'static + TransactionPool, +{ + type Output = RpcExtension; + + #[inline] + fn build( + &self, + deny: DenyUnsafe, + subscription_executor: SubscriptionTaskExecutor, + ) -> Result { + let mut io = self.using::().build(deny, subscription_executor)?; + io.extend_with(Pull::new(self.client.clone()).to_delegate()); + Ok(io) + } +} diff --git a/node/src/rpc/mod.rs b/node/src/rpc/mod.rs new file mode 100644 index 000000000..b4aac119d --- /dev/null +++ b/node/src/rpc/mod.rs @@ -0,0 +1,59 @@ +// Copyright 2020-2022 Manta Network. +// This file is part of Manta. +// +// Manta is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Manta is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Manta. If not, see . + +//! Parachain-specific RPCs implementation. + +use alloc::sync::Arc; +use core::marker::PhantomData; + +mod common; +mod dolphin; + +pub use common::Common; +pub use dolphin::Dolphin; + +/// RPC Extension Type +pub type RpcExtension = jsonrpc_core::IoHandler; + +/// RPC Extension Builder +pub struct Builder { + /// Client + client: Arc, + + /// Transaction Poool + transaction_pool: Arc

, + + /// Runtime Marker + __: PhantomData, +} + +impl Builder { + /// Builds a new RPC Extension [`Builder`] from `client` and `transaction_pool`. + #[inline] + pub fn new(client: Arc, transaction_pool: Arc

) -> Self { + Self { + client, + transaction_pool, + __: PhantomData, + } + } + + /// Converts `self` into a [`Builder`] with the `T` marker. + #[inline] + pub fn using(&self) -> Builder { + Builder::new(self.client.clone(), self.transaction_pool.clone()) + } +} diff --git a/node/src/service.rs b/node/src/service.rs index 0f65cd2dc..08d8c43f2 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Manta. If not, see . +use crate::rpc; use codec::Codec; use core::marker::PhantomData; use cumulus_client_cli::CollatorOptions; @@ -21,6 +22,7 @@ use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, Slo use cumulus_client_consensus_common::{ ParachainBlockImport, ParachainCandidate, ParachainConsensus, }; +use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier; use cumulus_client_network::BlockAnnounceValidator; use cumulus_client_service::{ prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams, @@ -34,10 +36,8 @@ use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayC use cumulus_relay_chain_rpc_interface::RelayChainRPCInterface; use polkadot_service::{CollatorPair, NativeExecutionDispatch}; -use crate::rpc; pub use manta_primitives::types::{AccountId, Balance, Block, Hash, Header, Index as Nonce}; -use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier; use futures::lock::Mutex; use sc_client_api::ExecutorProvider; use sc_consensus::{ @@ -46,22 +46,25 @@ use sc_consensus::{ }; use sc_executor::NativeElseWasmExecutor; use sc_network::NetworkService; -use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager}; +use sc_service::{Configuration, Error, Role, TFullBackend, TFullClient, TaskManager}; use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sp_api::{ApiExt, ConstructRuntimeApi}; use sp_consensus::CacheKeyId; use sp_consensus_aura::AuraApi; use sp_core::crypto::Pair; use sp_keystore::SyncCryptoStorePtr; +use sp_offchain::OffchainWorkerApi; use sp_runtime::{ app_crypto::AppKey, generic::BlockId, traits::{BlakeTwo256, Header as HeaderT}, }; +use sp_session::SessionKeys; +use sp_transaction_pool::runtime_api::TaggedTransactionQueue; use std::sync::Arc; use substrate_prometheus_endpoint::Registry; -// Native Manta Parachain executor instance. +/// Native Manta Parachain executor instance. pub struct MantaRuntimeExecutor; impl sc_executor::NativeExecutionDispatch for MantaRuntimeExecutor { type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; @@ -75,7 +78,7 @@ impl sc_executor::NativeExecutionDispatch for MantaRuntimeExecutor { } } -// Native Calamari Parachain executor instance. +/// Native Calamari Parachain executor instance. pub struct CalamariRuntimeExecutor; impl sc_executor::NativeExecutionDispatch for CalamariRuntimeExecutor { type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; @@ -89,7 +92,7 @@ impl sc_executor::NativeExecutionDispatch for CalamariRuntimeExecutor { } } -// Native Dolphin Parachain executor instance. +/// Native Dolphin Parachain executor instance. pub struct DolphinRuntimeExecutor; impl sc_executor::NativeExecutionDispatch for DolphinRuntimeExecutor { type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; @@ -103,6 +106,28 @@ impl sc_executor::NativeExecutionDispatch for DolphinRuntimeExecutor { } } +/// Full Client Implementation Type +pub type Client = TFullClient>; + +/// Default Import Queue Type +pub type ImportQueue = sc_consensus::DefaultImportQueue>; + +/// Full Transaction Pool Type +pub type TransactionPool = sc_transaction_pool::FullPool>; + +/// Components Needed for Chain Ops Subcommands +pub type PartialComponents = sc_service::PartialComponents< + Client, + TFullBackend, + (), + ImportQueue, + TransactionPool, + (Option, Option), +>; + +/// State Backend Type +pub type StateBackend = sc_client_api::StateBackendFor, Block>; + /// Starts a `ServiceBuilder` for a full service. /// /// Use this macro if you don't actually need the full service, but just the builder in order to @@ -110,50 +135,23 @@ impl sc_executor::NativeExecutionDispatch for DolphinRuntimeExecutor { pub fn new_partial( config: &Configuration, build_import_queue: BIQ, -) -> Result< - PartialComponents< - TFullClient>, - TFullBackend, - (), - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, - sc_transaction_pool::FullPool< - Block, - TFullClient>, - >, - (Option, Option), - >, - sc_service::Error, -> +) -> Result, Error> where - RuntimeApi: ConstructRuntimeApi>> - + Send - + Sync - + 'static, - RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: TaggedTransactionQueue + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt< - Block, - StateBackend = sc_client_api::StateBackendFor, Block>, - > + sp_offchain::OffchainWorkerApi + + SessionKeys + + ApiExt + + OffchainWorkerApi + sp_block_builder::BlockBuilder, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + StateBackend: sp_api::StateBackend, Executor: NativeExecutionDispatch + 'static, BIQ: FnOnce( - Arc>>, + Arc>, &Configuration, Option, &TaskManager, - ) -> Result< - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, - sc_service::Error, - >, + ) -> Result, Error>, { let telemetry = config .telemetry_endpoints @@ -165,14 +163,12 @@ where Ok((worker, telemetry)) }) .transpose()?; - let executor = sc_executor::NativeElseWasmExecutor::::new( config.wasm_method, config.default_heap_pages, config.max_runtime_instances, config.runtime_cache_size, ); - let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::( config, @@ -180,16 +176,13 @@ where executor, )?; let client = Arc::new(client); - let telemetry_worker_handle = telemetry.as_ref().map(|(worker, _)| worker.handle()); - let telemetry = telemetry.map(|(worker, telemetry)| { task_manager .spawn_handle() .spawn("telemetry", None, worker.run()); telemetry }); - let transaction_pool = sc_transaction_pool::BasicPool::new_full( config.transaction_pool.clone(), config.role.is_authority().into(), @@ -197,15 +190,13 @@ where task_manager.spawn_essential_handle(), client.clone(), ); - let import_queue = build_import_queue( client.clone(), config, telemetry.as_ref().map(|telemetry| telemetry.handle()), &task_manager, )?; - - let params = PartialComponents { + Ok(PartialComponents { backend, client, import_queue, @@ -214,9 +205,7 @@ where transaction_pool, select_chain: (), other: (telemetry, telemetry_worker_handle), - }; - - Ok(params) + }) } async fn build_relay_chain_interface( @@ -252,64 +241,47 @@ async fn start_node_impl( polkadot_config: Configuration, collator_options: CollatorOptions, id: ParaId, - _rpc_ext_builder: RB, + rpc_extensions_builder: RB, build_import_queue: BIQ, build_consensus: BIC, -) -> sc_service::error::Result<( - TaskManager, - Arc>>, -)> +) -> Result<(TaskManager, Arc>), Error> where - RuntimeApi: ConstructRuntimeApi>> - + Send - + Sync - + 'static, - RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: TaggedTransactionQueue + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt< - Block, - StateBackend = sc_client_api::StateBackendFor, Block>, - > + sp_offchain::OffchainWorkerApi + + SessionKeys + + ApiExt + + OffchainWorkerApi + sp_block_builder::BlockBuilder + cumulus_primitives_core::CollectCollationInfo + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + frame_rpc_system::AccountNonceApi, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + StateBackend: sp_api::StateBackend, Executor: sc_executor::NativeExecutionDispatch + 'static, RB: Fn( - Arc>, - ) -> Result, sc_service::Error> - + Send - + 'static, + Arc>, + Arc>, + ) -> Box< + (dyn sc_service::RpcExtensionBuilder + Send + 'static), + >, BIQ: FnOnce( - Arc>>, + Arc>, &Configuration, Option, &TaskManager, - ) -> Result< - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, - sc_service::Error, - > + 'static, + ) -> Result, Error> + + 'static, BIC: FnOnce( - Arc>>, + Arc>, Option<&Registry>, Option, &TaskManager, Arc, - Arc< - sc_transaction_pool::FullPool< - Block, - TFullClient>, - >, - >, + Arc>, Arc>, SyncCryptoStorePtr, bool, - ) -> Result>, sc_service::Error>, + ) -> Result>, Error>, { if matches!(parachain_config.role, Role::Light) { return Err("Light client not supported!".into()); @@ -356,23 +328,8 @@ where warp_sync: None, })?; - let rpc_extensions_builder = { - let client = client.clone(); - let transaction_pool = transaction_pool.clone(); - - Box::new(move |deny_unsafe, _| { - let deps = rpc::FullDeps { - client: client.clone(), - pool: transaction_pool.clone(), - deny_unsafe, - }; - - Ok(rpc::create_full(deps)) - }) - }; - sc_service::spawn_tasks(sc_service::SpawnTasksParams { - rpc_extensions_builder, + rpc_extensions_builder: rpc_extensions_builder(client.clone(), transaction_pool.clone()), client: client.clone(), transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, @@ -402,10 +359,8 @@ where params.keystore_container.sync_keystore(), force_authoring, )?; - let spawner = task_manager.spawn_handle(); - - let params = StartCollatorParams { + start_collator(StartCollatorParams { para_id: id, block_status: client.clone(), announce_block, @@ -417,11 +372,10 @@ where import_queue, collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, - }; - - start_collator(params).await?; + }) + .await?; } else { - let params = StartFullNodeParams { + start_full_node(StartFullNodeParams { client: client.clone(), announce_block, task_manager: &mut task_manager, @@ -430,13 +384,10 @@ where relay_chain_slot_duration, import_queue, collator_options, - }; - - start_full_node(params)?; + })?; } start_network.start_network(); - Ok((task_manager, client)) } @@ -555,32 +506,21 @@ where /// Build the import queue for the calamari/manta runtime. pub fn parachain_build_import_queue( - client: Arc>>, + client: Arc>, config: &Configuration, telemetry_handle: Option, task_manager: &TaskManager, -) -> Result< - sc_consensus::DefaultImportQueue< - Block, - TFullClient>, - >, - sc_service::Error, -> +) -> Result, Error> where - RuntimeApi: ConstructRuntimeApi>> - + Send - + Sync - + 'static, - RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: TaggedTransactionQueue + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt< - Block, - StateBackend = sc_client_api::StateBackendFor, Block>, - > + sp_offchain::OffchainWorkerApi + + SessionKeys + + ApiExt + + OffchainWorkerApi + sp_block_builder::BlockBuilder + sp_consensus_aura::AuraApi::Pair as Pair>::Public>, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + StateBackend: sp_api::StateBackend, Executor: sc_executor::NativeExecutionDispatch + 'static, <::Pair as Pair>::Signature: TryFrom> + std::hash::Hash + sp_runtime::traits::Member + Codec, @@ -589,7 +529,6 @@ where let aura_verifier = move || { let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client2).unwrap(); - Box::new(cumulus_client_consensus_aura::build_verifier::< ::Pair, _, @@ -617,7 +556,7 @@ where let relay_chain_verifier = Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) - })) as Box<_>; + })); let verifier = Verifier { client: client.clone(), @@ -639,43 +578,42 @@ where } /// Start a calamari/manta parachain node. -pub async fn start_parachain_node( +pub async fn start_parachain_node( parachain_config: Configuration, polkadot_config: Configuration, collator_options: CollatorOptions, id: ParaId, -) -> sc_service::error::Result<( - TaskManager, - Arc>>, -)> + rpc: RPC, +) -> Result<(TaskManager, Arc>), Error> where - RuntimeApi: ConstructRuntimeApi>> - + Send - + Sync - + 'static, - RuntimeApi::RuntimeApi: sp_transaction_pool::runtime_api::TaggedTransactionQueue + RuntimeApi: ConstructRuntimeApi> + Send + Sync + 'static, + RuntimeApi::RuntimeApi: TaggedTransactionQueue + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt< - Block, - StateBackend = sc_client_api::StateBackendFor, Block>, - > + sp_offchain::OffchainWorkerApi + + SessionKeys + + ApiExt + + OffchainWorkerApi + sp_block_builder::BlockBuilder + cumulus_primitives_core::CollectCollationInfo + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + frame_rpc_system::AccountNonceApi, - sc_client_api::StateBackendFor, Block>: sp_api::StateBackend, + StateBackend: sp_api::StateBackend, Executor: sc_executor::NativeExecutionDispatch + 'static, <::Pair as Pair>::Signature: TryFrom> + std::hash::Hash + sp_runtime::traits::Member + Codec, + RPC: Fn( + Arc>, + Arc>, + ) -> Box< + (dyn sc_service::RpcExtensionBuilder + Send + 'static), + >, { start_node_impl::( parachain_config, polkadot_config, collator_options, id, - |_| Ok(Default::default()), + rpc, parachain_build_import_queue::<_, _, AuraId>, |client, prometheus_registry, diff --git a/pallets/asset-manager/src/benchmarking.rs b/pallets/asset-manager/src/benchmarking.rs index 78f68745a..266102d8a 100644 --- a/pallets/asset-manager/src/benchmarking.rs +++ b/pallets/asset-manager/src/benchmarking.rs @@ -34,11 +34,11 @@ fn assert_last_event(generic_event: ::Event) { benchmarks! { where_clause { where >::AssetLocation: From } + register_asset { let location = >::AssetLocation::default(); let metadata = >::AssetRegistrarMetadata::default(); - - }: _(RawOrigin::Root, location.clone(), metadata.clone()) + }: _(RawOrigin::Root, location.clone(), metadata) verify { assert_eq!(Pallet::::asset_id_location(>::StartNonNativeAssetId::get()), Some(location)); } @@ -47,21 +47,17 @@ benchmarks! { let start = >::StartNonNativeAssetId::get(); let end = start + 1000; for i in start..end { - let location: MultiLocation = MultiLocation::new(0, X1(Parachain(i))); let location = >::AssetLocation::from(location.clone()); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; Pallet::::set_units_per_second(RawOrigin::Root.into(), i, 0)?; } - // does not really matter what we register, as long as it is different than the previous let location = >::AssetLocation::default(); let metadata = >::AssetRegistrarMetadata::default(); let amount = 10; - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; - + Pallet::::register_asset(RawOrigin::Root.into(), location, metadata)?; }: _(RawOrigin::Root, end, amount) verify { assert_eq!(Pallet::::get_units_per_second(end), Some(amount)); @@ -71,18 +67,15 @@ benchmarks! { let start = >::StartNonNativeAssetId::get(); let end = start + 1000; for i in start..end { - let location: MultiLocation = MultiLocation::new(0, X1(Parachain(i))); let location = >::AssetLocation::from(location.clone()); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; } - // does not really matter what we register, as long as it is different than the previous let location = >::AssetLocation::default(); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; + Pallet::::register_asset(RawOrigin::Root.into(), location, metadata)?; let new_location = >::AssetLocation::from(MultiLocation::new(0, X1(Parachain(end)))); }: _(RawOrigin::Root, end, new_location.clone()) verify { @@ -93,18 +86,15 @@ benchmarks! { let start = >::StartNonNativeAssetId::get(); let end = start + 1000; for i in start..end { - let location: MultiLocation = MultiLocation::new(0, X1(Parachain(i))); let location = >::AssetLocation::from(location.clone()); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; } - // does not really matter what we register, as long as it is different than the previous let location = >::AssetLocation::default(); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; + Pallet::::register_asset(RawOrigin::Root.into(), location, metadata.clone())?; }: _(RawOrigin::Root, end, metadata.clone()) verify { assert_last_event::(Event::AssetMetadataUpdated { asset_id: end, metadata }.into()); @@ -114,19 +104,16 @@ benchmarks! { let start = >::StartNonNativeAssetId::get(); let end = start + 1000; for i in start..end { - let location = >::AssetLocation::from(MultiLocation::new(0, X1(Parachain(i)))); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; } - let beneficiary: T::AccountId = whitelisted_caller(); let amount = 100; // does not really matter what we register, as long as it is different than the previous let location = >::AssetLocation::default(); let metadata = >::AssetRegistrarMetadata::default(); - Pallet::::register_asset(RawOrigin::Root.into(), location.clone(), metadata.clone())?; + Pallet::::register_asset(RawOrigin::Root.into(), location, metadata)?; }: _(RawOrigin::Root, end, beneficiary.clone(), amount) verify { assert_last_event::(Event::AssetMinted { asset_id: end, beneficiary, amount }.into()); diff --git a/pallets/asset-manager/src/lib.rs b/pallets/asset-manager/src/lib.rs index 94940ff7f..328c36a64 100644 --- a/pallets/asset-manager/src/lib.rs +++ b/pallets/asset-manager/src/lib.rs @@ -564,7 +564,7 @@ pub mod pallet { Self::get_para_id_from_multilocation(location.into().as_ref()) { if para_id != 2084 { - Self::increase_count_of_associated_assets(para_id); + let _ = Self::increase_count_of_associated_assets(para_id); reads += 1; // There's one read in method increase_count_of_associated_assets. writes += 1; // There's one write in method increase_count_of_associated_assets. } diff --git a/pallets/collator-selection/src/benchmarking.rs b/pallets/collator-selection/src/benchmarking.rs index 5c570c689..276297b49 100644 --- a/pallets/collator-selection/src/benchmarking.rs +++ b/pallets/collator-selection/src/benchmarking.rs @@ -130,7 +130,7 @@ benchmarks! { let origin = T::UpdateOrigin::successful_origin(); }: { assert_ok!( - >::set_desired_candidates(origin, max.clone()) + >::set_desired_candidates(origin, max) ); } verify { @@ -142,7 +142,7 @@ benchmarks! { let origin = T::UpdateOrigin::successful_origin(); }: { assert_ok!( - >::set_candidacy_bond(origin, bond.clone()) + >::set_candidacy_bond(origin, bond) ); } verify { @@ -186,7 +186,7 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); let bond: BalanceOf = T::Currency::minimum_balance() * 2u32.into(); - T::Currency::make_free_balance_be(&caller, bond.clone()); + T::Currency::make_free_balance_be(&caller, bond); >::set_keys( RawOrigin::Signed(caller.clone()).into(), @@ -249,7 +249,7 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); let bond: BalanceOf = T::Currency::minimum_balance() * 2u32.into(); - T::Currency::make_free_balance_be(&caller, bond.clone()); + T::Currency::make_free_balance_be(&caller, bond); >::set_keys( RawOrigin::Signed(caller.clone()).into(), diff --git a/pallets/collator-selection/src/lib.rs b/pallets/collator-selection/src/lib.rs index 22d714da7..3a0e99a3c 100644 --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -614,8 +614,7 @@ pub mod pallet { kick_candidates.iter().for_each(|(acc_id, my_blocks_this_session)| { if *my_blocks_this_session < evict_below_blocks { // If our validator is not also a candidate we're invulnerable or already kicked - if let Some(_) = candidates.iter().find(|&x|{ x.who == *acc_id }) - { + if candidates.iter().any(|x| x.who == *acc_id) { Self::try_remove_candidate(acc_id) .and_then(|_| { removed_account_ids.push(acc_id.clone()); diff --git a/pallets/collator-selection/src/migrations.rs b/pallets/collator-selection/src/migrations.rs index c4efe2f14..3f4460c67 100644 --- a/pallets/collator-selection/src/migrations.rs +++ b/pallets/collator-selection/src/migrations.rs @@ -23,7 +23,8 @@ use frame_support::{ traits::{Get, PalletInfoAccess, StorageVersion}, Twox64Concat, }; -/// This migrates the pallet from the standard version by parity to our modified storage + +/// This migrates the pallet from the standard version by parity to our modified storage. impl Pallet { pub fn migrate_v0_to_v1() -> frame_support::weights::Weight { use frame_support::migration::{ diff --git a/pallets/manta-pay/Cargo.toml b/pallets/manta-pay/Cargo.toml index 4f3f3a03e..5980d5300 100644 --- a/pallets/manta-pay/Cargo.toml +++ b/pallets/manta-pay/Cargo.toml @@ -23,6 +23,19 @@ required-features = ["precompute-coins"] # Default Features default = ["std"] +# RPC Interface +rpc = [ + "jsonrpc-core", + "jsonrpc-core-client", + "jsonrpc-derive", + "serde", + "sp-api", + "sp-blockchain", +] + +# Runtime API +runtime = ["sp-api"] + # Runtime Benchmarks runtime-benchmarks = [ "frame-benchmarking", @@ -31,6 +44,13 @@ runtime-benchmarks = [ "manta-primitives/runtime-benchmarks", ] +# Serde Serialization +serde = [ + "manta-pay/serde", + "manta-util/serde", + "manta-util/serde_with", +] + # Standard Library std = [ "frame-benchmarking/std", @@ -54,8 +74,8 @@ precompute-coins = [ [dependencies] # utils anyhow = { version = "1.0.55", optional = true } -indoc = { version = "1.0.3", default-features = false, optional = true} -rand = { version = "0.8.4", default-features = false, optional = true } +indoc = { version = "1.0.3", optional = true, default-features = false } +rand = { version = "0.8.4", optional = true, default-features = false } tempfile = { version = "3.3.0", optional = true } # substrate dependencies @@ -67,13 +87,21 @@ sp-std = { git = 'https://github.com/paritytech/substrate.git', branch = "polkad scale-codec = { package = "parity-scale-codec", version = '3.0.0', default-features = false, features = ["derive", "max-encoded-len"] } scale-info = { version = "2.0.0", default-features = false, features = ["derive"] } +sp-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18", optional = true, default-features = false } +sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18", optional = true, default-features = false } + +# JSON-RPC +jsonrpc-core = { version = "18.0.0", optional = true, default-features = false } +jsonrpc-core-client = { version = "18.0.0", optional = true, default-features = false } +jsonrpc-derive = { version = "18.0.0", optional = true, default-features = false } + # manta dependencies manta-accounting = { git = "https://github.com/manta-network/manta-rs.git", default-features = false } manta-crypto = { git = "https://github.com/manta-network/manta-rs.git", default-features = false } manta-pay = { git = "https://github.com/manta-network/manta-rs.git", default-features = false, features = ["groth16", "scale"] } manta-sdk = { git = "https://github.com/manta-network/sdk.git", default-features = false } manta-util = { git = "https://github.com/manta-network/manta-rs.git", default-features = false } -manta-primitives = { path = "../../primitives", default-features = false} +manta-primitives = { path = "../../primitives", default-features = false } [dev-dependencies] bencher = "0.1.5" @@ -86,6 +114,7 @@ pallet-balances = { git = 'https://github.com/paritytech/substrate.git', branch pallet-assets = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" } pallet-asset-manager = { path = "../asset-manager"} manta-sdk = { git = "https://github.com/manta-network/sdk.git", features = ["download"] } -tempfile = "3.3.0" rand = "0.8.4" +tempfile = "3.3.0" xcm = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.18" } +manta-util = { git = "https://github.com/manta-network/manta-rs.git", features = ["std"]} diff --git a/pallets/manta-pay/src/lib.rs b/pallets/manta-pay/src/lib.rs index 257a11630..d457b8369 100644 --- a/pallets/manta-pay/src/lib.rs +++ b/pallets/manta-pay/src/lib.rs @@ -81,6 +81,10 @@ use scale_codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; use types::*; +#[cfg(feature = "serde")] +use manta_util::serde::{Deserialize, Serialize}; + +pub use manta_pay::signer::{Checkpoint, RawCheckpoint}; pub use pallet::*; pub use weights::WeightInfo; @@ -90,11 +94,17 @@ mod mock; #[cfg(test)] mod test; +pub mod types; +pub mod weights; + #[cfg(feature = "runtime-benchmarks")] pub mod benchmark; -pub mod types; -pub mod weights; +#[cfg(feature = "rpc")] +pub mod rpc; + +#[cfg(feature = "runtime")] +pub mod runtime; /// MantaPay Pallet #[frame_support::pallet] @@ -132,37 +142,35 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet {} - /// Shards of the merkle tree of UTXOs + /// UTXOs and Encrypted Notes Grouped by Shard #[pallet::storage] pub(super) type Shards = - StorageDoubleMap<_, Identity, u8, Identity, u64, ([u8; 32], EncryptedNote), ValueQuery>; + StorageDoubleMap<_, Identity, u8, Identity, u64, (Utxo, EncryptedNote), ValueQuery>; - /// Shard merkle trees + /// Shard Merkle Tree Paths #[pallet::storage] pub(super) type ShardTrees = StorageMap<_, Identity, u8, UtxoMerkleTreePath, ValueQuery>; - /// Outputs of Utxo accumulator + /// Outputs of Utxo Accumulator #[pallet::storage] pub(super) type UtxoAccumulatorOutputs = - StorageMap<_, Identity, [u8; 32], (), ValueQuery>; + StorageMap<_, Identity, UtxoAccumulatorOutput, (), ValueQuery>; - /// Utxo set of MantaPay protocol + /// UTXO Set #[pallet::storage] - pub(super) type UtxoSet = StorageMap<_, Identity, [u8; 32], (), ValueQuery>; + pub(super) type UtxoSet = StorageMap<_, Identity, Utxo, (), ValueQuery>; - /// Void number set + /// Void Number Set #[pallet::storage] - pub(super) type VoidNumberSet = StorageMap<_, Identity, [u8; 32], (), ValueQuery>; + pub(super) type VoidNumberSet = StorageMap<_, Identity, VoidNumber, (), ValueQuery>; - /// Void number set insertion order - /// Each element of the key is an `u64` insertion order number of void number. + /// Void Number Ordered by Insertion #[pallet::storage] pub(super) type VoidNumberSetInsertionOrder = - StorageMap<_, Identity, u64, [u8; 32], ValueQuery>; + StorageMap<_, Identity, u64, VoidNumber, ValueQuery>; /// The size of Void Number Set - /// FIXME: this should be removed. #[pallet::storage] pub(super) type VoidNumberSetSize = StorageValue<_, u64, ValueQuery>; @@ -174,15 +182,7 @@ pub mod pallet { #[transactional] pub fn to_private(origin: OriginFor, post: TransferPost) -> DispatchResultWithPostInfo { let origin = ensure_signed(origin)?; - let mut ledger = Self::ledger(); - Self::deposit_event( - config::TransferPost::try_from(post) - .map_err(|_| Error::::InvalidSerializedForm)? - .post(vec![origin], vec![], &(), &mut ledger) - .map_err(Error::::from)? - .convert(None), - ); - Ok(().into()) + Self::post_transaction(None, vec![origin], vec![], post) } /// Transforms some private assets into public ones using `post`, depositing the public @@ -191,15 +191,7 @@ pub mod pallet { #[transactional] pub fn to_public(origin: OriginFor, post: TransferPost) -> DispatchResultWithPostInfo { let origin = ensure_signed(origin)?; - let mut ledger = Self::ledger(); - Self::deposit_event( - config::TransferPost::try_from(post) - .map_err(|_| Error::::InvalidSerializedForm)? - .post(vec![], vec![origin], &(), &mut ledger) - .map_err(Error::::from)? - .convert(None), - ); - Ok(().into()) + Self::post_transaction(None, vec![], vec![origin], post) } /// Transfers private assets encoded in `post`. @@ -215,15 +207,7 @@ pub mod pallet { post: TransferPost, ) -> DispatchResultWithPostInfo { let origin = ensure_signed(origin)?; - let mut ledger = Self::ledger(); - Self::deposit_event( - config::TransferPost::try_from(post) - .map_err(|_| Error::::InvalidSerializedForm)? - .post(vec![], vec![], &(), &mut ledger) - .map_err(Error::::from)? - .convert(Some(origin)), - ); - Ok(().into()) + Self::post_transaction(Some(origin), vec![], vec![], post) } /// Transfers public `asset` from `origin` to the `sink` account. @@ -480,19 +464,144 @@ pub mod pallet { where T: Config, { - /// Returns the ledger implementation for this pallet. + /// Maximum Number of Updates per Shard + const PULL_MAX_PER_SHARD_UPDATE_SIZE: usize = 128; + + /// Maximum Size of Sender Data Update + const PULL_MAX_SENDER_UPDATE_SIZE: usize = 1024; + + /// Pulls receiver data from the ledger starting at the `receiver_index`. #[inline] - fn ledger() -> Ledger { - Ledger(PhantomData) + fn pull_receivers(receiver_index: &mut [usize; 256]) -> (bool, ReceiverChunk) { + let mut more_receivers = false; + let mut receivers = Vec::new(); + for (i, index) in receiver_index.iter_mut().enumerate() { + more_receivers |= Self::pull_receivers_for_shard(i as u8, index, &mut receivers); + } + (more_receivers, receivers) + } + + /// Pulls receiver data from the shard at `shard_index` starting at the `receiver_index`, + /// pushing the results back to `receivers`. + #[inline] + fn pull_receivers_for_shard( + shard_index: u8, + receiver_index: &mut usize, + receivers: &mut ReceiverChunk, + ) -> bool { + let mut iter = if *receiver_index == 0 { + Shards::::iter_prefix(shard_index) + } else { + let raw_key = Shards::::hashed_key_for(shard_index, *receiver_index as u64 - 1); + Shards::::iter_prefix_from(shard_index, raw_key) + }; + for _ in 0..Self::PULL_MAX_PER_SHARD_UPDATE_SIZE { + match iter.next() { + Some((_, (utxo, encrypted_note))) => { + *receiver_index += 1; + receivers.push((utxo, encrypted_note)); + } + _ => return false, + } + } + iter.next().is_some() + } + + /// Pulls sender data from the ledger starting at the `sender_index`. + #[inline] + fn pull_senders(sender_index: &mut usize) -> (bool, SenderChunk) { + let mut senders = Vec::new(); + let mut iter = VoidNumberSetInsertionOrder::::iter().skip(*sender_index); + for _ in 0..Self::PULL_MAX_SENDER_UPDATE_SIZE { + match iter.next() { + Some((_, sender)) => { + *sender_index += 1; + senders.push(sender); + } + _ => return (false, senders), + } + } + (iter.next().is_some(), senders) } - /// The account ID of AssetManager + /// Returns the diff of ledger state of mantaPay since `checkpoint`. + /// `PullResponse` contains: + /// * `should_continue`: a boolean flag to indicate if there is more to pull + /// * `checkpoint`: updated checkpoint + /// * `receivers`: receivers diff + /// * `senders`: senders diff + #[inline] + pub fn pull_ledger_diff(mut checkpoint: Checkpoint) -> PullResponse { + let (more_receivers, receivers) = Self::pull_receivers(&mut checkpoint.receiver_index); + let (more_senders, senders) = Self::pull_senders(&mut checkpoint.sender_index); + PullResponse { + should_continue: more_receivers || more_senders, + checkpoint, + receivers, + senders, + } + } + + /// Returns the account ID of this pallet. + #[inline] pub fn account_id() -> T::AccountId { T::PalletId::get().into_account() } + + /// Posts the transaction encoded in `post` to the ledger, using `sources` and `sinks` as + /// the public deposit and public withdraw accounts respectively. + #[inline] + fn post_transaction( + origin: Option, + sources: Vec, + sinks: Vec, + post: TransferPost, + ) -> DispatchResultWithPostInfo { + Self::deposit_event( + config::TransferPost::try_from(post) + .map_err(|_| Error::::InvalidSerializedForm)? + .post(sources, sinks, &(), &mut Ledger(PhantomData)) + .map_err(Error::::from)? + .convert(origin), + ); + Ok(().into()) + } } } +/// Receiver Chunk Data Type +pub type ReceiverChunk = Vec<(Utxo, EncryptedNote)>; + +/// Sender Chunk Data Type +pub type SenderChunk = Vec; + +/// Ledger Source Pull Response +#[cfg_attr( + feature = "serde", + derive(Deserialize, Serialize), + serde(crate = "manta_util::serde", deny_unknown_fields) +)] +#[derive(Clone, Debug, Decode, Default, Encode, Eq, Hash, PartialEq, TypeInfo)] +pub struct PullResponse { + /// Pull Continuation Flag + /// + /// The `should_continue` flag is set to `true` if the client should request more data from the + /// ledger to finish the pull. + pub should_continue: bool, + + /// Ledger Checkpoint + /// + /// If the `should_continue` flag is set to `true` then `checkpoint` is the next [`Checkpoint`] + /// to request data from the ledger. Otherwise, it represents the current ledger state. + pub checkpoint: Checkpoint, + + /// Ledger Receiver Chunk + pub receivers: ReceiverChunk, + + /// Ledger Sender Chunk + pub senders: SenderChunk, +} + /// Preprocessed Event enum PreprocessedEvent where diff --git a/pallets/manta-pay/src/rpc.rs b/pallets/manta-pay/src/rpc.rs new file mode 100644 index 000000000..4691f4539 --- /dev/null +++ b/pallets/manta-pay/src/rpc.rs @@ -0,0 +1,74 @@ +// Copyright 2019-2022 Manta Network. +// This file is part of pallet-manta-pay. +// +// pallet-manta-pay is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// pallet-manta-pay is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with pallet-manta-pay. If not, see . + +//! MantaPay RPC Interfaces + +use crate::{runtime::PullLedgerDiffApi, PullResponse}; +use alloc::sync::Arc; +use core::marker::PhantomData; +use jsonrpc_core::{Error, ErrorCode, Result}; +use jsonrpc_derive::rpc; +use manta_pay::signer::Checkpoint; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; +use sp_runtime::{generic::BlockId, traits::Block}; + +/// Pull API +#[rpc(server)] +pub trait PullApi { + /// Returns the update required to be synchronized with the ledger starting from + /// `checkpoint`. + #[rpc(name = "mantaPay_pull_ledger_diff")] + fn pull_ledger_diff(&self, checkpoint: Checkpoint) -> Result; +} + +/// Pull RPC API Implementation +pub struct Pull { + /// Client + client: Arc, + + /// Type Parameter Marker + __: PhantomData, +} + +impl Pull { + /// Builds a new [`Pull`] RPC API implementation. + #[inline] + pub fn new(client: Arc) -> Self { + Self { + client, + __: PhantomData, + } + } +} + +impl PullApi for Pull +where + B: Block, + C: 'static + ProvideRuntimeApi + HeaderBackend, + C::Api: PullLedgerDiffApi, +{ + #[inline] + fn pull_ledger_diff(&self, checkpoint: Checkpoint) -> Result { + let api = self.client.runtime_api(); + let at = BlockId::hash(self.client.info().best_hash); + api.pull_ledger_diff(&at, checkpoint.into()).map_err(|err| Error { + code: ErrorCode::ServerError(1), + message: "Unable to compute state diff for pull".into(), + data: Some(err.to_string().into()), + }) + } +} diff --git a/pallets/manta-pay/src/runtime.rs b/pallets/manta-pay/src/runtime.rs new file mode 100644 index 000000000..2414cd51e --- /dev/null +++ b/pallets/manta-pay/src/runtime.rs @@ -0,0 +1,26 @@ +// Copyright 2019-2022 Manta Network. +// This file is part of pallet-manta-pay. +// +// pallet-manta-pay is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// pallet-manta-pay is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with pallet-manta-pay. If not, see . + +//! MantaPay Runtime APIs + +use crate::PullResponse; +use manta_pay::signer::RawCheckpoint; + +sp_api::decl_runtime_apis! { + pub trait PullLedgerDiffApi { + fn pull_ledger_diff(checkpoint: RawCheckpoint) -> PullResponse; + } +} diff --git a/pallets/manta-pay/src/types.rs b/pallets/manta-pay/src/types.rs index 6aafaafb4..f62f5bc36 100644 --- a/pallets/manta-pay/src/types.rs +++ b/pallets/manta-pay/src/types.rs @@ -18,12 +18,17 @@ use super::*; use manta_util::into_array_unchecked; +use scale_codec::Error; + +#[cfg(feature = "rpc")] +use manta_util::serde::{Deserialize, Serialize}; pub(crate) const CIPHER_TEXT_LENGTH: usize = 68; pub(crate) const EPHEMERAL_PUBLIC_KEY_LENGTH: usize = 32; pub(crate) const UTXO_ACCUMULATOR_OUTPUT_LENGTH: usize = 32; pub(crate) const UTXO_LENGTH: usize = 32; pub(crate) const VOID_NUMBER_LENGTH: usize = 32; +pub(crate) const PROOF_LENGTH: usize = 192; /// Encodes the SCALE encodable `value` into a byte array with the given length `N`. #[inline] @@ -37,13 +42,31 @@ where /// Decodes the `bytes` array of the given length `N` into the SCALE decodable type `T` returning a /// blanket error if decoding fails. #[inline] -pub(crate) fn decode(bytes: [u8; N]) -> Result +pub(crate) fn decode(bytes: [u8; N]) -> Result where T: Decode, { - T::decode(&mut bytes.as_slice()).map_err(|_| ()) + T::decode(&mut bytes.as_slice()) } +/// Group Type +pub type Group = [u8; EPHEMERAL_PUBLIC_KEY_LENGTH]; + +/// UTXO Type +pub type Utxo = [u8; UTXO_LENGTH]; + +/// Void Number Type +pub type VoidNumber = [u8; VOID_NUMBER_LENGTH]; + +/// UTXO Accumulator Output Type +pub type UtxoAccumulatorOutput = [u8; UTXO_ACCUMULATOR_OUTPUT_LENGTH]; + +/// Ciphertext Type +pub type Ciphertext = [u8; CIPHER_TEXT_LENGTH]; + +/// Transfer Proof Type +pub type Proof = [u8; PROOF_LENGTH]; + /// Asset #[derive( Clone, @@ -77,13 +100,24 @@ impl Asset { } /// Encrypted Note +#[cfg_attr( + feature = "rpc", + derive(Deserialize, Serialize), + serde(crate = "manta_util::serde", deny_unknown_fields) +)] #[derive(Clone, Debug, Decode, Encode, Eq, Hash, MaxEncodedLen, PartialEq, TypeInfo)] pub struct EncryptedNote { /// Ephemeral Public Key - pub ephemeral_public_key: [u8; EPHEMERAL_PUBLIC_KEY_LENGTH], + pub ephemeral_public_key: Group, /// Ciphertext - pub ciphertext: [u8; CIPHER_TEXT_LENGTH], + #[cfg_attr( + feature = "rpc", + serde( + with = "manta_util::serde_with::As::<[manta_util::serde_with::Same; CIPHER_TEXT_LENGTH]>" + ) + )] + pub ciphertext: Ciphertext, } impl Default for EncryptedNote { @@ -107,7 +141,7 @@ impl From for EncryptedNote { } impl TryFrom for config::EncryptedNote { - type Error = (); + type Error = Error; #[inline] fn try_from(encrypted_note: EncryptedNote) -> Result { @@ -122,10 +156,10 @@ impl TryFrom for config::EncryptedNote { #[derive(Clone, Debug, Decode, Encode, Eq, Hash, MaxEncodedLen, PartialEq, TypeInfo)] pub struct SenderPost { /// UTXO Accumulator Output - pub utxo_accumulator_output: [u8; UTXO_ACCUMULATOR_OUTPUT_LENGTH], + pub utxo_accumulator_output: UtxoAccumulatorOutput, /// Void Number - pub void_number: [u8; VOID_NUMBER_LENGTH], + pub void_number: VoidNumber, } impl From for SenderPost { @@ -139,7 +173,7 @@ impl From for SenderPost { } impl TryFrom for config::SenderPost { - type Error = (); + type Error = Error; #[inline] fn try_from(post: SenderPost) -> Result { @@ -154,7 +188,7 @@ impl TryFrom for config::SenderPost { #[derive(Clone, Debug, Decode, Encode, Eq, Hash, MaxEncodedLen, PartialEq, TypeInfo)] pub struct ReceiverPost { /// Unspent Transaction Output - pub utxo: [u8; UTXO_LENGTH], + pub utxo: Utxo, /// Encrypted Note pub encrypted_note: EncryptedNote, @@ -171,7 +205,7 @@ impl From for ReceiverPost { } impl TryFrom for config::ReceiverPost { - type Error = (); + type Error = Error; #[inline] fn try_from(post: ReceiverPost) -> Result { @@ -201,7 +235,7 @@ pub struct TransferPost { pub sinks: Vec, /// Validity Proof - pub validity_proof: [u8; 192], + pub validity_proof: Proof, } impl From for TransferPost { @@ -219,7 +253,7 @@ impl From for TransferPost { } impl TryFrom for config::TransferPost { - type Error = (); + type Error = Error; #[inline] fn try_from(post: TransferPost) -> Result { diff --git a/pallets/tx-pause/src/benchmarking.rs b/pallets/tx-pause/src/benchmarking.rs index 8c4a9ef07..cc4b68eeb 100644 --- a/pallets/tx-pause/src/benchmarking.rs +++ b/pallets/tx-pause/src/benchmarking.rs @@ -22,12 +22,10 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; - +use crate::Pallet as TransactionPause; use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; use frame_system::{EventRecord, RawOrigin}; -use crate::Pallet as TransactionPause; - pub fn assert_last_event(generic_event: ::Event) { let events = frame_system::Pallet::::events(); let system_event: ::Event = generic_event.into(); @@ -36,7 +34,6 @@ pub fn assert_last_event(generic_event: ::Event) { } benchmarks! { - // Benchmark `pause_transaction` extrinsic: pause_transaction { let pallet_name = b"Balances".to_vec(); @@ -44,7 +41,7 @@ benchmarks! { }: pause_transaction(RawOrigin::Root, pallet_name.clone(), function_name.clone()) verify { assert_last_event::( - Event::TransactionPaused(pallet_name.clone(), function_name.clone()).into() + Event::TransactionPaused(pallet_name.clone(), function_name).into() ); } @@ -53,13 +50,11 @@ benchmarks! { let origin: T::Origin = T::Origin::from(RawOrigin::Root); let pallet_name = b"Balances".to_vec(); let function_name = b"transfer".to_vec(); - - TransactionPause::::pause_transaction(origin.clone(), pallet_name.clone(), function_name.clone())?; - + TransactionPause::::pause_transaction(origin, pallet_name.clone(), function_name.clone())?; }: unpause_transaction(RawOrigin::Root, pallet_name.clone(), function_name.clone()) verify { assert_last_event::( - Event::TransactionUnpaused(pallet_name.clone(), function_name.clone()).into() + Event::TransactionUnpaused(pallet_name, function_name).into() ); } } diff --git a/pallets/vesting/src/benchmarking.rs b/pallets/vesting/src/benchmarking.rs index 4e49bd2e0..90d941750 100644 --- a/pallets/vesting/src/benchmarking.rs +++ b/pallets/vesting/src/benchmarking.rs @@ -19,8 +19,7 @@ extern crate alloc; use super::*; -#[allow(unused_imports)] -use crate::Pallet as CalamariVesting; +use crate::Pallet; use core::{ops::Div, time::Duration}; use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller}; use frame_support::assert_ok; @@ -49,12 +48,10 @@ fn init_setup< .saturated_into::() + 1; pallet_timestamp::Pallet::::set_timestamp(now); - let existential_deposit = >::ExistentialDeposit::get(); let amount = existential_deposit.saturating_mul(ED_MULTIPLIER.into()); let source_caller = T::Lookup::unlookup(caller.clone()); - let _ = pallet_balances::Pallet::::make_free_balance_be(&caller, amount); - + let _ = pallet_balances::Pallet::::make_free_balance_be(caller, amount); assert_ok!(pallet_balances::Pallet::::set_balance( RawOrigin::Root.into(), source_caller, @@ -92,13 +89,20 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); let recipient: T::AccountId = account("receiver", 0, SEED); let source_recipient = T::Lookup::unlookup(recipient.clone()); - init_setup::(&caller); let existential_deposit = >::ExistentialDeposit::get(); - let unvested = existential_deposit.saturating_mul(ED_MULTIPLIER.div(10u32).into()).saturated_into::().try_into().ok().unwrap(); - assert_ok!(crate::Pallet::::vested_transfer(RawOrigin::Signed(caller.clone()).into(), source_recipient, unvested)); + let unvested = existential_deposit + .saturating_mul(ED_MULTIPLIER.div(10u32).into()) + .saturated_into::() + .try_into() + .ok() + .unwrap(); + assert_ok!( + crate::Pallet::::vested_transfer( + RawOrigin::Signed(caller).into(), source_recipient, unvested + ) + ); assert!(crate::Pallet::::vesting_balance(&recipient).is_some()); - let now = Duration::from_secs(1660694400) .as_millis() .saturated_into::() @@ -113,7 +117,12 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); init_setup::(&caller); let existential_deposit = >::ExistentialDeposit::get(); - let unvested = existential_deposit.saturating_mul(ED_MULTIPLIER.div(10u32).into()).saturated_into::().try_into().ok().unwrap(); + let unvested = existential_deposit + .saturating_mul(ED_MULTIPLIER.div(10u32).into()) + .saturated_into::() + .try_into() + .ok() + .unwrap(); let recipient: T::AccountId = account("receiver", 0, SEED); let source_recipient = T::Lookup::unlookup(recipient.clone()); }: _(RawOrigin::Signed(caller.clone()), source_recipient, unvested) @@ -124,7 +133,7 @@ benchmarks! { } impl_benchmark_test_suite!( - CalamariVesting, + Pallet, crate::mock::ExtBuilder::default() .existential_deposit(1) .build(), diff --git a/primitives/src/assets.rs b/primitives/src/assets.rs index e21464d57..219379dcf 100644 --- a/primitives/src/assets.rs +++ b/primitives/src/assets.rs @@ -444,7 +444,7 @@ where >::deposit_creating(beneficiary, amount); } else { >::mint_into(asset_id, beneficiary, amount) - .map_err(|e| FungibleLedgerError::InvalidMint(e))?; + .map_err(FungibleLedgerError::InvalidMint)?; } Ok(()) } @@ -474,6 +474,6 @@ where ) .map(|_| ()) } - .map_err(|e| FungibleLedgerError::InvalidTransfer(e)) + .map_err(FungibleLedgerError::InvalidTransfer) } } diff --git a/runtime/calamari/src/lib.rs b/runtime/calamari/src/lib.rs index 651141015..b44790314 100644 --- a/runtime/calamari/src/lib.rs +++ b/runtime/calamari/src/lib.rs @@ -907,8 +907,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsReversedWithSystemFirst::storage_info(); - - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/runtime/dolphin/Cargo.toml b/runtime/dolphin/Cargo.toml index 12800f998..97c1d3a38 100644 --- a/runtime/dolphin/Cargo.toml +++ b/runtime/dolphin/Cargo.toml @@ -85,7 +85,7 @@ manta-primitives = { path = '../../primitives', default-features = false } manta-collator-selection = { path = '../../pallets/collator-selection', default-features = false } pallet-tx-pause = { path = '../../pallets/tx-pause', default-features = false } pallet-asset-manager = { path = '../../pallets/asset-manager', default-features = false } -pallet-manta-pay = { path='../../pallets/manta-pay', default-features = false } +pallet-manta-pay = { path='../../pallets/manta-pay', default-features = false, features = ["runtime"] } runtime-common = { path = '../common', default-features = false } # Third party (vendored) dependencies diff --git a/runtime/dolphin/src/lib.rs b/runtime/dolphin/src/lib.rs index 0b55a806e..2c1e0b64a 100644 --- a/runtime/dolphin/src/lib.rs +++ b/runtime/dolphin/src/lib.rs @@ -31,11 +31,11 @@ use sp_runtime::{ transaction_validity::{TransactionSource, TransactionValidity}, ApplyExtrinsicResult, Perbill, Permill, }; - use sp_std::{cmp::Ordering, prelude::*}; +use sp_version::RuntimeVersion; + #[cfg(feature = "std")] use sp_version::NativeVersion; -use sp_version::RuntimeVersion; use frame_support::{ construct_runtime, parameter_types, @@ -869,6 +869,12 @@ impl_runtime_apis! { } } + impl pallet_manta_pay::runtime::PullLedgerDiffApi for Runtime { + fn pull_ledger_diff(checkpoint: pallet_manta_pay::RawCheckpoint) -> pallet_manta_pay::PullResponse { + MantaPay::pull_ledger_diff(checkpoint.into()) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade() -> (Weight, Weight) { diff --git a/runtime/manta/src/lib.rs b/runtime/manta/src/lib.rs index abd14f4e4..eb5726ebc 100644 --- a/runtime/manta/src/lib.rs +++ b/runtime/manta/src/lib.rs @@ -813,8 +813,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsReversedWithSystemFirst::storage_info(); - - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -861,7 +860,6 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { let relay_chain_slot = relay_state_proof .read_slot() .expect("Could not read the relay chain slot from the proof"); - let inherent_data = cumulus_primitives_timestamp::InherentDataProvider::from_relay_chain_slot_and_duration( relay_chain_slot, @@ -869,7 +867,6 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { ) .create_inherent_data() .expect("Could not create the timestamp inherent data"); - inherent_data.check_extrinsics(block) } } diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..0e8332225 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,7 @@ +Functional Tests for Manta +========================== + +Get data from `mantaPay_pull` rpc methods: +```bash +yarn ts-node index.ts +``` \ No newline at end of file diff --git a/tests/index.ts b/tests/index.ts new file mode 100644 index 000000000..4d374176e --- /dev/null +++ b/tests/index.ts @@ -0,0 +1,42 @@ +import { ApiPromise, WsProvider } from '@polkadot/api'; + +// Construct +const wsProvider = new WsProvider('ws://127.0.0.1:9800'); +async function main(){ + const api = await ApiPromise.create({ + provider: wsProvider, + types: { + Checkpoint: { + receiver_index: '[u64; 256]', + sender_index: 'u64' + }, + EncryptedNote: { + ephemeral_public_key: '[u8; 32]', + ciphertext: '[u8; 68]' + }, + PullResponse: { + should_continue: 'bool', + checkpoint: 'Checkpoint', + receivers: 'Vec<([u8; 32], EncryptedNote)>', + senders: 'Vec<[u8; 32]>', + } + }, + rpc: { + mantaPay: { + pull_ledger_diff: { + description: 'pull from mantaPay', + params: [ + { + name: 'checkpoint', + type: 'Checkpoint' + } + ], + type: 'PullResponse' + } + } + }}); + const payload = await (api.rpc as any).mantaPay.pull_ledger_diff({receiver_index: new Array(256).fill(0), sender_index: 0}); + console.log(payload); +} + +main().catch(console.error).finally(() => process.exit()); diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 000000000..0fd871f83 --- /dev/null +++ b/tests/package.json @@ -0,0 +1,19 @@ +{ + "name": "manta-tests", + "version": "1.0.0", + "description": "Functional Tests for Manta", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "@polkadot/api": "^7.10.1", + "@polkadot/types": "^7.10.1", + "@types/yargs": "^17.0.0", + "ts-node": "^10.8.0", + "typescript": "4.6.4" + } +} diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 000000000..7c11c3f12 --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es2016", + "module": "commonjs", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true + } +} diff --git a/tests/yarn.lock b/tests/yarn.lock new file mode 100644 index 000000000..ecabcf5fe --- /dev/null +++ b/tests/yarn.lock @@ -0,0 +1,786 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@babel/runtime@^7.17.8": + version "7.18.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.0.tgz#6d77142a19cb6088f0af662af1ada37a604d34ae" + integrity sha512-YMQvx/6nKEaucl0MY56mwIG483xk8SDNdlUwb2Ts6FUpr7fm85DxEmsY18LXBNhcTz6tO6JwZV8w1W06v8UKeg== + dependencies: + regenerator-runtime "^0.13.4" + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz#30cd49820a962aff48c8fffc5cd760151fca61fe" + integrity sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.13" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c" + integrity sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@noble/hashes@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.0.0.tgz#d5e38bfbdaba174805a4e649f13be9a9ed3351ae" + integrity sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg== + +"@noble/secp256k1@1.5.5": + version "1.5.5" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.5.5.tgz#315ab5745509d1a8c8e90d0bdf59823ccf9bcfc3" + integrity sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ== + +"@polkadot/api-augment@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-7.15.1.tgz#120b766feeaa96996f1c6717a5261c2e0845c1e0" + integrity sha512-7csQLS6zuYuGq7W1EkTBz1ZmxyRvx/Qpz7E7zPSwxmY8Whb7Yn2effU9XF0eCcRpyfSW8LodF8wMmLxGYs1OaQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/api-base" "7.15.1" + "@polkadot/rpc-augment" "7.15.1" + "@polkadot/types" "7.15.1" + "@polkadot/types-augment" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/util" "^8.7.1" + +"@polkadot/api-base@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-7.15.1.tgz#7567595be68431cc4085c48b18ba66933ff7b4d9" + integrity sha512-UlhLdljJPDwGpm5FxOjvJNFTxXMRFaMuVNx6EklbuetbBEJ/Amihhtj0EJRodxQwtZ4ZtPKYKt+g+Dn7OJJh4g== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/rpc-core" "7.15.1" + "@polkadot/types" "7.15.1" + "@polkadot/util" "^8.7.1" + rxjs "^7.5.5" + +"@polkadot/api-derive@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-7.15.1.tgz#450542bb7d848013225d6c8480648340e5ee6a61" + integrity sha512-CsOQppksQBaa34L1fWRzmfQQpoEBwfH0yTTQxgj3h7rFYGVPxEKGeFjo1+IgI2vXXvOO73Z8E4H/MnbxvKrs1Q== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/api" "7.15.1" + "@polkadot/api-augment" "7.15.1" + "@polkadot/api-base" "7.15.1" + "@polkadot/rpc-core" "7.15.1" + "@polkadot/types" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/util" "^8.7.1" + "@polkadot/util-crypto" "^8.7.1" + rxjs "^7.5.5" + +"@polkadot/api@7.15.1", "@polkadot/api@^7.10.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-7.15.1.tgz#24eaeaa8ffbc6f30ff3d9846a816a18a688ceb8b" + integrity sha512-z0z6+k8+R9ixRMWzfsYrNDnqSV5zHKmyhTCL0I7+1I081V18MJTCFUKubrh0t1gD0/FCt3U9Ibvr4IbtukYLrQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/api-augment" "7.15.1" + "@polkadot/api-base" "7.15.1" + "@polkadot/api-derive" "7.15.1" + "@polkadot/keyring" "^8.7.1" + "@polkadot/rpc-augment" "7.15.1" + "@polkadot/rpc-core" "7.15.1" + "@polkadot/rpc-provider" "7.15.1" + "@polkadot/types" "7.15.1" + "@polkadot/types-augment" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/types-create" "7.15.1" + "@polkadot/types-known" "7.15.1" + "@polkadot/util" "^8.7.1" + "@polkadot/util-crypto" "^8.7.1" + eventemitter3 "^4.0.7" + rxjs "^7.5.5" + +"@polkadot/keyring@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-8.7.1.tgz#07cf6d6ee351dcf70fbf965b1d6d96c5025ae1b8" + integrity sha512-t6ZgQVC+nQT7XwbWtEhkDpiAzxKVJw8Xd/gWdww6xIrawHu7jo3SGB4QNdPgkf8TvDHYAAJiupzVQYAlOIq3GA== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/util" "8.7.1" + "@polkadot/util-crypto" "8.7.1" + +"@polkadot/networks@8.7.1", "@polkadot/networks@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-8.7.1.tgz#26c2ec6158c985bb77c510d98a3ab1c7e049f89c" + integrity sha512-8xAmhDW0ry5EKcEjp6VTuwoTm0DdDo/zHsmx88P6sVL87gupuFsL+B6TrsYLl8GcaqxujwrOlKB+CKTUg7qFKg== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/util" "8.7.1" + "@substrate/ss58-registry" "^1.17.0" + +"@polkadot/rpc-augment@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-7.15.1.tgz#391a42a9c3e553335a2a544598a717b47654ad6e" + integrity sha512-sK0+mphN7nGz/eNPsshVi0qd0+N0Pqxuebwc1YkUGP0f9EkDxzSGp6UjGcSwWVaAtk9WZZ1MpK1Jwb/2GrKV7Q== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/rpc-core" "7.15.1" + "@polkadot/types" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/util" "^8.7.1" + +"@polkadot/rpc-core@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-7.15.1.tgz#47855cf05bd2f8dbf87d9f1f77343114e61c664a" + integrity sha512-4Sb0e0PWmarCOizzxQAE1NQSr5z0n+hdkrq3+aPohGu9Rh4PodG+OWeIBy7Ov/3GgdhNQyBLG+RiVtliXecM3g== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/rpc-augment" "7.15.1" + "@polkadot/rpc-provider" "7.15.1" + "@polkadot/types" "7.15.1" + "@polkadot/util" "^8.7.1" + rxjs "^7.5.5" + +"@polkadot/rpc-provider@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-7.15.1.tgz#a213de907a6f4f480c3c819aa95e4e60d4247f84" + integrity sha512-n0RWfSaD/r90JXeJkKry1aGZwJeBUUiMpXUQ9Uvp6DYBbYEDs0fKtWLpdT3PdFrMbe5y3kwQmNLxwe6iF4+mzg== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/keyring" "^8.7.1" + "@polkadot/types" "7.15.1" + "@polkadot/types-support" "7.15.1" + "@polkadot/util" "^8.7.1" + "@polkadot/util-crypto" "^8.7.1" + "@polkadot/x-fetch" "^8.7.1" + "@polkadot/x-global" "^8.7.1" + "@polkadot/x-ws" "^8.7.1" + "@substrate/connect" "0.7.0-alpha.0" + eventemitter3 "^4.0.7" + mock-socket "^9.1.2" + nock "^13.2.4" + +"@polkadot/types-augment@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-7.15.1.tgz#437047f961b8d29e5ffd4fd59cd35f0e6374750b" + integrity sha512-aqm7xT/66TCna0I2utpIekoquKo0K5pnkA/7WDzZ6gyD8he2h0IXfe8xWjVmuyhjxrT/C/7X1aUF2Z0xlOCwzQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/types" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/util" "^8.7.1" + +"@polkadot/types-codec@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-7.15.1.tgz#c0155867efd3ae35e15fea6a8aab49c2c63988fa" + integrity sha512-nI11dT7FGaeDd/fKPD8iJRFGhosOJoyjhZ0gLFFDlKCaD3AcGBRTTY8HFJpP/5QXXhZzfZsD93fVKrosnegU0Q== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/util" "^8.7.1" + +"@polkadot/types-create@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-7.15.1.tgz#ec4cafa314a82a25a109f0f52207e9169fc9b003" + integrity sha512-+HiaHn7XOwP0kv/rVdORlVkNuMoxuvt+jd67A/CeEreJiXqRLu+S61Mdk7wi6719PTaOal1hTDFfyGrtUd8FSQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/types-codec" "7.15.1" + "@polkadot/util" "^8.7.1" + +"@polkadot/types-known@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-7.15.1.tgz#71dbf0835a48cdc97d0f50b0000298687e29818d" + integrity sha512-LMcNP0CxT84DqAKV62/qDeeIVIJCR5yzE9b+9AsYhyfhE4apwxjrThqZA7K0CF56bOdQJSexAerYB/jwk2IijA== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/networks" "^8.7.1" + "@polkadot/types" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/types-create" "7.15.1" + "@polkadot/util" "^8.7.1" + +"@polkadot/types-support@7.15.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-7.15.1.tgz#9c274759647dd89d46ea9cf74d593bcedcd85527" + integrity sha512-FIK251ffVo+NaUXLlaJeB5OvT7idDd3uxaoBM6IwsS87rzt2CcWMyCbu0uX89AHZUhSviVx7xaBxfkGEqMePWA== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/util" "^8.7.1" + +"@polkadot/types@7.15.1", "@polkadot/types@^7.10.1": + version "7.15.1" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-7.15.1.tgz#fb78886f4437fbc472e01019846fb1f229d2a177" + integrity sha512-KawZVS+eLR1D6O7c/P5cSUwr6biM9Qd2KwKtJIO8l1Mrxp7r+y2tQnXSSXVAd6XPdb3wVMhnIID+NW3W99TAnQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/keyring" "^8.7.1" + "@polkadot/types-augment" "7.15.1" + "@polkadot/types-codec" "7.15.1" + "@polkadot/types-create" "7.15.1" + "@polkadot/util" "^8.7.1" + "@polkadot/util-crypto" "^8.7.1" + rxjs "^7.5.5" + +"@polkadot/util-crypto@8.7.1", "@polkadot/util-crypto@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-8.7.1.tgz#f9fcca2895b5f160ce1c2faa0aa3054cc7aa4655" + integrity sha512-TaSuJ2aNrB5sYK7YXszkEv24nYJKRFqjF2OrggoMg6uYxUAECvTkldFnhtgeizMweRMxJIBu6bMHlSIutbWgjw== + dependencies: + "@babel/runtime" "^7.17.8" + "@noble/hashes" "1.0.0" + "@noble/secp256k1" "1.5.5" + "@polkadot/networks" "8.7.1" + "@polkadot/util" "8.7.1" + "@polkadot/wasm-crypto" "^5.1.1" + "@polkadot/x-bigint" "8.7.1" + "@polkadot/x-randomvalues" "8.7.1" + "@scure/base" "1.0.0" + ed2curve "^0.3.0" + tweetnacl "^1.0.3" + +"@polkadot/util@8.7.1", "@polkadot/util@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-8.7.1.tgz#27fe93bf7b8345276f10cfe9c0380510cd4584f6" + integrity sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-bigint" "8.7.1" + "@polkadot/x-global" "8.7.1" + "@polkadot/x-textdecoder" "8.7.1" + "@polkadot/x-textencoder" "8.7.1" + "@types/bn.js" "^5.1.0" + bn.js "^5.2.0" + ip-regex "^4.3.0" + +"@polkadot/wasm-crypto-asmjs@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-5.1.1.tgz#6648e9c6f627501f61aef570e110022f2be1eff2" + integrity sha512-1WBwc2G3pZMKW1T01uXzKE30Sg22MXmF3RbbZiWWk3H2d/Er4jZQRpjumxO5YGWan+xOb7HQQdwnrUnrPgbDhg== + dependencies: + "@babel/runtime" "^7.17.8" + +"@polkadot/wasm-crypto-wasm@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-5.1.1.tgz#dc371755a05fe93f87a2754a2bcf1ff42e4bb541" + integrity sha512-F9PZ30J2S8vUNl2oY7Myow5Xsx5z5uNVpnNlJwlmY8IXBvyucvyQ4HSdhJsrbs4W1BfFc0mHghxgp0FbBCnf/Q== + dependencies: + "@babel/runtime" "^7.17.8" + +"@polkadot/wasm-crypto@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-5.1.1.tgz#d1f8a0da631028ba904c374c1e8496ab3ba4636b" + integrity sha512-JCcAVfH8DhYuEyd4oX1ouByxhou0TvpErKn8kHjtzt7+tRoFi0nzWlmK4z49vszsV3JJgXxV81i10C0BYlwTcQ== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/wasm-crypto-asmjs" "^5.1.1" + "@polkadot/wasm-crypto-wasm" "^5.1.1" + +"@polkadot/x-bigint@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-8.7.1.tgz#a496225def32e98c430c76b91c1579f48acf501a" + integrity sha512-ClkhgdB/KqcAKk3zA6Qw8wBL6Wz67pYTPkrAtImpvoPJmR+l4RARauv+MH34JXMUNlNb3aUwqN6lq2Z1zN+mJg== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + +"@polkadot/x-fetch@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-8.7.1.tgz#dc866e7aa87c39b2e64c87f734b8fbaf1b9190e1" + integrity sha512-ygNparcalYFGbspXtdtZOHvNXZBkNgmNO+um9C0JYq74K5OY9/be93uyfJKJ8JcRJtOqBfVDsJpbiRkuJ1PRfg== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + "@types/node-fetch" "^2.6.1" + node-fetch "^2.6.7" + +"@polkadot/x-global@8.7.1", "@polkadot/x-global@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-8.7.1.tgz#b972044125a4fe059f4aef7c15a4e22d18179095" + integrity sha512-WOgUor16IihgNVdiTVGAWksYLUAlqjmODmIK1cuWrLOZtV1VBomWcb3obkO9sh5P6iWziAvCB/i+L0vnTN9ZCA== + dependencies: + "@babel/runtime" "^7.17.8" + +"@polkadot/x-randomvalues@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-8.7.1.tgz#b7cc358c2a6d20f7e7798d45d1d5c7ac8c9ab4f2" + integrity sha512-njt17MlfN6yNyNEti7fL12lr5qM6A1aSGkWKVuqzc7XwSBesifJuW4km5u6r2gwhXjH2eHDv9SoQ7WXu8vrrkg== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + +"@polkadot/x-textdecoder@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz#b706ef98d5a033d02c633009fb8dab4a4f9d7d55" + integrity sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + +"@polkadot/x-textencoder@8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz#7820e30081e8e0a607c1c27b9e3486d82d1a723e" + integrity sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + +"@polkadot/x-ws@^8.7.1": + version "8.7.1" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-8.7.1.tgz#501c63c575e04bba68bdc32448e2c9b692f0411e" + integrity sha512-Mt0tcNzGXyKnN3DQ06alkv+JLtTfXWu6zSypFrrKHSQe3u79xMQ1nSicmpT3gWLhIa8YF+8CYJXMrqaXgCnDhw== + dependencies: + "@babel/runtime" "^7.17.8" + "@polkadot/x-global" "8.7.1" + "@types/websocket" "^1.0.5" + websocket "^1.0.34" + +"@scure/base@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.0.0.tgz#109fb595021de285f05a7db6806f2f48296fcee7" + integrity sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA== + +"@substrate/connect-extension-protocol@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.0.tgz#d452beda84b3ebfcf0e88592a4695e729a91e858" + integrity sha512-nFVuKdp71hMd/MGlllAOh+a2hAqt8m6J2G0aSsS/RcALZexxF9jodbFc62ni8RDtJboeOfXAHhenYOANvJKPIg== + +"@substrate/connect@0.7.0-alpha.0": + version "0.7.0-alpha.0" + resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.0-alpha.0.tgz#df605f4e808b58d146ad0272a79b2c4b870459a5" + integrity sha512-fvO7w++M8R95R/pGJFW9+cWOt8OYnnTfgswxtlPqSgzqX4tta8xcNQ51crC72FcL5agwSGkA1gc2/+eyTj7O8A== + dependencies: + "@substrate/connect-extension-protocol" "^1.0.0" + "@substrate/smoldot-light" "0.6.8" + eventemitter3 "^4.0.7" + +"@substrate/smoldot-light@0.6.8": + version "0.6.8" + resolved "https://registry.yarnpkg.com/@substrate/smoldot-light/-/smoldot-light-0.6.8.tgz#e626e25cd2386824f1164e7d7dda7258580c36e4" + integrity sha512-9lVwbG6wrtss0sd6013BJGe4WN4taujsGG49pwyt1Lj36USeL2Sb164TTUxmZF/g2NQEqDPwPROBdekQ2gFmgg== + dependencies: + buffer "^6.0.1" + pako "^2.0.4" + websocket "^1.0.32" + +"@substrate/ss58-registry@^1.17.0": + version "1.18.0" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.18.0.tgz#0744480e880ae8e557327557a2a7fc95577292ec" + integrity sha512-nAA1qsorxgdDnx5ie/FL90nM2riTNn72wIq8jtWsR8trsk1uTIHJgQQjEgviFCtMg4Ws9bEjo8DkWBgVGdPFmw== + +"@tsconfig/node10@^1.0.7": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" + integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== + +"@tsconfig/node12@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" + integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== + +"@tsconfig/node14@^1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" + integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== + +"@tsconfig/node16@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== + +"@types/bn.js@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68" + integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA== + dependencies: + "@types/node" "*" + +"@types/node-fetch@^2.6.1": + version "2.6.1" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.1.tgz#8f127c50481db65886800ef496f20bbf15518975" + integrity sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA== + dependencies: + "@types/node" "*" + form-data "^3.0.0" + +"@types/node@*": + version "17.0.35" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.35.tgz#635b7586086d51fb40de0a2ec9d1014a5283ba4a" + integrity sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg== + +"@types/websocket@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/websocket/-/websocket-1.0.5.tgz#3fb80ed8e07f88e51961211cd3682a3a4a81569c" + integrity sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ== + dependencies: + "@types/node" "*" + +"@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + +"@types/yargs@^17.0.0": + version "17.0.10" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a" + integrity sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA== + dependencies: + "@types/yargs-parser" "*" + +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@^8.4.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bn.js@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" + integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + +buffer@^6.0.1: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + +bufferutil@^4.0.1: + version "4.0.6" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.6.tgz#ebd6c67c7922a0e902f053e5d8be5ec850e48433" + integrity sha512-jduaYOYtnio4aIAyc6UbvPCVcgq7nYpVnucyxr6eCYg/Woad9Hf/oxxBRDnGGjPfjUm6j5O/uBWhIu4iLebFaw== + dependencies: + node-gyp-build "^4.3.0" + +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + +debug@^2.2.0: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^4.1.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +ed2curve@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/ed2curve/-/ed2curve-0.3.0.tgz#322b575152a45305429d546b071823a93129a05d" + integrity sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ== + dependencies: + tweetnacl "1.x.x" + +es5-ext@^0.10.35, es5-ext@^0.10.50: + version "0.10.61" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" + integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== + dependencies: + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" + +es6-iterator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +eventemitter3@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +ext@^1.1.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" + integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== + dependencies: + type "^2.5.0" + +form-data@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + +ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +ip-regex@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" + integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== + +is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + +json-stringify-safe@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= + +lodash.set@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" + integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mock-socket@^9.1.2: + version "9.1.3" + resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.1.3.tgz#bcb106c6b345001fa7619466fcf2f8f5a156b10f" + integrity sha512-uz8lx8c5wuJYJ21f5UtovqpV0+KJuVwE7cVOLNhrl2QW/CvmstOLRfjXnLSbfFHZtJtiaSGQu0oCJA8SmRcK6A== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + +nock@^13.2.4: + version "13.2.4" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.4.tgz#43a309d93143ee5cdcca91358614e7bde56d20e1" + integrity sha512-8GPznwxcPNCH/h8B+XZcKjYPXnUV5clOKCjAqyjsiqA++MpNx9E9+t8YPp0MbThO+KauRo7aZJ1WuIZmOrT2Ug== + dependencies: + debug "^4.1.0" + json-stringify-safe "^5.0.1" + lodash.set "^4.3.2" + propagate "^2.0.0" + +node-fetch@^2.6.7: + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" + +node-gyp-build@^4.3.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.4.0.tgz#42e99687ce87ddeaf3a10b99dc06abc11021f3f4" + integrity sha512-amJnQCcgtRVw9SvoebO3BKGESClrfXGCUTX9hSn1OuGQTQBOZmVd0Z0OlecpuRksKvbsUqALE8jls/ErClAPuQ== + +pako@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.0.4.tgz#6cebc4bbb0b6c73b0d5b8d7e8476e2b2fbea576d" + integrity sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg== + +propagate@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45" + integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== + +regenerator-runtime@^0.13.4: + version "0.13.9" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" + integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== + +rxjs@^7.5.5: + version "7.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.5.tgz#2ebad89af0f560f460ad5cc4213219e1f7dd4e9f" + integrity sha512-sy+H0pQofO95VDmFLzyaw9xNJU4KTRSwQIGM6+iG3SypAtCiLDzpeG8sJrNCWn2Up9km+KhkvTdbkrdy+yzZdw== + dependencies: + tslib "^2.1.0" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= + +ts-node@^10.8.0: + version "10.8.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.0.tgz#3ceb5ac3e67ae8025c1950626aafbdecb55d82ce" + integrity sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +tslib@^2.1.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + +tweetnacl@1.x.x, tweetnacl@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.5.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" + integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== + +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +typescript@4.6.4: + version "4.6.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" + integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== + +utf-8-validate@^5.0.2: + version "5.0.9" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.9.tgz#ba16a822fbeedff1a58918f2a6a6b36387493ea3" + integrity sha512-Yek7dAy0v3Kl0orwMlvi7TPtiCNrdfHNd7Gcc/pLq4BLXqfAmd0J7OWMizUQnTTJsyjKn02mU7anqwfmUP4J8Q== + dependencies: + node-gyp-build "^4.3.0" + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + +websocket@^1.0.32, websocket@^1.0.34: + version "1.0.34" + resolved "https://registry.yarnpkg.com/websocket/-/websocket-1.0.34.tgz#2bdc2602c08bf2c82253b730655c0ef7dcab3111" + integrity sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ== + dependencies: + bufferutil "^4.0.1" + debug "^2.2.0" + es5-ext "^0.10.50" + typedarray-to-buffer "^3.1.5" + utf-8-validate "^5.0.2" + yaeti "^0.0.6" + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + +yaeti@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/yaeti/-/yaeti-0.0.6.tgz#f26f484d72684cf42bedfb76970aa1608fbf9577" + integrity sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc= + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==