From f22ecbffe4b4e786424e7ee457e4a086bc430ea8 Mon Sep 17 00:00:00 2001 From: Peter White Date: Mon, 9 Sep 2024 16:22:45 -0600 Subject: [PATCH 1/8] feat(devnet): add ISMP to runtime --- Cargo.lock | 176 +++++++++++++++++++ Cargo.toml | 10 ++ runtime/devnet/Cargo.toml | 272 ++++++++++++++++-------------- runtime/devnet/src/config/ismp.rs | 58 +++++++ runtime/devnet/src/config/mod.rs | 1 + runtime/devnet/src/lib.rs | 83 ++++++++- 6 files changed, 469 insertions(+), 131 deletions(-) create mode 100644 runtime/devnet/src/config/ismp.rs diff --git a/Cargo.lock b/Cargo.lock index 2e7c7cbc..fecfdeda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1640,6 +1640,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ckb-merkle-mountain-range" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ccb671c5921be8a84686e6212ca184cb1d7c51cadcdbfcbd1cc3f042f5dfb8" +dependencies = [ + "cfg-if", +] + [[package]] name = "clang-sys" version = "1.8.1" @@ -3637,6 +3646,17 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fortuples" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87630a8087e9cac4b7edfb6ee5e250ddca9112b57b6b17d8f5107375a3a8eace" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "forwarded-header-value" version = "0.1.1" @@ -5068,6 +5088,56 @@ version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +[[package]] +name = "ismp" +version = "0.2.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "anyhow", + "derive_more", + "hex", + "parity-scale-codec", + "primitive-types", + "scale-info", + "serde", + "serde-utils", + "serde_json", +] + +[[package]] +name = "ismp-parachain" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-primitives-core", + "frame-support", + "frame-system", + "hex-literal", + "ismp", + "log", + "pallet-ismp", + "parity-scale-codec", + "primitive-types", + "scale-info", + "serde", + "sp-consensus-aura", + "sp-inherents", + "sp-io", + "sp-runtime", + "sp-trie", + "substrate-state-machine", +] + +[[package]] +name = "ismp-parachain-runtime-api" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "cumulus-pallet-parachain-system", + "sp-api", +] + [[package]] name = "itertools" version = "0.10.5" @@ -6352,6 +6422,24 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "mmr-primitives" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "ckb-merkle-mountain-range", + "frame-system", + "ismp", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", + "sp-std", +] + [[package]] name = "mmr-rpc" version = "35.0.1" @@ -7729,6 +7817,59 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-ismp" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "fortuples", + "frame-benchmarking", + "frame-support", + "frame-system", + "ismp", + "log", + "mmr-primitives", + "parity-scale-codec", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-io", + "sp-mmr-primitives", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-ismp-demo" +version = "0.1.1" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "frame-support", + "frame-system", + "ismp", + "pallet-balances", + "pallet-ismp", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", +] + +[[package]] +name = "pallet-ismp-runtime-api" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "ismp", + "pallet-ismp", + "parity-scale-codec", + "primitive-types", + "serde", + "sp-api", + "sp-mmr-primitives", +] + [[package]] name = "pallet-membership" version = "36.0.0" @@ -10380,6 +10521,9 @@ dependencies = [ "frame-try-runtime", "hex", "hex-literal", + "ismp", + "ismp-parachain", + "ismp-parachain-runtime-api", "log", "pallet-assets", "pallet-aura", @@ -10387,6 +10531,9 @@ dependencies = [ "pallet-balances", "pallet-collator-selection", "pallet-contracts", + "pallet-ismp", + "pallet-ismp-demo", + "pallet-ismp-runtime-api", "pallet-message-queue", "pallet-multisig", "pallet-nft-fractionalization", @@ -10417,6 +10564,7 @@ dependencies = [ "sp-genesis-builder", "sp-inherents", "sp-io", + "sp-mmr-primitives", "sp-offchain", "sp-runtime", "sp-session", @@ -13294,6 +13442,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde-utils" +version = "0.1.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "anyhow", + "hex", + "serde", +] + [[package]] name = "serde_bytes" version = "0.11.14" @@ -14926,6 +15084,24 @@ dependencies = [ "tokio", ] +[[package]] +name = "substrate-state-machine" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "frame-support", + "hash-db", + "ismp", + "pallet-ismp", + "parity-scale-codec", + "primitive-types", + "scale-info", + "serde", + "sp-consensus-aura", + "sp-runtime", + "sp-trie", +] + [[package]] name = "substrate-state-trie-migration-rpc" version = "35.0.0" diff --git a/Cargo.toml b/Cargo.toml index cc4fa5b1..01835cba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -118,6 +118,7 @@ sp-genesis-builder = { version = "0.14.0", default-features = false } sp-inherents = { version = "33.0.0", default-features = false } sp-io = { version = "37.0.0", default-features = false } sp-keystore = "0.40.0" +sp-mmr-primitives = { version = "33.0.0", default-features = false } sp-offchain = { version = "33.0.0", default-features = false } sp-runtime = { version = "38.0.0", default-features = false } sp-session = { version = "34.0.0", default-features = false } @@ -175,3 +176,12 @@ paseo-runtime-constants = { git = "https://github.com/polkadot-fellows/runtimes" # asset-hub-paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } # paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } # paseo-runtime-constants = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false } + +ismp = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +ismp-parachain = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +ismp-parachain-inherent = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +ismp-parachain-runtime-api = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +pallet-ismp = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +pallet-ismp-demo = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +pallet-ismp-rpc = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } +pallet-ismp-runtime-api = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index 74ec5e3d..f075abf9 100644 --- a/runtime/devnet/Cargo.toml +++ b/runtime/devnet/Cargo.toml @@ -9,7 +9,7 @@ repository.workspace = true version = "0.1.0" [package.metadata.docs.rs] -targets = [ "x86_64-unknown-linux-gnu" ] +targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] substrate-wasm-builder.workspace = true @@ -60,6 +60,7 @@ sp-core.workspace = true sp-genesis-builder.workspace = true sp-inherents.workspace = true sp-io.workspace = true +sp-mmr-primitives.workspace = true sp-offchain.workspace = true sp-runtime.workspace = true sp-session.workspace = true @@ -89,144 +90,159 @@ pallet-collator-selection.workspace = true parachain-info.workspace = true parachains-common.workspace = true +# ISMP +ismp.workspace = true +ismp-parachain.workspace = true +ismp-parachain-runtime-api.workspace = true +pallet-ismp = { workspace = true, features = ["unsigned"] } +pallet-ismp-demo.workspace = true +pallet-ismp-runtime-api.workspace = true + [dev-dependencies] enumflags2 = "0.7.9" env_logger = "0.11.2" hex = "0.4.3" [features] -default = [ "std" ] +default = ["std"] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-session-benchmarking/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", - "cumulus-primitives-utility/std", - "frame-benchmarking/std", - "frame-executive/std", - "frame-metadata-hash-extension/std", - "frame-support/std", - "frame-system-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime/std", - "log/std", - "pallet-assets/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-contracts/std", - "pallet-message-queue/std", - "pallet-multisig/std", - "pallet-nft-fractionalization/std", - "pallet-nfts-runtime-api/std", - "pallet-nfts/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-scheduler/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "polkadot-parachain-primitives/std", - "polkadot-runtime-common/std", - "pop-primitives/std", - "pop-runtime-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-io/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-storage-weight-reclaim/std", + "cumulus-primitives-utility/std", + "frame-benchmarking/std", + "frame-executive/std", + "frame-metadata-hash-extension/std", + "frame-support/std", + "frame-system-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "ismp-parachain-runtime-api/std", + "ismp-parachain/std", + "ismp/std", + "log/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-contracts/std", + "pallet-ismp-runtime-api/std", + "pallet-ismp/std", + "pallet-message-queue/std", + "pallet-multisig/std", + "pallet-nft-fractionalization/std", + "pallet-nfts-runtime-api/std", + "pallet-nfts/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "polkadot-parachain-primitives/std", + "polkadot-runtime-common/std", + "pop-primitives/std", + "pop-runtime-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nft-fractionalization/runtime-benchmarks", - "pallet-nfts/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "pop-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nft-fractionalization/runtime-benchmarks", + "pallet-nfts/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "pop-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "pallet-assets/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-balances/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-contracts/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nft-fractionalization/try-runtime", - "pallet-nfts/try-runtime", - "pallet-preimage/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "ismp-parachain/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collator-selection/try-runtime", + "pallet-contracts/try-runtime", + "pallet-ismp/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nft-fractionalization/try-runtime", + "pallet-nfts/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # Enable the metadata hash generation. @@ -236,8 +252,8 @@ try-runtime = [ # generate the metadata hash and then a second time with the # `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash` # extension. -metadata-hash = [ "substrate-wasm-builder/metadata-hash" ] +metadata-hash = ["substrate-wasm-builder/metadata-hash"] # A convenience feature for enabling things when doing a build # for an on-chain release. -on-chain-release-build = [ "metadata-hash" ] +on-chain-release-build = ["metadata-hash"] diff --git a/runtime/devnet/src/config/ismp.rs b/runtime/devnet/src/config/ismp.rs new file mode 100644 index 00000000..9494fe20 --- /dev/null +++ b/runtime/devnet/src/config/ismp.rs @@ -0,0 +1,58 @@ +use frame_support::traits::Get; +use frame_system::EnsureRoot; +use ismp::{error::Error, host::StateMachine, module::IsmpModule, router::IsmpRouter}; +use ismp_parachain::ParachainConsensusClient; +use sp_std::prelude::*; + +use crate::{ + AccountId, Balance, Balances, Ismp, IsmpParachain, ParachainInfo, Runtime, RuntimeEvent, + Timestamp, +}; + +impl pallet_ismp::Config for Runtime { + type AdminOrigin = EnsureRoot; + type Balance = Balance; + type ConsensusClients = (ParachainConsensusClient,); + type Coprocessor = Coprocessor; + type Currency = Balances; + type HostStateMachine = HostStateMachine; + type Mmr = pallet_ismp::NoOpMmrTree; + type Router = Router; + type RuntimeEvent = RuntimeEvent; + type TimestampProvider = Timestamp; + type WeightProvider = (); +} + +impl pallet_ismp_demo::Config for Runtime { + type Balance = Balance; + type IsmpDispatcher = Ismp; + type NativeCurrency = Balances; + type RuntimeEvent = RuntimeEvent; +} + +impl ismp_parachain::Config for Runtime { + type IsmpHost = Ismp; + type RuntimeEvent = RuntimeEvent; +} + +pub struct Coprocessor; +impl Get> for Coprocessor { + fn get() -> Option { + Some(HostStateMachine::get()) + } +} + +pub struct HostStateMachine; +impl Get for HostStateMachine { + fn get() -> StateMachine { + StateMachine::Polkadot(ParachainInfo::get().into()) + } +} + +#[derive(Default)] +pub struct Router; +impl IsmpRouter for Router { + fn module_for_id(&self, _id: Vec) -> Result, Error> { + Ok(Box::new(pallet_ismp_demo::IsmpModuleCallback::::default())) + } +} diff --git a/runtime/devnet/src/config/mod.rs b/runtime/devnet/src/config/mod.rs index a3a64c92..ee9bb25a 100644 --- a/runtime/devnet/src/config/mod.rs +++ b/runtime/devnet/src/config/mod.rs @@ -1,5 +1,6 @@ mod assets; mod contracts; +mod ismp; mod proxy; // Public due to integration tests crate. pub mod xcm; diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index ca0e5137..296b95f6 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -11,8 +11,14 @@ pub mod config; mod extensions; mod weights; +// ISMP imports +use ::ismp::{ + consensus::{ConsensusClientId, StateMachineHeight, StateMachineId}, + host::StateMachine, + router::{Request, Response}, +}; use config::xcm::{RelayLocation, XcmOriginToTransactDispatchOrigin}; -use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases; +use cumulus_pallet_parachain_system::{RelayChainState, RelayNumberMonotonicallyIncreases}; use cumulus_primitives_core::{AggregateMessageOrigin, ParaId}; use frame_support::{ derive_impl, @@ -35,6 +41,7 @@ use frame_system::{ EnsureRoot, }; use pallet_balances::Call as BalancesCall; +use pallet_ismp::mmr::{Leaf, Proof, ProofKeys}; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling}; use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery; @@ -48,7 +55,7 @@ pub use pop_runtime_common::{ }; use smallvec::smallvec; use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; +use sp_core::{crypto::KeyTypeId, Get, OpaqueMetadata, H256}; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; use sp_runtime::{ @@ -596,7 +603,7 @@ mod runtime { #[runtime::pallet_index(29)] pub type Preimage = pallet_preimage; - // XCM helpers. + // Cross Chain #[runtime::pallet_index(30)] pub type XcmpQueue = cumulus_pallet_xcmp_queue::Pallet; #[runtime::pallet_index(31)] @@ -605,6 +612,12 @@ mod runtime { pub type CumulusXcm = cumulus_pallet_xcm::Pallet; #[runtime::pallet_index(33)] pub type MessageQueue = pallet_message_queue::Pallet; + #[runtime::pallet_index(37)] + pub type IsmpDemo = pallet_ismp_demo::Pallet; + #[runtime::pallet_index(38)] + pub type Ismp = pallet_ismp::Pallet; + #[runtime::pallet_index(39)] + pub type IsmpParachain = ismp_parachain::Pallet; // Contracts #[runtime::pallet_index(40)] @@ -991,6 +1004,70 @@ impl_runtime_apis! { Default::default() } } + + impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { + fn host_state_machine() -> StateMachine { + ::HostStateMachine::get() + } + + fn challenge_period(id: StateMachineId) -> Option { + Ismp::challenge_period(id) + } + + /// Generate a proof for the provided leaf indices + fn generate_proof( + keys: ProofKeys + ) -> Result<(Vec, Proof<::Hash>), sp_mmr_primitives::Error> { + Ismp::generate_proof(keys) + } + + /// Fetch all ISMP events + fn block_events() -> Vec<::ismp::events::Event> { + Ismp::block_events() + } + + /// Fetch all ISMP events and their extrinsic metadata + fn block_events_with_metadata() -> Vec<(::ismp::events::Event, Option)> { + Ismp::block_events_with_metadata() + } + + /// Return the scale encoded consensus state + fn consensus_state(id: ConsensusClientId) -> Option> { + Ismp::consensus_states(id) + } + + /// Return the timestamp this client was last updated in seconds + fn state_machine_update_time(height: StateMachineHeight) -> Option { + Ismp::state_machine_update_time(height) + } + + /// Return the latest height of the state machine + fn latest_state_machine_height(id: StateMachineId) -> Option { + Ismp::latest_state_machine_height(id) + } + + /// Get actual requests + fn requests(commitments: Vec) -> Vec { + Ismp::requests(commitments) + } + + /// Get actual requests + fn responses(commitments: Vec) -> Vec { + Ismp::responses(commitments) + } + } + + impl ismp_parachain_runtime_api::IsmpParachainApi for Runtime { + fn para_ids() -> Vec { + IsmpParachain::para_ids() + } + + fn current_relay_chain_state() -> RelayChainState { + IsmpParachain::current_relay_chain_state() + } + } + + } cumulus_pallet_parachain_system::register_validate_block! { From 551643f596b38459cae46203df80470c65598739 Mon Sep 17 00:00:00 2001 From: Peter White Date: Mon, 9 Sep 2024 16:40:03 -0600 Subject: [PATCH 2/8] feat(node): add ISMP inherent and RPC --- Cargo.lock | 85 ++++++++++-- networks/devnet.toml | 11 +- node/Cargo.toml | 9 +- node/src/chain_spec.rs | 9 +- node/src/rpc.rs | 22 ++- node/src/service.rs | 27 +++- runtime/devnet/Cargo.toml | 272 +++++++++++++++++++------------------- 7 files changed, 276 insertions(+), 159 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fecfdeda..08bc158e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -485,7 +485,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "kusama-runtime-constants", "log", "pallet-asset-conversion", @@ -4428,6 +4428,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + [[package]] name = "hex-literal" version = "0.4.1" @@ -5113,7 +5119,7 @@ dependencies = [ "cumulus-primitives-core", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "ismp", "log", "pallet-ismp", @@ -5129,6 +5135,27 @@ dependencies = [ "substrate-state-machine", ] +[[package]] +name = "ismp-parachain-inherent" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "anyhow", + "async-trait", + "cumulus-primitives-core", + "cumulus-relay-chain-interface", + "ismp", + "ismp-parachain", + "ismp-parachain-runtime-api", + "log", + "pallet-ismp-runtime-api", + "parity-scale-codec", + "sp-api", + "sp-blockchain", + "sp-inherents", + "sp-runtime", +] + [[package]] name = "ismp-parachain-runtime-api" version = "1.15.0" @@ -6055,7 +6082,7 @@ dependencies = [ "ed25519-dalek", "futures", "futures-timer", - "hex-literal", + "hex-literal 0.4.1", "indexmap 2.2.6", "libc", "mockall 0.12.1", @@ -7856,6 +7883,35 @@ dependencies = [ "sp-runtime", ] +[[package]] +name = "pallet-ismp-rpc" +version = "1.15.0" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +dependencies = [ + "anyhow", + "frame-system", + "hash-db", + "hex", + "hex-literal 0.3.4", + "ismp", + "jsonrpsee", + "pallet-ismp", + "pallet-ismp-runtime-api", + "parity-scale-codec", + "sc-client-api", + "sc-rpc", + "serde", + "serde_json", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-mmr-primitives", + "sp-runtime", + "sp-storage", + "sp-trie", + "trie-db", +] + [[package]] name = "pallet-ismp-runtime-api" version = "1.15.0" @@ -9831,7 +9887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a4879609f4340138930c3c7313256941104a3ff6f7ecb2569d15223da9b35b2" dependencies = [ "bitvec", - "hex-literal", + "hex-literal 0.4.1", "log", "parity-scale-codec", "polkadot-core-primitives", @@ -10129,7 +10185,7 @@ dependencies = [ "frame-system", "frame-system-rpc-runtime-api", "futures", - "hex-literal", + "hex-literal 0.4.1", "is_executable", "kvdb", "kvdb-rocksdb", @@ -10427,8 +10483,13 @@ dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", "futures", + "ismp-parachain", + "ismp-parachain-inherent", + "ismp-parachain-runtime-api", "jsonrpsee", "log", + "pallet-ismp-rpc", + "pallet-ismp-runtime-api", "pallet-multisig", "pallet-transaction-payment-rpc", "parity-scale-codec", @@ -10520,7 +10581,7 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex", - "hex-literal", + "hex-literal 0.4.1", "ismp", "ismp-parachain", "ismp-parachain-runtime-api", @@ -10669,7 +10730,7 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-assets", "pallet-aura", @@ -11532,7 +11593,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-asset-rate", "pallet-authority-discovery", @@ -13864,7 +13925,7 @@ dependencies = [ "ethabi-decode", "frame-support", "frame-system", - "hex-literal", + "hex-literal 0.4.1", "parity-scale-codec", "polkadot-parachain-primitives", "scale-info", @@ -13888,7 +13949,7 @@ dependencies = [ "ethabi-decode", "ethbloom", "ethereum-types", - "hex-literal", + "hex-literal 0.4.1", "parity-bytes", "parity-scale-codec", "rlp", @@ -13922,7 +13983,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e8e6707ced1308d763117bfe68f85e3f22fcdca7987b32e438c0485570f6ac7" dependencies = [ "frame-support", - "hex-literal", + "hex-literal 0.4.1", "log", "parity-scale-codec", "scale-info", @@ -16629,7 +16690,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal", + "hex-literal 0.4.1", "log", "pallet-asset-rate", "pallet-authority-discovery", diff --git a/networks/devnet.toml b/networks/devnet.toml index ac77371d..957a4716 100644 --- a/networks/devnet.toml +++ b/networks/devnet.toml @@ -36,4 +36,13 @@ balances = [ [[parachains.collators]] name = "pop" rpc_port = 9944 -args = ["-lruntime::contracts=debug", "-lpopapi::extension=debug"] \ No newline at end of file +args = ["-lruntime::contracts=debug", "-lpopapi::extension=debug", "--enable-offchain-indexing=true"] + +[[parachains]] +id = 1000 +chain = "asset-hub-rococo-local" + +[[parachains.collators]] +name = "asset-hub" +args = ["-lxcm=trace"] +rpc_port = 9977 \ No newline at end of file diff --git a/node/Cargo.toml b/node/Cargo.toml index 04de08e0..a9596857 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -14,7 +14,7 @@ version = "0.2.0-alpha" clap.workspace = true codec.workspace = true futures.workspace = true -jsonrpsee.workspace = true +jsonrpsee = { workspace = true, features = [ "server" ] } log.workspace = true serde.workspace = true serde_json.workspace = true @@ -78,6 +78,13 @@ cumulus-primitives-core.workspace = true cumulus-primitives-parachain-inherent.workspace = true cumulus-relay-chain-interface.workspace = true +# ismp +ismp-parachain.workspace = true +ismp-parachain-inherent.workspace = true +ismp-parachain-runtime-api.workspace = true +pallet-ismp-rpc.workspace = true +pallet-ismp-runtime-api.workspace = true + [build-dependencies] substrate-build-script-utils.workspace = true diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index b41ea8aa..64dc6368 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -315,6 +315,7 @@ fn devnet_genesis( id: ParaId, ) -> serde_json::Value { use pop_runtime_devnet::EXISTENTIAL_DEPOSIT; + let asset_hub = ismp_parachain::ParachainData { id: 1000, slot_duration: 6000 }; serde_json::json!({ "balances": { @@ -342,7 +343,13 @@ fn devnet_genesis( "polkadotXcm": { "safeXcmVersion": Some(SAFE_XCM_VERSION), }, - "sudo": { "key": Some(root) } + "sudo": { "key": Some(root) }, + // Set the following parachains to be tracked via ISMP. + "ismpParachain": pop_runtime_devnet::IsmpParachainConfig { + // Asset Hub + parachains: vec![asset_hub], + ..Default::default() + }, }) } diff --git a/node/src/rpc.rs b/node/src/rpc.rs index 6265dfd3..e0a68cc3 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -7,33 +7,41 @@ use std::sync::Arc; +use pallet_ismp_rpc::{IsmpApiServer, IsmpRpcHandler}; use pop_runtime_common::{AccountId, Balance, Block, Nonce}; +use sc_client_api::{AuxStore, BlockBackend, ProofProvider}; pub use sc_rpc::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +use sp_core::H256; /// A type representing all RPC extensions. pub type RpcExtension = jsonrpsee::RpcModule<()>; /// Full client dependencies -pub struct FullDeps { +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, + /// Backend used by the node. + pub backend: Arc, } /// Instantiate all RPC extensions. -pub fn create_full( - deps: FullDeps, +pub fn create_full( + deps: FullDeps, ) -> Result> where C: ProvideRuntimeApi + HeaderBackend + + AuxStore + + BlockBackend + + ProofProvider + HeaderMetadata + Send + Sync @@ -41,15 +49,19 @@ where C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, + C::Api: pallet_ismp_runtime_api::IsmpRuntimeApi, P: TransactionPool + Sync + Send + 'static, + B: sc_client_api::Backend + Send + Sync + 'static, + B::State: sc_client_api::StateBackend>, { use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use substrate_frame_rpc_system::{System, SystemApiServer}; let mut module = RpcExtension::new(()); - let FullDeps { client, pool, deny_unsafe } = deps; + let FullDeps { client, pool, deny_unsafe, backend } = deps; module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; - module.merge(TransactionPayment::new(client).into_rpc())?; + module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + module.merge(IsmpRpcHandler::new(client, backend.clone())?.into_rpc())?; Ok(module) } diff --git a/node/src/service.rs b/node/src/service.rs index 95eba022..0f4b5d0e 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -32,7 +32,7 @@ use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, Ta use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_api::ConstructRuntimeApi; -use sp_core::Pair; +use sp_core::{Pair, H256}; use sp_keystore::KeystorePtr; use sp_runtime::{app_crypto::AppCrypto, traits::BlakeTwo256}; @@ -248,12 +248,14 @@ where let rpc_builder = { let client = client.clone(); + let backend = backend.clone(); let transaction_pool = transaction_pool.clone(); Box::new(move |deny_unsafe, _| { let deps = crate::rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone(), + backend: backend.clone(), deny_unsafe, }; @@ -421,8 +423,23 @@ where client.clone(), ); + let (client_clone, relay_chain_interface_clone) = + (client.clone(), relay_chain_interface.clone()); let params = AuraParams { - create_inherent_data_providers: move |_, ()| async move { Ok(()) }, + create_inherent_data_providers: move |parent, ()| { + let client = client_clone.clone(); + let relay_chain_interface = relay_chain_interface_clone.clone(); + async move { + let inherent = ismp_parachain_inherent::ConsensusInherentProvider::create( + parent, + client, + relay_chain_interface, + ) + .await?; + + Ok(inherent) + } + }, block_import, para_client: client.clone(), para_backend: backend, @@ -487,6 +504,8 @@ pub(crate) trait RuntimeApiExt: + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + substrate_frame_rpc_system::AccountNonceApi + cumulus_primitives_aura::AuraUnincludedSegmentApi + + ismp_parachain_runtime_api::IsmpParachainApi + + pallet_ismp_runtime_api::IsmpRuntimeApi { } impl< @@ -500,7 +519,9 @@ impl< + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + substrate_frame_rpc_system::AccountNonceApi - + cumulus_primitives_aura::AuraUnincludedSegmentApi, + + cumulus_primitives_aura::AuraUnincludedSegmentApi + + ismp_parachain_runtime_api::IsmpParachainApi + + pallet_ismp_runtime_api::IsmpRuntimeApi, RuntimeApi, > RuntimeApiExt for T { diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index f075abf9..c9ad0e51 100644 --- a/runtime/devnet/Cargo.toml +++ b/runtime/devnet/Cargo.toml @@ -9,7 +9,7 @@ repository.workspace = true version = "0.1.0" [package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] +targets = [ "x86_64-unknown-linux-gnu" ] [build-dependencies] substrate-wasm-builder.workspace = true @@ -94,7 +94,7 @@ parachains-common.workspace = true ismp.workspace = true ismp-parachain.workspace = true ismp-parachain-runtime-api.workspace = true -pallet-ismp = { workspace = true, features = ["unsigned"] } +pallet-ismp = { workspace = true, features = [ "unsigned" ] } pallet-ismp-demo.workspace = true pallet-ismp-runtime-api.workspace = true @@ -104,145 +104,145 @@ env_logger = "0.11.2" hex = "0.4.3" [features] -default = ["std"] +default = [ "std" ] std = [ - "codec/std", - "cumulus-pallet-aura-ext/std", - "cumulus-pallet-parachain-system/std", - "cumulus-pallet-session-benchmarking/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-aura/std", - "cumulus-primitives-core/std", - "cumulus-primitives-storage-weight-reclaim/std", - "cumulus-primitives-utility/std", - "frame-benchmarking/std", - "frame-executive/std", - "frame-metadata-hash-extension/std", - "frame-support/std", - "frame-system-benchmarking/std", - "frame-system-rpc-runtime-api/std", - "frame-system/std", - "frame-try-runtime/std", - "ismp-parachain-runtime-api/std", - "ismp-parachain/std", - "ismp/std", - "log/std", - "pallet-assets/std", - "pallet-aura/std", - "pallet-authorship/std", - "pallet-balances/std", - "pallet-collator-selection/std", - "pallet-contracts/std", - "pallet-ismp-runtime-api/std", - "pallet-ismp/std", - "pallet-message-queue/std", - "pallet-multisig/std", - "pallet-nft-fractionalization/std", - "pallet-nfts-runtime-api/std", - "pallet-nfts/std", - "pallet-preimage/std", - "pallet-proxy/std", - "pallet-scheduler/std", - "pallet-session/std", - "pallet-sudo/std", - "pallet-timestamp/std", - "pallet-transaction-payment-rpc-runtime-api/std", - "pallet-transaction-payment/std", - "pallet-utility/std", - "pallet-xcm/std", - "parachain-info/std", - "parachains-common/std", - "polkadot-parachain-primitives/std", - "polkadot-runtime-common/std", - "pop-primitives/std", - "pop-runtime-common/std", - "scale-info/std", - "sp-api/std", - "sp-block-builder/std", - "sp-consensus-aura/std", - "sp-core/std", - "sp-genesis-builder/std", - "sp-inherents/std", - "sp-io/std", - "sp-offchain/std", - "sp-runtime/std", - "sp-session/std", - "sp-std/std", - "sp-transaction-pool/std", - "sp-version/std", - "xcm-builder/std", - "xcm-executor/std", - "xcm/std", + "codec/std", + "cumulus-pallet-aura-ext/std", + "cumulus-pallet-parachain-system/std", + "cumulus-pallet-session-benchmarking/std", + "cumulus-pallet-xcm/std", + "cumulus-pallet-xcmp-queue/std", + "cumulus-primitives-aura/std", + "cumulus-primitives-core/std", + "cumulus-primitives-storage-weight-reclaim/std", + "cumulus-primitives-utility/std", + "frame-benchmarking/std", + "frame-executive/std", + "frame-metadata-hash-extension/std", + "frame-support/std", + "frame-system-benchmarking/std", + "frame-system-rpc-runtime-api/std", + "frame-system/std", + "frame-try-runtime/std", + "ismp-parachain-runtime-api/std", + "ismp-parachain/std", + "ismp/std", + "log/std", + "pallet-assets/std", + "pallet-aura/std", + "pallet-authorship/std", + "pallet-balances/std", + "pallet-collator-selection/std", + "pallet-contracts/std", + "pallet-ismp-runtime-api/std", + "pallet-ismp/std", + "pallet-message-queue/std", + "pallet-multisig/std", + "pallet-nft-fractionalization/std", + "pallet-nfts-runtime-api/std", + "pallet-nfts/std", + "pallet-preimage/std", + "pallet-proxy/std", + "pallet-scheduler/std", + "pallet-session/std", + "pallet-sudo/std", + "pallet-timestamp/std", + "pallet-transaction-payment-rpc-runtime-api/std", + "pallet-transaction-payment/std", + "pallet-utility/std", + "pallet-xcm/std", + "parachain-info/std", + "parachains-common/std", + "polkadot-parachain-primitives/std", + "polkadot-runtime-common/std", + "pop-primitives/std", + "pop-runtime-common/std", + "scale-info/std", + "sp-api/std", + "sp-block-builder/std", + "sp-consensus-aura/std", + "sp-core/std", + "sp-genesis-builder/std", + "sp-inherents/std", + "sp-io/std", + "sp-offchain/std", + "sp-runtime/std", + "sp-session/std", + "sp-std/std", + "sp-transaction-pool/std", + "sp-version/std", + "xcm-builder/std", + "xcm-executor/std", + "xcm/std", ] runtime-benchmarks = [ - "cumulus-pallet-parachain-system/runtime-benchmarks", - "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "cumulus-pallet-xcmp-queue/runtime-benchmarks", - "cumulus-primitives-core/runtime-benchmarks", - "cumulus-primitives-utility/runtime-benchmarks", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "pallet-assets/runtime-benchmarks", - "pallet-balances/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", - "pallet-contracts/runtime-benchmarks", - "pallet-message-queue/runtime-benchmarks", - "pallet-multisig/runtime-benchmarks", - "pallet-nft-fractionalization/runtime-benchmarks", - "pallet-nfts/runtime-benchmarks", - "pallet-preimage/runtime-benchmarks", - "pallet-proxy/runtime-benchmarks", - "pallet-scheduler/runtime-benchmarks", - "pallet-sudo/runtime-benchmarks", - "pallet-timestamp/runtime-benchmarks", - "pallet-utility/runtime-benchmarks", - "pallet-xcm/runtime-benchmarks", - "parachains-common/runtime-benchmarks", - "polkadot-parachain-primitives/runtime-benchmarks", - "polkadot-runtime-common/runtime-benchmarks", - "pop-runtime-common/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", - "xcm-executor/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", + "cumulus-pallet-session-benchmarking/runtime-benchmarks", + "cumulus-pallet-xcmp-queue/runtime-benchmarks", + "cumulus-primitives-core/runtime-benchmarks", + "cumulus-primitives-utility/runtime-benchmarks", + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "pallet-assets/runtime-benchmarks", + "pallet-balances/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", + "pallet-contracts/runtime-benchmarks", + "pallet-message-queue/runtime-benchmarks", + "pallet-multisig/runtime-benchmarks", + "pallet-nft-fractionalization/runtime-benchmarks", + "pallet-nfts/runtime-benchmarks", + "pallet-preimage/runtime-benchmarks", + "pallet-proxy/runtime-benchmarks", + "pallet-scheduler/runtime-benchmarks", + "pallet-sudo/runtime-benchmarks", + "pallet-timestamp/runtime-benchmarks", + "pallet-utility/runtime-benchmarks", + "pallet-xcm/runtime-benchmarks", + "parachains-common/runtime-benchmarks", + "polkadot-parachain-primitives/runtime-benchmarks", + "polkadot-runtime-common/runtime-benchmarks", + "pop-runtime-common/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", + "xcm-builder/runtime-benchmarks", + "xcm-executor/runtime-benchmarks", ] try-runtime = [ - "cumulus-pallet-aura-ext/try-runtime", - "cumulus-pallet-parachain-system/try-runtime", - "cumulus-pallet-xcm/try-runtime", - "cumulus-pallet-xcmp-queue/try-runtime", - "frame-executive/try-runtime", - "frame-support/try-runtime", - "frame-system/try-runtime", - "frame-try-runtime/try-runtime", - "ismp-parachain/try-runtime", - "pallet-assets/try-runtime", - "pallet-aura/try-runtime", - "pallet-authorship/try-runtime", - "pallet-balances/try-runtime", - "pallet-collator-selection/try-runtime", - "pallet-contracts/try-runtime", - "pallet-ismp/try-runtime", - "pallet-message-queue/try-runtime", - "pallet-multisig/try-runtime", - "pallet-nft-fractionalization/try-runtime", - "pallet-nfts/try-runtime", - "pallet-preimage/try-runtime", - "pallet-proxy/try-runtime", - "pallet-scheduler/try-runtime", - "pallet-session/try-runtime", - "pallet-sudo/try-runtime", - "pallet-timestamp/try-runtime", - "pallet-transaction-payment/try-runtime", - "pallet-utility/try-runtime", - "pallet-xcm/try-runtime", - "parachain-info/try-runtime", - "polkadot-runtime-common/try-runtime", - "sp-runtime/try-runtime", + "cumulus-pallet-aura-ext/try-runtime", + "cumulus-pallet-parachain-system/try-runtime", + "cumulus-pallet-xcm/try-runtime", + "cumulus-pallet-xcmp-queue/try-runtime", + "frame-executive/try-runtime", + "frame-support/try-runtime", + "frame-system/try-runtime", + "frame-try-runtime/try-runtime", + "ismp-parachain/try-runtime", + "pallet-assets/try-runtime", + "pallet-aura/try-runtime", + "pallet-authorship/try-runtime", + "pallet-balances/try-runtime", + "pallet-collator-selection/try-runtime", + "pallet-contracts/try-runtime", + "pallet-ismp/try-runtime", + "pallet-message-queue/try-runtime", + "pallet-multisig/try-runtime", + "pallet-nft-fractionalization/try-runtime", + "pallet-nfts/try-runtime", + "pallet-preimage/try-runtime", + "pallet-proxy/try-runtime", + "pallet-scheduler/try-runtime", + "pallet-session/try-runtime", + "pallet-sudo/try-runtime", + "pallet-timestamp/try-runtime", + "pallet-transaction-payment/try-runtime", + "pallet-utility/try-runtime", + "pallet-xcm/try-runtime", + "parachain-info/try-runtime", + "polkadot-runtime-common/try-runtime", + "sp-runtime/try-runtime", ] # Enable the metadata hash generation. @@ -252,8 +252,8 @@ try-runtime = [ # generate the metadata hash and then a second time with the # `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash` # extension. -metadata-hash = ["substrate-wasm-builder/metadata-hash"] +metadata-hash = [ "substrate-wasm-builder/metadata-hash" ] # A convenience feature for enabling things when doing a build # for an on-chain release. -on-chain-release-build = ["metadata-hash"] +on-chain-release-build = [ "metadata-hash" ] From acd0839fbb03ba20dcf6e30f7620aee9ca5448be Mon Sep 17 00:00:00 2001 From: Peter White Date: Mon, 9 Sep 2024 19:14:20 -0600 Subject: [PATCH 3/8] refactor(node): feature gate ISMP in node. Disables testnet and mainnet with --ismp enabled --- node/Cargo.toml | 1 + node/src/command.rs | 118 ++++++++++++++++++++------------ node/src/rpc.rs | 42 ++++++++++-- node/src/service.rs | 138 +++++++++++++++++++++++++++----------- runtime/devnet/Cargo.toml | 1 + 5 files changed, 211 insertions(+), 89 deletions(-) diff --git a/node/Cargo.toml b/node/Cargo.toml index a9596857..4948cb18 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -113,4 +113,5 @@ try-runtime = [ "sp-runtime/try-runtime", ] +ismp = [ "pop-runtime-devnet/default" ] on-chain-release-build = [ "pop-runtime-mainnet/on-chain-release-build" ] diff --git a/node/src/command.rs b/node/src/command.rs index 9da4052d..3a8c8b2c 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -173,22 +173,32 @@ macro_rules! construct_async_run { }) } Runtime::Testnet => { - runner.async_run(|$config| { - let $components = new_partial::( - &$config - )?; - let task_manager = $components.task_manager; - { $( $code )* }.map(|v| (v, task_manager)) - }) + #[cfg(feature = "ismp")] + unimplemented!("ISMP is not supported in testnet"); + #[cfg(not(feature = "ismp"))] + { + runner.async_run(|$config| { + let $components = new_partial::( + &$config + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } } Runtime::Mainnet => { - runner.async_run(|$config| { - let $components = new_partial::( - &$config - )?; - let task_manager = $components.task_manager; - { $( $code )* }.map(|v| (v, task_manager)) - }) + #[cfg(feature = "ismp")] + unimplemented!("ISMP is not supported in mainnet"); + #[cfg(not(feature = "ismp"))] + { + runner.async_run(|$config| { + let $components = new_partial::( + &$config + )?; + let task_manager = $components.task_manager; + { $( $code )* }.map(|v| (v, task_manager)) + }) + } } } }} @@ -202,12 +212,22 @@ macro_rules! construct_benchmark_partials { $code }, Runtime::Testnet => { - let $partials = new_partial::(&$config)?; - $code + #[cfg(feature = "ismp")] + unimplemented!("ISMP is not supported in testnet"); + #[cfg(not(feature = "ismp"))] + { + let $partials = new_partial::(&$config)?; + $code + } }, Runtime::Mainnet => { - let $partials = new_partial::(&$config)?; - $code + #[cfg(feature = "ismp")] + unimplemented!("ISMP is not supported in mainnet"); + #[cfg(not(feature = "ismp"))] + { + let $partials = new_partial::(&$config)?; + $code + } }, } }; @@ -367,34 +387,44 @@ pub fn run() -> Result<()> { .map_err(Into::into) }, Runtime::Testnet => { - sp_core::crypto::set_default_ss58_version( - pop_runtime_testnet::SS58Prefix::get().into(), - ); - crate::service::start_parachain_node::( - config, - polkadot_config, - collator_options, - id, - hwbench, - ) - .await - .map(|r| r.0) - .map_err(Into::into) + #[cfg(feature = "ismp")] + unimplemented!("ISMP is not supported in testnet"); + #[cfg(not(feature = "ismp"))] + { + sp_core::crypto::set_default_ss58_version( + pop_runtime_testnet::SS58Prefix::get().into(), + ); + crate::service::start_parachain_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ) + .await + .map(|r| r.0) + .map_err(Into::into) + } }, Runtime::Mainnet => { - sp_core::crypto::set_default_ss58_version( - pop_runtime_mainnet::SS58Prefix::get().into(), - ); - crate::service::start_parachain_node::( - config, - polkadot_config, - collator_options, - id, - hwbench, - ) - .await - .map(|r| r.0) - .map_err(Into::into) + #[cfg(feature = "ismp")] + unimplemented!("ISMP is not supported in mainnet"); + #[cfg(not(feature = "ismp"))] + { + sp_core::crypto::set_default_ss58_version( + pop_runtime_mainnet::SS58Prefix::get().into(), + ); + crate::service::start_parachain_node::( + config, + polkadot_config, + collator_options, + id, + hwbench, + ) + .await + .map(|r| r.0) + .map_err(Into::into) + } }, } }) diff --git a/node/src/rpc.rs b/node/src/rpc.rs index e0a68cc3..24e6783d 100644 --- a/node/src/rpc.rs +++ b/node/src/rpc.rs @@ -7,7 +7,7 @@ use std::sync::Arc; -use pallet_ismp_rpc::{IsmpApiServer, IsmpRpcHandler}; +use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use pop_runtime_common::{AccountId, Balance, Block, Nonce}; use sc_client_api::{AuxStore, BlockBackend, ProofProvider}; pub use sc_rpc::DenyUnsafe; @@ -15,7 +15,9 @@ use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; +#[cfg(feature = "ismp")] use sp_core::H256; +use substrate_frame_rpc_system::{System, SystemApiServer}; /// A type representing all RPC extensions. pub type RpcExtension = jsonrpsee::RpcModule<()>; @@ -33,6 +35,7 @@ pub struct FullDeps { } /// Instantiate all RPC extensions. +#[cfg(not(feature = "ismp"))] pub fn create_full( deps: FullDeps, ) -> Result> @@ -49,19 +52,50 @@ where C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: BlockBuilder, - C::Api: pallet_ismp_runtime_api::IsmpRuntimeApi, P: TransactionPool + Sync + Send + 'static, B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::StateBackend>, { - use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; - use substrate_frame_rpc_system::{System, SystemApiServer}; + let mut module = RpcExtension::new(()); + let FullDeps { client, pool, deny_unsafe, backend: _ } = deps; + + module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; + module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + + Ok(module) +} +/// Instantiate all RPC extensions. +#[cfg(feature = "ismp")] +pub fn create_full( + deps: FullDeps, +) -> Result> +where + C: ProvideRuntimeApi + + HeaderBackend + + AuxStore + + BlockBackend + + ProofProvider + + HeaderMetadata + + Send + + Sync + + 'static, + C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, + C::Api: substrate_frame_rpc_system::AccountNonceApi, + C::Api: BlockBuilder, + C::Api: pallet_ismp_runtime_api::IsmpRuntimeApi, + P: TransactionPool + Sync + Send + 'static, + B: sc_client_api::Backend + Send + Sync + 'static, + B::State: sc_client_api::StateBackend>, +{ let mut module = RpcExtension::new(()); let FullDeps { client, pool, deny_unsafe, backend } = deps; module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; + + use pallet_ismp_rpc::{IsmpApiServer, IsmpRpcHandler}; module.merge(IsmpRpcHandler::new(client, backend.clone())?.into_rpc())?; + Ok(module) } diff --git a/node/src/service.rs b/node/src/service.rs index 0f4b5d0e..8ff9db85 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -21,7 +21,7 @@ use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; // Substrate Imports use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; // Local Runtime Types -use pop_runtime_common::{AccountId, AuraId, Balance, Block, Hash, Nonce}; +use pop_runtime_common::{Block, Hash}; use prometheus_endpoint::Registry; use sc_client_api::Backend; use sc_consensus::ImportQueue; @@ -32,9 +32,8 @@ use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, Ta use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle}; use sc_transaction_pool_api::OffchainTransactionPoolFactory; use sp_api::ConstructRuntimeApi; -use sp_core::{Pair, H256}; use sp_keystore::KeystorePtr; -use sp_runtime::{app_crypto::AppCrypto, traits::BlakeTwo256}; +use sp_runtime::traits::BlakeTwo256; #[cfg(not(feature = "runtime-benchmarks"))] type HostFunctions = cumulus_client_service::ParachainHostFunctions; @@ -423,12 +422,17 @@ where client.clone(), ); - let (client_clone, relay_chain_interface_clone) = - (client.clone(), relay_chain_interface.clone()); - let params = AuraParams { - create_inherent_data_providers: move |parent, ()| { + #[cfg(not(feature = "ismp"))] + let create_inherent_data_providers = move |_, ()| async move { Ok(()) }; + + #[cfg(feature = "ismp")] + let create_inherent_data_providers = { + let (client_clone, relay_chain_interface_clone) = + (client.clone(), relay_chain_interface.clone()); + move |parent, ()| { let client = client_clone.clone(); let relay_chain_interface = relay_chain_interface_clone.clone(); + async move { let inherent = ismp_parachain_inherent::ConsensusInherentProvider::create( parent, @@ -439,7 +443,11 @@ where Ok(inherent) } - }, + } + }; + + let params = AuraParams { + create_inherent_data_providers, block_import, para_client: client.clone(), para_backend: backend, @@ -491,38 +499,86 @@ where .await } -// Trait alias refactored out from above to simplify repeated trait bounds -pub(crate) trait RuntimeApiExt: - sp_transaction_pool::runtime_api::TaggedTransactionQueue - + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt - + sp_offchain::OffchainWorkerApi - + sp_block_builder::BlockBuilder - + cumulus_primitives_core::CollectCollationInfo - + sp_consensus_aura::AuraApi::Pair as Pair>::Public> - + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi - + substrate_frame_rpc_system::AccountNonceApi - + cumulus_primitives_aura::AuraUnincludedSegmentApi - + ismp_parachain_runtime_api::IsmpParachainApi - + pallet_ismp_runtime_api::IsmpRuntimeApi -{ +#[cfg(not(feature = "ismp"))] +mod runtime_api_ext { + use pop_runtime_common::{AccountId, AuraId, Balance, Block, Nonce}; + use sp_core::Pair; + use sp_runtime::app_crypto::AppCrypto; + + // Trait alias refactored out from above to simplify repeated trait bounds + pub(crate) trait RuntimeApiExt: + sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + sp_session::SessionKeys + + sp_api::ApiExt + + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + cumulus_primitives_core::CollectCollationInfo + + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi + + cumulus_primitives_aura::AuraUnincludedSegmentApi + { + } + impl< + T: sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + sp_session::SessionKeys + + sp_api::ApiExt + + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + cumulus_primitives_core::CollectCollationInfo + + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi + + cumulus_primitives_aura::AuraUnincludedSegmentApi, + RuntimeApi, + > RuntimeApiExt for T + { + } } -impl< - T: sp_transaction_pool::runtime_api::TaggedTransactionQueue - + sp_api::Metadata - + sp_session::SessionKeys - + sp_api::ApiExt - + sp_offchain::OffchainWorkerApi - + sp_block_builder::BlockBuilder - + cumulus_primitives_core::CollectCollationInfo - + sp_consensus_aura::AuraApi::Pair as Pair>::Public> - + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi - + substrate_frame_rpc_system::AccountNonceApi - + cumulus_primitives_aura::AuraUnincludedSegmentApi - + ismp_parachain_runtime_api::IsmpParachainApi - + pallet_ismp_runtime_api::IsmpRuntimeApi, - RuntimeApi, - > RuntimeApiExt for T -{ + +#[cfg(feature = "ismp")] +mod runtime_api_ext { + use pop_runtime_common::{AccountId, AuraId, Balance, Block, Nonce}; + use sp_core::{Pair, H256}; + use sp_runtime::app_crypto::AppCrypto; + + // Trait alias refactored out from above to simplify repeated trait bounds + pub(crate) trait RuntimeApiExt: + sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + sp_session::SessionKeys + + sp_api::ApiExt + + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + cumulus_primitives_core::CollectCollationInfo + + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi + + cumulus_primitives_aura::AuraUnincludedSegmentApi + + ismp_parachain_runtime_api::IsmpParachainApi + + pallet_ismp_runtime_api::IsmpRuntimeApi + { + } + impl< + T: sp_transaction_pool::runtime_api::TaggedTransactionQueue + + sp_api::Metadata + + sp_session::SessionKeys + + sp_api::ApiExt + + sp_offchain::OffchainWorkerApi + + sp_block_builder::BlockBuilder + + cumulus_primitives_core::CollectCollationInfo + + sp_consensus_aura::AuraApi::Pair as Pair>::Public> + + pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi + + substrate_frame_rpc_system::AccountNonceApi + + cumulus_primitives_aura::AuraUnincludedSegmentApi + + ismp_parachain_runtime_api::IsmpParachainApi + + pallet_ismp_runtime_api::IsmpRuntimeApi, + RuntimeApi, + > crate::service::runtime_api_ext::RuntimeApiExt for T + { + } } + +use runtime_api_ext::RuntimeApiExt; diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index c9ad0e51..6313de27 100644 --- a/runtime/devnet/Cargo.toml +++ b/runtime/devnet/Cargo.toml @@ -226,6 +226,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-collator-selection/try-runtime", "pallet-contracts/try-runtime", + "pallet-ismp-demo/try-runtime", "pallet-ismp/try-runtime", "pallet-message-queue/try-runtime", "pallet-multisig/try-runtime", From c4d8b796c24dfe04422c0911fc0c94cd488146a7 Mon Sep 17 00:00:00 2001 From: Peter White Date: Mon, 9 Sep 2024 22:16:25 -0600 Subject: [PATCH 4/8] test(ismp): add script for ISMP get --- scripts/ismp-get/README.md | 37 +++ scripts/ismp-get/common.ts | 88 ++++++ scripts/ismp-get/ismp-get.ts | 208 +++++++++++++ scripts/ismp-get/package.json | 6 + scripts/ismp-get/types.ts | 75 +++++ scripts/ismp-get/yarn.lock | 566 ++++++++++++++++++++++++++++++++++ 6 files changed, 980 insertions(+) create mode 100644 scripts/ismp-get/README.md create mode 100644 scripts/ismp-get/common.ts create mode 100644 scripts/ismp-get/ismp-get.ts create mode 100644 scripts/ismp-get/package.json create mode 100644 scripts/ismp-get/types.ts create mode 100644 scripts/ismp-get/yarn.lock diff --git a/scripts/ismp-get/README.md b/scripts/ismp-get/README.md new file mode 100644 index 00000000..d132f812 --- /dev/null +++ b/scripts/ismp-get/README.md @@ -0,0 +1,37 @@ +# ISMP Get Testing Script + +This is a simple script intended to showcase the flow of performing a GET request +to the ISMP API. + +THe script uses a hard-coded storage key to Asset + +## Usage + +Setup: + +``` +yarn +``` + +Ensure ts-node is installed + +``` +yarn add ts-node typescript @types/node --dev +``` + +Ensure devnet is launched with `--enable-offchain-indexing=true` + +``` +pop up parachain -f networks/devnet.toml +``` + +Run the script: + +``` +ts-node ismp-get.ts +``` + +## Acknowledgements + +This script was originally inspired and adapted +from [RegionX](https://github.com/RegionX-Labs/RegionX-Node/tree/main/e2e_tests/xc-transfer) \ No newline at end of file diff --git a/scripts/ismp-get/common.ts b/scripts/ismp-get/common.ts new file mode 100644 index 00000000..7a855584 --- /dev/null +++ b/scripts/ismp-get/common.ts @@ -0,0 +1,88 @@ +import {ApiPromise, Keyring} from '@polkadot/api'; +import {SignerOptions, SubmittableExtrinsic} from '@polkadot/api/types'; +import {KeyringPair} from '@polkadot/keyring/types'; +import {stringToU8a} from '@polkadot/util'; +import {encodeAddress} from '@polkadot/util-crypto'; +import {Events} from './types'; + +const RELAY_ASSET_ID = 1; + +async function submitExtrinsic( + signer: KeyringPair, + call: SubmittableExtrinsic<'promise'>, + options: Partial, + tx_events: Events +): Promise { + return new Promise((resolve, reject) => { + const unsub = call.signAndSend(signer, options, ({status, isError, events = []}) => { + console.log(`Current status is ${status}`); + if (status.isInBlock) { + console.log(`Transaction included at blockHash ${status.asInBlock}`); + tx_events.events = events; + } else if (status.isFinalized) { + console.log(`Transaction finalized at blockHash ${status.asFinalized}`); + unsub.then(); + return resolve(); + } else if (isError) { + console.log('Transaction error'); + unsub.then(); + return reject(); + } + }); + }); +} + +// Transfer the relay chain asset to the parachain specified by paraId. +// Receiver address is same as the sender's. +async function transferRelayAssetToPara( + amount: bigint, + paraId: number, + relayApi: ApiPromise, + signer: KeyringPair +) { + const receiverKeypair = new Keyring(); + receiverKeypair.addFromAddress(signer.address); + + // If system parachain we use teleportation, otherwise we do a reserve transfer. + const transferKind = paraId < 2000 ? 'limitedTeleportAssets' : 'limitedReserveTransferAssets'; + + const feeAssetItem = 0; + const weightLimit = 'Unlimited'; + const reserveTransfer = relayApi.tx.xcmPallet[transferKind]( + {V3: {parents: 0, interior: {X1: {Parachain: paraId}}}}, //dest + { + V3: { + parents: 0, + interior: { + X1: { + AccountId32: { + chain: 'Any', + id: receiverKeypair.pairs[0].publicKey, + }, + }, + }, + }, + }, //beneficiary + { + V3: [ + { + id: { + Concrete: {parents: 0, interior: 'Here'}, + }, + fun: { + Fungible: amount, + }, + }, + ], + }, //asset + feeAssetItem, + weightLimit + ); + await submitExtrinsic(signer, reserveTransfer, {}, {events: []}); +} + +export { + RELAY_ASSET_ID, + submitExtrinsic, + transferRelayAssetToPara, +}; \ No newline at end of file diff --git a/scripts/ismp-get/ismp-get.ts b/scripts/ismp-get/ismp-get.ts new file mode 100644 index 00000000..a783bff7 --- /dev/null +++ b/scripts/ismp-get/ismp-get.ts @@ -0,0 +1,208 @@ +import {ApiPromise, Keyring, WsProvider} from "@polkadot/api"; +import {KeyringPair} from "@polkadot/keyring/types"; +import {submitExtrinsic, transferRelayAssetToPara} from "./common"; +import { + IsmpRequest, + Events, + API_TYPES, + CUSTOM_RPC, + StateMachine, +} from "./types"; + +const AH_ID = 1000; +const POP_ID = 4001; + +async function run() { + console.log("starting up..."); + const pop_uri = "ws://127.0.0.1:9944"; + const paseo_uri = "ws://127.0.0.1:8833"; + const ah_uri = "ws://127.0.0.1:9977"; + + const popApi = await ApiPromise.create({ + provider: new WsProvider(pop_uri), + types: {...API_TYPES}, + rpc: CUSTOM_RPC, + }); + const paseoApi = await ApiPromise.create({ + provider: new WsProvider(paseo_uri), + }); + const ahApi = await ApiPromise.create({ + provider: new WsProvider(ah_uri), + }); + + // account to submit tx + const keyring = new Keyring({type: "sr25519"}); + const alice = keyring.addFromUri("//Alice"); + const receiverKeypair = new Keyring(); + receiverKeypair.addFromAddress(alice.address); + + console.log("Setting up asset"); + + // Needed for fee payment + await transferRelayAssetToPara(10n ** 12n, POP_ID, paseoApi, alice); + // add AH as + await ismpAddParachain(alice, popApi); + + const latest_height = await popApi.query.ismp.latestStateMachineHeight({ + stateId: {Polkadot: AH_ID}, + consensusStateId: "PARA" + }); + console.log("Latest Height: ", latest_height.toString()); + + // parachain info pallet fetching para id + let encoded_chain_b_id_storage_key = + "0x0d715f2646c8f85767b5d2764bb2782604a74d81251e398fd8a0a4d55023bb3f"; + const requestRecord = popApi.tx.ismpDemo.getRequest({ + paraId: AH_ID, + height: latest_height.toString(), + timeout: 100000, + keys: [encoded_chain_b_id_storage_key], + }); + let events: Events = {events: []}; + await submitExtrinsic(alice, requestRecord, {}, events); + + console.log("events: ", events); + console.log("Event found: ", findEvent(events.events, "ismp", "Request").toHuman()); + const ismpRequest = findEvent(events.events, "ismp", "Request"); + const commitmentRequest = ismpRequest.event.data.commitment; + console.log("Commitment: ", commitmentRequest.toHex()); + + // Check the data on the Coretime chain: + const ahId = await ahApi.query.parachainInfo.parachainId(); + + console.log("AH ID: ", ahId.toString()); + + // Respond to the ISMP get request: + const request = await queryRequest(popApi, commitmentRequest.toString()); + console.log("Request: "); + console.log(request); + // request.get.source; + await makeIsmpResponse(popApi, ahApi, request, alice.address); +} + +// Function to convert the string to a StateMachine +function convertToStateMachine(input: string): StateMachine { + const [network, value] = input.split("-"); + const numericValue = parseInt(value, 10); + + switch (network.toUpperCase()) { + case "POLKADOT": + return {Polkadot: numericValue}; + case "KUSAMA": + return {Kusama: numericValue}; + // Add cases for other networks as needed + default: + throw new Error(`Unsupported network: ${network}`); + } +} + +function findEvent(events: any[], section: string, method: string): any { + return events.find((event) => event.event.section == section && event.event.method == method); + +} + +async function ismpAddParachain(signer: KeyringPair, popApi: ApiPromise, para_id: number = AH_ID) { + const addParaCall = popApi.tx.ismpParachain.addParachain([ + {id: para_id, slotDuration: 6000}, + ]); + const sudoCall = popApi.tx.sudo.sudo(addParaCall); + return submitExtrinsic(signer, sudoCall, {}, {events: []}); +} + +async function queryRequest( + popApi: ApiPromise, + commitment: string, +): Promise { + console.log("Here"); + const leafIndex = popApi.createType("LeafIndexQuery", { + commitment, + }); + console.log("LeafIndex: ", leafIndex.toHuman()); + const requests = await (popApi as any).rpc.ismp.queryRequests([ + leafIndex, + ]); + console.log("QueryRequest: " + requests); + + const request = requests.toJSON()[0] as IsmpRequest; + if ("get" in request) { + request.get.source = convertToStateMachine(`POLKADOT-${POP_ID}`); + request.get.dest = convertToStateMachine(`POLKADOT-${AH_ID}`); + } + + // We only requested a single request so we only get one in the response. + return request; +} + +async function makeIsmpResponse( + popApi: ApiPromise, + ahApi: ApiPromise, + request: IsmpRequest, + responderAddress: string, +): Promise { + console.log("makeIsmpResponse"); + + const hashAt = ( + await ahApi.query.system.blockHash(Number(request.get.height)) + ).toString(); + console.log("hashAt: " + hashAt); + const proofData = await ahApi.rpc.state.getReadProof( + [request.get.keys[0]], + hashAt, + ); + console.log("proofData: " + proofData); + + const stateMachineProof = popApi.createType("StateMachineProof", { + hasher: "Blake2", + storage_proof: proofData.proof, + }); + + const substrateStateProof = popApi.createType("SubstrateStateProof", { + StateProof: stateMachineProof, + }); + + const response = popApi.tx.ismp.handleUnsigned([ + { + Response: { + datagram: { + Request: [request], + }, + proof: { + height: { + id: { + stateId: { + Polkadot: AH_ID, + }, + consensusStateId: "PARA", + }, + height: request.get.height.toString(), + }, + proof: substrateStateProof.toHex(), + }, + signer: responderAddress, + }, + }, + ]); + console.log("response: " + response); + + // unsigned transaction + return new Promise((resolve, reject) => { + const unsub = response.send(({status, isError}) => { + console.log(`Current status is ${status}`); + if (status.isInBlock) { + console.log(`Transaction included at blockHash ${status.asInBlock}`); + } else if (status.isFinalized) { + console.log( + `Transaction finalized at blockHash ${status.asFinalized}`, + ); + unsub.then(); + return resolve(); + } else if (isError) { + console.log("Transaction error"); + unsub.then(); + return reject(); + } + }); + }); +} + +run(); \ No newline at end of file diff --git a/scripts/ismp-get/package.json b/scripts/ismp-get/package.json new file mode 100644 index 00000000..d552e771 --- /dev/null +++ b/scripts/ismp-get/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "@polkadot/api": "^12.3.1" + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" +} \ No newline at end of file diff --git a/scripts/ismp-get/types.ts b/scripts/ismp-get/types.ts new file mode 100644 index 00000000..6ca684ca --- /dev/null +++ b/scripts/ismp-get/types.ts @@ -0,0 +1,75 @@ +export type StateMachine = { Polkadot: number } | { Kusama: number }; + +export interface Events { + events: any[]; +} + +export interface Get { + source: StateMachine; + dest: StateMachine; + nonce: bigint; + from: string; + keys: Array; + height: bigint; + timeout_timestamp: bigint; +} + +export type IsmpRequest = { get: Get }; + +export const API_TYPES = { + HashAlgorithm: { + _enum: ["Keccak", "Blake2"], + }, + StateMachineProof: { + hasher: "HashAlgorithm", + storage_proof: "Vec>", + }, + SubstrateStateProof: { + _enum: { + OverlayProof: "StateMachineProof", + StateProof: "StateMachineProof", + }, + }, + LeafIndexQuery: { + commitment: "H256", + }, + StateMachine: { + _enum: { + Ethereum: "Vec", + Polkadot: "Vec", + Kusama: "u32", + }, + }, + Get: { + // Can't be decoded directly to StateMachine type. + source: "String", + // Can't be decoded directly to StateMachine type. + dest: "String", + nonce: "u64", + from: "Vec", + keys: "Vec>", + height: "u64", + timeout_timestamp: "u64", + }, + Request: { + _enum: { + Post: "Post", + Get: "Get", + }, + }, +}; + +export const CUSTOM_RPC = { + ismp: { + queryRequests: { + description: "", + params: [ + { + name: "query", + type: "Vec", + }, + ], + type: "Vec", + }, + }, +}; \ No newline at end of file diff --git a/scripts/ismp-get/yarn.lock b/scripts/ismp-get/yarn.lock new file mode 100644 index 00000000..f255620a --- /dev/null +++ b/scripts/ismp-get/yarn.lock @@ -0,0 +1,566 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@noble/curves@^1.3.0": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" + integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ== + dependencies: + "@noble/hashes" "1.5.0" + +"@noble/hashes@1.5.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" + integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== + +"@polkadot-api/json-rpc-provider-proxy@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz#6e191f28e7d0fbbe8b540fc51d12a0adaeba297e" + integrity sha512-8GSFE5+EF73MCuLQm8tjrbCqlgclcHBSRaswvXziJ0ZW7iw3UEMsKkkKvELayWyBuOPa2T5i1nj6gFOeIsqvrg== + +"@polkadot-api/json-rpc-provider@0.0.1", "@polkadot-api/json-rpc-provider@^0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider/-/json-rpc-provider-0.0.1.tgz#333645d40ccd9bccfd1f32503f17e4e63e76e297" + integrity sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA== + +"@polkadot-api/metadata-builders@0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@polkadot-api/metadata-builders/-/metadata-builders-0.3.2.tgz#007f158c9e0546cf79ba440befc0c753ab1a6629" + integrity sha512-TKpfoT6vTb+513KDzMBTfCb/ORdgRnsS3TDFpOhAhZ08ikvK+hjHMt5plPiAX/OWkm1Wc9I3+K6W0hX5Ab7MVg== + dependencies: + "@polkadot-api/substrate-bindings" "0.6.0" + "@polkadot-api/utils" "0.1.0" + +"@polkadot-api/observable-client@^0.3.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@polkadot-api/observable-client/-/observable-client-0.3.2.tgz#fd91efee350595a6e0ecfd3f294cc80de86c0cf7" + integrity sha512-HGgqWgEutVyOBXoGOPp4+IAq6CNdK/3MfQJmhCJb8YaJiaK4W6aRGrdQuQSTPHfERHCARt9BrOmEvTXAT257Ug== + dependencies: + "@polkadot-api/metadata-builders" "0.3.2" + "@polkadot-api/substrate-bindings" "0.6.0" + "@polkadot-api/utils" "0.1.0" + +"@polkadot-api/substrate-bindings@0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@polkadot-api/substrate-bindings/-/substrate-bindings-0.6.0.tgz#889b0c3ba19dc95282286506bf6e370a43ce119a" + integrity sha512-lGuhE74NA1/PqdN7fKFdE5C1gNYX357j1tWzdlPXI0kQ7h3kN0zfxNOpPUN7dIrPcOFZ6C0tRRVrBylXkI6xPw== + dependencies: + "@noble/hashes" "^1.3.1" + "@polkadot-api/utils" "0.1.0" + "@scure/base" "^1.1.1" + scale-ts "^1.6.0" + +"@polkadot-api/substrate-client@^0.1.2": + version "0.1.4" + resolved "https://registry.yarnpkg.com/@polkadot-api/substrate-client/-/substrate-client-0.1.4.tgz#7a808e5cb85ecb9fa2b3a43945090a6c807430ce" + integrity sha512-MljrPobN0ZWTpn++da9vOvt+Ex+NlqTlr/XT7zi9sqPtDJiQcYl+d29hFAgpaeTqbeQKZwz3WDE9xcEfLE8c5A== + dependencies: + "@polkadot-api/json-rpc-provider" "0.0.1" + "@polkadot-api/utils" "0.1.0" + +"@polkadot-api/utils@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@polkadot-api/utils/-/utils-0.1.0.tgz#d36937cdc465c2ea302f3278cf53157340ab33a0" + integrity sha512-MXzWZeuGxKizPx2Xf/47wx9sr/uxKw39bVJUptTJdsaQn/TGq+z310mHzf1RCGvC1diHM8f593KrnDgc9oNbJA== + +"@polkadot/api-augment@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-12.4.2.tgz#6c52a6d04f398e786a834839948b0bc0069b391c" + integrity sha512-BkG2tQpUUO0iUm65nSqP8hwHkNfN8jQw8apqflJNt9H8EkEL6v7sqwbLvGqtlxM9wzdxbg7lrWp3oHg4rOP31g== + dependencies: + "@polkadot/api-base" "12.4.2" + "@polkadot/rpc-augment" "12.4.2" + "@polkadot/types" "12.4.2" + "@polkadot/types-augment" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/api-base@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-12.4.2.tgz#c8312bae8dfc70c0fdec0c1366e405906e66575f" + integrity sha512-XYI7Po8i6C4lYZah7Xo0v7zOAawBUfkmtx0YxsLY/665Sup8oqzEj666xtV9qjBzR9coNhQonIFOn+9fh27Ncw== + dependencies: + "@polkadot/rpc-core" "12.4.2" + "@polkadot/types" "12.4.2" + "@polkadot/util" "^13.0.2" + rxjs "^7.8.1" + tslib "^2.6.3" + +"@polkadot/api-derive@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-12.4.2.tgz#2a1fbd79ff4842edc20378957374000ca6f7bd70" + integrity sha512-R0AMANEnqs5AiTaiQX2FXCxUlOibeDSgqlkyG1/0KDsdr6PO/l3dJOgEO+grgAwh4hdqzk4I9uQpdKxG83f2Gw== + dependencies: + "@polkadot/api" "12.4.2" + "@polkadot/api-augment" "12.4.2" + "@polkadot/api-base" "12.4.2" + "@polkadot/rpc-core" "12.4.2" + "@polkadot/types" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + "@polkadot/util-crypto" "^13.0.2" + rxjs "^7.8.1" + tslib "^2.6.3" + +"@polkadot/api@12.4.2", "@polkadot/api@^12.3.1": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-12.4.2.tgz#c13dc1ad7fab670c5fd6d8d970a8462b999d7c1d" + integrity sha512-e1KS048471iBWZU10TJNEYOZqLO+8h8ajmVqpaIBOVkamN7tmacBxmHgq0+IA8VrGxjxtYNa1xF5Sqrg76uBEg== + dependencies: + "@polkadot/api-augment" "12.4.2" + "@polkadot/api-base" "12.4.2" + "@polkadot/api-derive" "12.4.2" + "@polkadot/keyring" "^13.0.2" + "@polkadot/rpc-augment" "12.4.2" + "@polkadot/rpc-core" "12.4.2" + "@polkadot/rpc-provider" "12.4.2" + "@polkadot/types" "12.4.2" + "@polkadot/types-augment" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/types-create" "12.4.2" + "@polkadot/types-known" "12.4.2" + "@polkadot/util" "^13.0.2" + "@polkadot/util-crypto" "^13.0.2" + eventemitter3 "^5.0.1" + rxjs "^7.8.1" + tslib "^2.6.3" + +"@polkadot/keyring@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-13.0.2.tgz#05a655eb06c965ae5ee5f181d25916797ea50849" + integrity sha512-NeLbhyKDT5W8LI9seWTZGePxNTOVpDhv2018HSrEDwJq9Ie0C4TZhUf3KNERCkSveuThXjfQJMs+1CF33ZXPWw== + dependencies: + "@polkadot/util" "13.0.2" + "@polkadot/util-crypto" "13.0.2" + tslib "^2.6.2" + +"@polkadot/networks@13.0.2", "@polkadot/networks@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-13.0.2.tgz#0f8fc896b8fb2141212b6448739f4a00bc72b29c" + integrity sha512-ABAL+vug/gIwkdFEzeh87JoJd0YKrxSYg/HjUrZ+Zis2ucxQEKpvtCpJ34ku+YrjacBfVqIAkkwd3ZdIPGq9aQ== + dependencies: + "@polkadot/util" "13.0.2" + "@substrate/ss58-registry" "^1.46.0" + tslib "^2.6.2" + +"@polkadot/rpc-augment@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-12.4.2.tgz#fbe310260f3e5159fc2fa924c1a7c52f69162f9c" + integrity sha512-IEco5pnso+fYkZNMlMAN5i4XAxdXPv0PZ0HNuWlCwF/MmRvWl8pq5JFtY1FiByHEbeuHwMIUhHM5SDKQ85q9Hg== + dependencies: + "@polkadot/rpc-core" "12.4.2" + "@polkadot/types" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/rpc-core@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-12.4.2.tgz#d20cfdadd932978d58037a213115844a0c49464b" + integrity sha512-yaveqxNcmyluyNgsBT5tpnCa/md0CGbOtRK7K82LWsz7gsbh0x80GBbJrQGxsUybg1gPeZbO1q9IigwA6fY8ag== + dependencies: + "@polkadot/rpc-augment" "12.4.2" + "@polkadot/rpc-provider" "12.4.2" + "@polkadot/types" "12.4.2" + "@polkadot/util" "^13.0.2" + rxjs "^7.8.1" + tslib "^2.6.3" + +"@polkadot/rpc-provider@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-12.4.2.tgz#c6a4f9b9194a5227e4355cef026aac2b07430162" + integrity sha512-cAhfN937INyxwW1AdjABySdCKhC7QCIONRDHDea1aLpiuxq/w+QwjxauR9fCNGh3lTaAwwnmZ5WfFU2PtkDMGQ== + dependencies: + "@polkadot/keyring" "^13.0.2" + "@polkadot/types" "12.4.2" + "@polkadot/types-support" "12.4.2" + "@polkadot/util" "^13.0.2" + "@polkadot/util-crypto" "^13.0.2" + "@polkadot/x-fetch" "^13.0.2" + "@polkadot/x-global" "^13.0.2" + "@polkadot/x-ws" "^13.0.2" + eventemitter3 "^5.0.1" + mock-socket "^9.3.1" + nock "^13.5.4" + tslib "^2.6.3" + optionalDependencies: + "@substrate/connect" "0.8.11" + +"@polkadot/types-augment@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-12.4.2.tgz#8b8e278f4cbecbdd586470d31c27576e06e87074" + integrity sha512-3fDCOy2BEMuAtMYl4crKg76bv/0pDNEuzpAzV4EBUMIlJwypmjy5sg3gUPCMcA+ckX3xb8DhkWU4ceUdS7T2KQ== + dependencies: + "@polkadot/types" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types-codec@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-12.4.2.tgz#aa601ddbbe4bb28ef751e4565bd87037dee9a49b" + integrity sha512-DiPGRFWtVMepD9i05eC3orSbGtpN7un/pXOrXu0oriU+oxLkpvZH68ZsPNtJhKdQy03cAYtvB8elJOFJZYqoqQ== + dependencies: + "@polkadot/util" "^13.0.2" + "@polkadot/x-bigint" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types-create@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-12.4.2.tgz#1113746ab92694c3402abc59feb3e3fcaf980997" + integrity sha512-nOpeAKZLdSqNMfzS3waQXgyPPaNt8rUHEmR5+WNv6c/Ke/vyf710wjxiTewfp0wpBgtdrimlgG4DLX1J9Ms1LA== + dependencies: + "@polkadot/types-codec" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types-known@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-12.4.2.tgz#c47ffac0a0bcc544e120f09e92f39e6f61ed94c8" + integrity sha512-bvhO4KQu/dgPmdwQXsweSMRiRisJ7Bp38lZVEIFykfd2qYyRW3OQEbIPKYpx9raD+fDATU0bTiKQnELrSGhYXw== + dependencies: + "@polkadot/networks" "^13.0.2" + "@polkadot/types" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/types-create" "12.4.2" + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types-support@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-12.4.2.tgz#22df5c22a002aca271507355123aeb68e1399c03" + integrity sha512-bz6JSt23UEZ2eXgN4ust6z5QF9pO5uNH7UzCP+8I/Nm85ZipeBYj2Wu6pLlE3Hw30hWZpuPxMDOKoEhN5bhLgw== + dependencies: + "@polkadot/util" "^13.0.2" + tslib "^2.6.3" + +"@polkadot/types@12.4.2": + version "12.4.2" + resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-12.4.2.tgz#948e0191b30c37f0d89b8e120174d6be31ed9f9d" + integrity sha512-ivYtt7hYcRvo69ULb1BJA9BE1uefijXcaR089Dzosr9+sMzvsB1yslNQReOq+Wzq6h6AQj4qex6qVqjWZE6Z4A== + dependencies: + "@polkadot/keyring" "^13.0.2" + "@polkadot/types-augment" "12.4.2" + "@polkadot/types-codec" "12.4.2" + "@polkadot/types-create" "12.4.2" + "@polkadot/util" "^13.0.2" + "@polkadot/util-crypto" "^13.0.2" + rxjs "^7.8.1" + tslib "^2.6.3" + +"@polkadot/util-crypto@13.0.2", "@polkadot/util-crypto@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-13.0.2.tgz#fee602bcb39e9424300410f4144f170ee2a29292" + integrity sha512-woUsJJ6zd/caL7U+D30a5oM/+WK9iNI00Y8aNUHSj6Zq/KPzK9uqDBaLGWwlgrejoMQkxxiU2X0f2LzP15AtQg== + dependencies: + "@noble/curves" "^1.3.0" + "@noble/hashes" "^1.3.3" + "@polkadot/networks" "13.0.2" + "@polkadot/util" "13.0.2" + "@polkadot/wasm-crypto" "^7.3.2" + "@polkadot/wasm-util" "^7.3.2" + "@polkadot/x-bigint" "13.0.2" + "@polkadot/x-randomvalues" "13.0.2" + "@scure/base" "^1.1.5" + tslib "^2.6.2" + +"@polkadot/util@13.0.2", "@polkadot/util@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-13.0.2.tgz#f0a2572d74730fda8dfd690b60d53c131a688f3b" + integrity sha512-/6bS9sfhJLhs8QuqWaR1eRapzfDdGC5XAQZEPL9NN5sTTA7HxWos8rVleai0UERm8QUMabjZ9rK9KpzbXl7ojg== + dependencies: + "@polkadot/x-bigint" "13.0.2" + "@polkadot/x-global" "13.0.2" + "@polkadot/x-textdecoder" "13.0.2" + "@polkadot/x-textencoder" "13.0.2" + "@types/bn.js" "^5.1.5" + bn.js "^5.2.1" + tslib "^2.6.2" + +"@polkadot/wasm-bridge@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz#e1b01906b19e06cbca3d94f10f5666f2ae0baadc" + integrity sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g== + dependencies: + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-crypto-asmjs@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz#c6d41bc4b48b5359d57a24ca3066d239f2d70a34" + integrity sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q== + dependencies: + tslib "^2.6.2" + +"@polkadot/wasm-crypto-init@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz#7e1fe79ba978fb0a4a0f74a92d976299d38bc4b8" + integrity sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g== + dependencies: + "@polkadot/wasm-bridge" "7.3.2" + "@polkadot/wasm-crypto-asmjs" "7.3.2" + "@polkadot/wasm-crypto-wasm" "7.3.2" + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-crypto-wasm@7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz#44e08ed5cf6499ce4a3aa7247071a5d01f6a74f4" + integrity sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw== + dependencies: + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-crypto@^7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz#61bbcd9e591500705c8c591e6aff7654bdc8afc9" + integrity sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw== + dependencies: + "@polkadot/wasm-bridge" "7.3.2" + "@polkadot/wasm-crypto-asmjs" "7.3.2" + "@polkadot/wasm-crypto-init" "7.3.2" + "@polkadot/wasm-crypto-wasm" "7.3.2" + "@polkadot/wasm-util" "7.3.2" + tslib "^2.6.2" + +"@polkadot/wasm-util@7.3.2", "@polkadot/wasm-util@^7.3.2": + version "7.3.2" + resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz#4fe6370d2b029679b41a5c02cd7ebf42f9b28de1" + integrity sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg== + dependencies: + tslib "^2.6.2" + +"@polkadot/x-bigint@13.0.2", "@polkadot/x-bigint@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-13.0.2.tgz#25adca9ce0c5ed691f9bced283f44f7e7d824300" + integrity sha512-h2jKT/UaxiEal8LhQeH6+GCjO7GwEqVAD2SNYteCOXff6yNttqAZYJuHZsndbVjVNwqRNf8D5q/zZkD0HUd6xQ== + dependencies: + "@polkadot/x-global" "13.0.2" + tslib "^2.6.2" + +"@polkadot/x-fetch@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-13.0.2.tgz#841d901fae36cbc4157297324ca0d73fbe4d200e" + integrity sha512-B/gf9iriUr6za/Ui7zIFBfHz7UBZ68rJEIteWHx1UHRCZPcLqv+hgpev6xIGrkfFljI0/lI7IwtN2qy6HYzFBg== + dependencies: + "@polkadot/x-global" "13.0.2" + node-fetch "^3.3.2" + tslib "^2.6.2" + +"@polkadot/x-global@13.0.2", "@polkadot/x-global@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-13.0.2.tgz#77afc4fbd4cfac8ba78cf120836f30ecc7322a74" + integrity sha512-OoNIXLB5y8vIKpk4R+XmpDPhipNXWSUvEwUnpQT7NAxNLmzgMq1FhbrwBWWPRNHPrQonp7mqxV/X+v5lv1HW/g== + dependencies: + tslib "^2.6.2" + +"@polkadot/x-randomvalues@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-13.0.2.tgz#78ae28b345895cc816ffcad0b336c31cadfcf928" + integrity sha512-SGj+L0H/7TWZtSmtkWlixO4DFzXDdluI0UscN2h285os2Ns8PnmBbue+iJ8PVSzpY1BOxd66gvkkpboPz+jXFQ== + dependencies: + "@polkadot/x-global" "13.0.2" + tslib "^2.6.2" + +"@polkadot/x-textdecoder@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-13.0.2.tgz#662a6855af8e7a5af17f86890e59ab44f829243a" + integrity sha512-mauglOkTJxLGmLwLc3J5Jlq/W+SHP53eiy3F8/8JxxfnXrZKgWoQXGpvXYPjFnMZj0MzDSy/6GjyGWnDCgdQFA== + dependencies: + "@polkadot/x-global" "13.0.2" + tslib "^2.6.2" + +"@polkadot/x-textencoder@13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-13.0.2.tgz#5e178e0f759df50592e6870346c8db2a445af957" + integrity sha512-Lq08H2OnVXj97uaOwg7tcmRS7a4VJYkHEeWO4FyEMOk6P6lU6W8OVNjjxG0se9PCEgmyZPUDbJI//1ynzP4cXw== + dependencies: + "@polkadot/x-global" "13.0.2" + tslib "^2.6.2" + +"@polkadot/x-ws@^13.0.2": + version "13.0.2" + resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-13.0.2.tgz#d0392a87adcba851a44fc6f7f56792e529228f3e" + integrity sha512-nC5e2eY5D5ZR5teQOB7ib+dWLbmNws86cTz3BjKCalSMBBIn6i3V9ElgABpierBmnSJe9D94EyrH1BxdVfDxUg== + dependencies: + "@polkadot/x-global" "13.0.2" + tslib "^2.6.2" + ws "^8.16.0" + +"@scure/base@^1.1.1", "@scure/base@^1.1.5": + version "1.1.8" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.8.tgz#8f23646c352f020c83bca750a82789e246d42b50" + integrity sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg== + +"@substrate/connect-extension-protocol@^2.0.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.1.0.tgz#7df153f704702b98559e7e5e8a2ce17881fe1d1d" + integrity sha512-Wz5Cbn6S6P4vWfHyrsnPW7g15IAViMaXCk+jYkq4nNEMmzPtTKIEbtxrdDMBKrouOFtYKKp0znx5mh9KTCNqlA== + +"@substrate/connect-known-chains@^1.1.5": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@substrate/connect-known-chains/-/connect-known-chains-1.4.0.tgz#ee0562056cf98a3ee1103a64fa33ff21d86c69fd" + integrity sha512-p/mxn1GobtxJ+7xbIkUH4+/njH1neRHHKTcSGHNOC78Cf6Ch1Xzp082+nMjOBDLQLmraK5PF74AKV3WXHGuALw== + +"@substrate/connect@0.8.11": + version "0.8.11" + resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.8.11.tgz#983ec69a05231636e217b573b8130a6b942af69f" + integrity sha512-ofLs1PAO9AtDdPbdyTYj217Pe+lBfTLltdHDs3ds8no0BseoLeAGxpz1mHfi7zB4IxI3YyAiLjH6U8cw4pj4Nw== + dependencies: + "@substrate/connect-extension-protocol" "^2.0.0" + "@substrate/connect-known-chains" "^1.1.5" + "@substrate/light-client-extension-helpers" "^1.0.0" + smoldot "2.0.26" + +"@substrate/light-client-extension-helpers@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-1.0.0.tgz#7b60368c57e06e5cf798c6557422d12e6d81f1ff" + integrity sha512-TdKlni1mBBZptOaeVrKnusMg/UBpWUORNDv5fdCaJklP4RJiFOzBCrzC+CyVI5kQzsXBisZ+2pXm+rIjS38kHg== + dependencies: + "@polkadot-api/json-rpc-provider" "^0.0.1" + "@polkadot-api/json-rpc-provider-proxy" "^0.1.0" + "@polkadot-api/observable-client" "^0.3.0" + "@polkadot-api/substrate-client" "^0.1.2" + "@substrate/connect-extension-protocol" "^2.0.0" + "@substrate/connect-known-chains" "^1.1.5" + rxjs "^7.8.1" + +"@substrate/ss58-registry@^1.46.0": + version "1.50.0" + resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.50.0.tgz#2d2a3d060cd4eadd200e4538078461ba73e13d6d" + integrity sha512-mkmlMlcC+MSd9rA+PN8ljGAm5fVZskvVwkXIsbx4NFwaT8kt38r7e9cyDWscG3z2Zn40POviZvEMrJSk+r2SgQ== + +"@types/bn.js@^5.1.5": + version "5.1.5" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.5.tgz#2e0dacdcce2c0f16b905d20ff87aedbc6f7b4bf0" + integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== + dependencies: + "@types/node" "*" + +"@types/node@*": + version "22.5.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.4.tgz#83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8" + integrity sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg== + dependencies: + undici-types "~6.19.2" + +bn.js@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + +data-uri-to-buffer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" + integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== + +debug@^4.1.0: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + +eventemitter3@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" + integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== + +fetch-blob@^3.1.2, fetch-blob@^3.1.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" + integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== + dependencies: + node-domexception "^1.0.0" + web-streams-polyfill "^3.0.3" + +formdata-polyfill@^4.0.10: + version "4.0.10" + resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" + integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== + dependencies: + fetch-blob "^3.1.2" + +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 sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + +mock-socket@^9.3.1: + version "9.3.1" + resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.3.1.tgz#24fb00c2f573c84812aa4a24181bb025de80cc8e" + integrity sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw== + +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +nock@^13.5.4: + version "13.5.5" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.5.5.tgz#cd1caaca281d42be17d51946367a3d53a6af3e78" + integrity sha512-XKYnqUrCwXC8DGG1xX4YH5yNIrlh9c065uaMZZHUoeUUINTOyt+x/G+ezYk0Ft6ExSREVIs+qBJDK503viTfFA== + dependencies: + debug "^4.1.0" + json-stringify-safe "^5.0.1" + propagate "^2.0.0" + +node-domexception@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + +node-fetch@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" + integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== + dependencies: + data-uri-to-buffer "^4.0.0" + fetch-blob "^3.1.4" + formdata-polyfill "^4.0.10" + +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== + +rxjs@^7.8.1: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +scale-ts@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/scale-ts/-/scale-ts-1.6.0.tgz#e9641093c5a9e50f964ddb1607139034e3e932e9" + integrity sha512-Ja5VCjNZR8TGKhUumy9clVVxcDpM+YFjAnkMuwQy68Hixio3VRRvWdE3g8T/yC+HXA0ZDQl2TGyUmtmbcVl40Q== + +smoldot@2.0.26: + version "2.0.26" + resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-2.0.26.tgz#0e64c7fcd26240fbe4c8d6b6e4b9a9aca77e00f6" + integrity sha512-F+qYmH4z2s2FK+CxGj8moYcd1ekSIKH8ywkdqlOz88Dat35iB1DIYL11aILN46YSGMzQW/lbJNS307zBSDN5Ig== + dependencies: + ws "^8.8.1" + +tslib@^2.1.0, tslib@^2.6.2, tslib@^2.6.3: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +web-streams-polyfill@^3.0.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" + integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== + +ws@^8.16.0, ws@^8.8.1: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== From 6cd981ee48f57f4b9f5dff123db72a5108132f2a Mon Sep 17 00:00:00 2001 From: Peter White Date: Tue, 10 Sep 2024 11:48:43 -0600 Subject: [PATCH 5/8] chore: update Cargo.lock to use latest ismp --- Cargo.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08bc158e..24621602 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5097,7 +5097,7 @@ checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "ismp" version = "0.2.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "anyhow", "derive_more", @@ -5113,7 +5113,7 @@ dependencies = [ [[package]] name = "ismp-parachain" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -5138,7 +5138,7 @@ dependencies = [ [[package]] name = "ismp-parachain-inherent" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "anyhow", "async-trait", @@ -5159,7 +5159,7 @@ dependencies = [ [[package]] name = "ismp-parachain-runtime-api" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "cumulus-pallet-parachain-system", "sp-api", @@ -6452,7 +6452,7 @@ dependencies = [ [[package]] name = "mmr-primitives" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "ckb-merkle-mountain-range", "frame-system", @@ -7847,7 +7847,7 @@ dependencies = [ [[package]] name = "pallet-ismp" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "fortuples", "frame-benchmarking", @@ -7870,7 +7870,7 @@ dependencies = [ [[package]] name = "pallet-ismp-demo" version = "0.1.1" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "frame-support", "frame-system", @@ -7886,7 +7886,7 @@ dependencies = [ [[package]] name = "pallet-ismp-rpc" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "anyhow", "frame-system", @@ -7915,7 +7915,7 @@ dependencies = [ [[package]] name = "pallet-ismp-runtime-api" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "ismp", "pallet-ismp", @@ -13506,7 +13506,7 @@ dependencies = [ [[package]] name = "serde-utils" version = "0.1.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "anyhow", "hex", @@ -15148,7 +15148,7 @@ dependencies = [ [[package]] name = "substrate-state-machine" version = "1.15.0" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#46862a00e2e227e8c77a6b9c1a14b278f6b64c06" +source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" dependencies = [ "frame-support", "hash-db", From aa2612b52f929fe301d6bb864cd7177205817bad Mon Sep 17 00:00:00 2001 From: Peter White Date: Fri, 13 Sep 2024 15:22:18 -0600 Subject: [PATCH 6/8] refactor: remove ismp-demo and testing script --- Cargo.lock | 17 - Cargo.toml | 1 - runtime/devnet/Cargo.toml | 2 - runtime/devnet/src/config/ismp.rs | 11 +- runtime/devnet/src/lib.rs | 2 - scripts/ismp-get/README.md | 37 -- scripts/ismp-get/common.ts | 88 ----- scripts/ismp-get/ismp-get.ts | 208 ----------- scripts/ismp-get/package.json | 6 - scripts/ismp-get/types.ts | 75 ---- scripts/ismp-get/yarn.lock | 566 ------------------------------ 11 files changed, 2 insertions(+), 1011 deletions(-) delete mode 100644 scripts/ismp-get/README.md delete mode 100644 scripts/ismp-get/common.ts delete mode 100644 scripts/ismp-get/ismp-get.ts delete mode 100644 scripts/ismp-get/package.json delete mode 100644 scripts/ismp-get/types.ts delete mode 100644 scripts/ismp-get/yarn.lock diff --git a/Cargo.lock b/Cargo.lock index 24621602..85624fd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7867,22 +7867,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-ismp-demo" -version = "0.1.1" -source = "git+https://github.com/r0gue-io/ismp?branch=polkadot-v1.14.0#f95ee188c3b73ca3c4d6319ab85cff12fe757c4c" -dependencies = [ - "frame-support", - "frame-system", - "ismp", - "pallet-balances", - "pallet-ismp", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-runtime", -] - [[package]] name = "pallet-ismp-rpc" version = "1.15.0" @@ -10593,7 +10577,6 @@ dependencies = [ "pallet-collator-selection", "pallet-contracts", "pallet-ismp", - "pallet-ismp-demo", "pallet-ismp-runtime-api", "pallet-message-queue", "pallet-multisig", diff --git a/Cargo.toml b/Cargo.toml index 01835cba..c8a5516f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,6 +182,5 @@ ismp-parachain = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot- ismp-parachain-inherent = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } ismp-parachain-runtime-api = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } pallet-ismp = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } -pallet-ismp-demo = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } pallet-ismp-rpc = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } pallet-ismp-runtime-api = { git = "https://github.com/r0gue-io/ismp", branch = "polkadot-v1.14.0", default-features = false } diff --git a/runtime/devnet/Cargo.toml b/runtime/devnet/Cargo.toml index 6313de27..e8887f2b 100644 --- a/runtime/devnet/Cargo.toml +++ b/runtime/devnet/Cargo.toml @@ -95,7 +95,6 @@ ismp.workspace = true ismp-parachain.workspace = true ismp-parachain-runtime-api.workspace = true pallet-ismp = { workspace = true, features = [ "unsigned" ] } -pallet-ismp-demo.workspace = true pallet-ismp-runtime-api.workspace = true [dev-dependencies] @@ -226,7 +225,6 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-collator-selection/try-runtime", "pallet-contracts/try-runtime", - "pallet-ismp-demo/try-runtime", "pallet-ismp/try-runtime", "pallet-message-queue/try-runtime", "pallet-multisig/try-runtime", diff --git a/runtime/devnet/src/config/ismp.rs b/runtime/devnet/src/config/ismp.rs index 9494fe20..896b996f 100644 --- a/runtime/devnet/src/config/ismp.rs +++ b/runtime/devnet/src/config/ismp.rs @@ -23,13 +23,6 @@ impl pallet_ismp::Config for Runtime { type WeightProvider = (); } -impl pallet_ismp_demo::Config for Runtime { - type Balance = Balance; - type IsmpDispatcher = Ismp; - type NativeCurrency = Balances; - type RuntimeEvent = RuntimeEvent; -} - impl ismp_parachain::Config for Runtime { type IsmpHost = Ismp; type RuntimeEvent = RuntimeEvent; @@ -52,7 +45,7 @@ impl Get for HostStateMachine { #[derive(Default)] pub struct Router; impl IsmpRouter for Router { - fn module_for_id(&self, _id: Vec) -> Result, Error> { - Ok(Box::new(pallet_ismp_demo::IsmpModuleCallback::::default())) + fn module_for_id(&self, id: Vec) -> Result, Error> { + Err(Error::ModuleNotFound(id)) } } diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index 296b95f6..07d959c5 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -612,8 +612,6 @@ mod runtime { pub type CumulusXcm = cumulus_pallet_xcm::Pallet; #[runtime::pallet_index(33)] pub type MessageQueue = pallet_message_queue::Pallet; - #[runtime::pallet_index(37)] - pub type IsmpDemo = pallet_ismp_demo::Pallet; #[runtime::pallet_index(38)] pub type Ismp = pallet_ismp::Pallet; #[runtime::pallet_index(39)] diff --git a/scripts/ismp-get/README.md b/scripts/ismp-get/README.md deleted file mode 100644 index d132f812..00000000 --- a/scripts/ismp-get/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# ISMP Get Testing Script - -This is a simple script intended to showcase the flow of performing a GET request -to the ISMP API. - -THe script uses a hard-coded storage key to Asset - -## Usage - -Setup: - -``` -yarn -``` - -Ensure ts-node is installed - -``` -yarn add ts-node typescript @types/node --dev -``` - -Ensure devnet is launched with `--enable-offchain-indexing=true` - -``` -pop up parachain -f networks/devnet.toml -``` - -Run the script: - -``` -ts-node ismp-get.ts -``` - -## Acknowledgements - -This script was originally inspired and adapted -from [RegionX](https://github.com/RegionX-Labs/RegionX-Node/tree/main/e2e_tests/xc-transfer) \ No newline at end of file diff --git a/scripts/ismp-get/common.ts b/scripts/ismp-get/common.ts deleted file mode 100644 index 7a855584..00000000 --- a/scripts/ismp-get/common.ts +++ /dev/null @@ -1,88 +0,0 @@ -import {ApiPromise, Keyring} from '@polkadot/api'; -import {SignerOptions, SubmittableExtrinsic} from '@polkadot/api/types'; -import {KeyringPair} from '@polkadot/keyring/types'; -import {stringToU8a} from '@polkadot/util'; -import {encodeAddress} from '@polkadot/util-crypto'; -import {Events} from './types'; - -const RELAY_ASSET_ID = 1; - -async function submitExtrinsic( - signer: KeyringPair, - call: SubmittableExtrinsic<'promise'>, - options: Partial, - tx_events: Events -): Promise { - return new Promise((resolve, reject) => { - const unsub = call.signAndSend(signer, options, ({status, isError, events = []}) => { - console.log(`Current status is ${status}`); - if (status.isInBlock) { - console.log(`Transaction included at blockHash ${status.asInBlock}`); - tx_events.events = events; - } else if (status.isFinalized) { - console.log(`Transaction finalized at blockHash ${status.asFinalized}`); - unsub.then(); - return resolve(); - } else if (isError) { - console.log('Transaction error'); - unsub.then(); - return reject(); - } - }); - }); -} - -// Transfer the relay chain asset to the parachain specified by paraId. -// Receiver address is same as the sender's. -async function transferRelayAssetToPara( - amount: bigint, - paraId: number, - relayApi: ApiPromise, - signer: KeyringPair -) { - const receiverKeypair = new Keyring(); - receiverKeypair.addFromAddress(signer.address); - - // If system parachain we use teleportation, otherwise we do a reserve transfer. - const transferKind = paraId < 2000 ? 'limitedTeleportAssets' : 'limitedReserveTransferAssets'; - - const feeAssetItem = 0; - const weightLimit = 'Unlimited'; - const reserveTransfer = relayApi.tx.xcmPallet[transferKind]( - {V3: {parents: 0, interior: {X1: {Parachain: paraId}}}}, //dest - { - V3: { - parents: 0, - interior: { - X1: { - AccountId32: { - chain: 'Any', - id: receiverKeypair.pairs[0].publicKey, - }, - }, - }, - }, - }, //beneficiary - { - V3: [ - { - id: { - Concrete: {parents: 0, interior: 'Here'}, - }, - fun: { - Fungible: amount, - }, - }, - ], - }, //asset - feeAssetItem, - weightLimit - ); - await submitExtrinsic(signer, reserveTransfer, {}, {events: []}); -} - -export { - RELAY_ASSET_ID, - submitExtrinsic, - transferRelayAssetToPara, -}; \ No newline at end of file diff --git a/scripts/ismp-get/ismp-get.ts b/scripts/ismp-get/ismp-get.ts deleted file mode 100644 index a783bff7..00000000 --- a/scripts/ismp-get/ismp-get.ts +++ /dev/null @@ -1,208 +0,0 @@ -import {ApiPromise, Keyring, WsProvider} from "@polkadot/api"; -import {KeyringPair} from "@polkadot/keyring/types"; -import {submitExtrinsic, transferRelayAssetToPara} from "./common"; -import { - IsmpRequest, - Events, - API_TYPES, - CUSTOM_RPC, - StateMachine, -} from "./types"; - -const AH_ID = 1000; -const POP_ID = 4001; - -async function run() { - console.log("starting up..."); - const pop_uri = "ws://127.0.0.1:9944"; - const paseo_uri = "ws://127.0.0.1:8833"; - const ah_uri = "ws://127.0.0.1:9977"; - - const popApi = await ApiPromise.create({ - provider: new WsProvider(pop_uri), - types: {...API_TYPES}, - rpc: CUSTOM_RPC, - }); - const paseoApi = await ApiPromise.create({ - provider: new WsProvider(paseo_uri), - }); - const ahApi = await ApiPromise.create({ - provider: new WsProvider(ah_uri), - }); - - // account to submit tx - const keyring = new Keyring({type: "sr25519"}); - const alice = keyring.addFromUri("//Alice"); - const receiverKeypair = new Keyring(); - receiverKeypair.addFromAddress(alice.address); - - console.log("Setting up asset"); - - // Needed for fee payment - await transferRelayAssetToPara(10n ** 12n, POP_ID, paseoApi, alice); - // add AH as - await ismpAddParachain(alice, popApi); - - const latest_height = await popApi.query.ismp.latestStateMachineHeight({ - stateId: {Polkadot: AH_ID}, - consensusStateId: "PARA" - }); - console.log("Latest Height: ", latest_height.toString()); - - // parachain info pallet fetching para id - let encoded_chain_b_id_storage_key = - "0x0d715f2646c8f85767b5d2764bb2782604a74d81251e398fd8a0a4d55023bb3f"; - const requestRecord = popApi.tx.ismpDemo.getRequest({ - paraId: AH_ID, - height: latest_height.toString(), - timeout: 100000, - keys: [encoded_chain_b_id_storage_key], - }); - let events: Events = {events: []}; - await submitExtrinsic(alice, requestRecord, {}, events); - - console.log("events: ", events); - console.log("Event found: ", findEvent(events.events, "ismp", "Request").toHuman()); - const ismpRequest = findEvent(events.events, "ismp", "Request"); - const commitmentRequest = ismpRequest.event.data.commitment; - console.log("Commitment: ", commitmentRequest.toHex()); - - // Check the data on the Coretime chain: - const ahId = await ahApi.query.parachainInfo.parachainId(); - - console.log("AH ID: ", ahId.toString()); - - // Respond to the ISMP get request: - const request = await queryRequest(popApi, commitmentRequest.toString()); - console.log("Request: "); - console.log(request); - // request.get.source; - await makeIsmpResponse(popApi, ahApi, request, alice.address); -} - -// Function to convert the string to a StateMachine -function convertToStateMachine(input: string): StateMachine { - const [network, value] = input.split("-"); - const numericValue = parseInt(value, 10); - - switch (network.toUpperCase()) { - case "POLKADOT": - return {Polkadot: numericValue}; - case "KUSAMA": - return {Kusama: numericValue}; - // Add cases for other networks as needed - default: - throw new Error(`Unsupported network: ${network}`); - } -} - -function findEvent(events: any[], section: string, method: string): any { - return events.find((event) => event.event.section == section && event.event.method == method); - -} - -async function ismpAddParachain(signer: KeyringPair, popApi: ApiPromise, para_id: number = AH_ID) { - const addParaCall = popApi.tx.ismpParachain.addParachain([ - {id: para_id, slotDuration: 6000}, - ]); - const sudoCall = popApi.tx.sudo.sudo(addParaCall); - return submitExtrinsic(signer, sudoCall, {}, {events: []}); -} - -async function queryRequest( - popApi: ApiPromise, - commitment: string, -): Promise { - console.log("Here"); - const leafIndex = popApi.createType("LeafIndexQuery", { - commitment, - }); - console.log("LeafIndex: ", leafIndex.toHuman()); - const requests = await (popApi as any).rpc.ismp.queryRequests([ - leafIndex, - ]); - console.log("QueryRequest: " + requests); - - const request = requests.toJSON()[0] as IsmpRequest; - if ("get" in request) { - request.get.source = convertToStateMachine(`POLKADOT-${POP_ID}`); - request.get.dest = convertToStateMachine(`POLKADOT-${AH_ID}`); - } - - // We only requested a single request so we only get one in the response. - return request; -} - -async function makeIsmpResponse( - popApi: ApiPromise, - ahApi: ApiPromise, - request: IsmpRequest, - responderAddress: string, -): Promise { - console.log("makeIsmpResponse"); - - const hashAt = ( - await ahApi.query.system.blockHash(Number(request.get.height)) - ).toString(); - console.log("hashAt: " + hashAt); - const proofData = await ahApi.rpc.state.getReadProof( - [request.get.keys[0]], - hashAt, - ); - console.log("proofData: " + proofData); - - const stateMachineProof = popApi.createType("StateMachineProof", { - hasher: "Blake2", - storage_proof: proofData.proof, - }); - - const substrateStateProof = popApi.createType("SubstrateStateProof", { - StateProof: stateMachineProof, - }); - - const response = popApi.tx.ismp.handleUnsigned([ - { - Response: { - datagram: { - Request: [request], - }, - proof: { - height: { - id: { - stateId: { - Polkadot: AH_ID, - }, - consensusStateId: "PARA", - }, - height: request.get.height.toString(), - }, - proof: substrateStateProof.toHex(), - }, - signer: responderAddress, - }, - }, - ]); - console.log("response: " + response); - - // unsigned transaction - return new Promise((resolve, reject) => { - const unsub = response.send(({status, isError}) => { - console.log(`Current status is ${status}`); - if (status.isInBlock) { - console.log(`Transaction included at blockHash ${status.asInBlock}`); - } else if (status.isFinalized) { - console.log( - `Transaction finalized at blockHash ${status.asFinalized}`, - ); - unsub.then(); - return resolve(); - } else if (isError) { - console.log("Transaction error"); - unsub.then(); - return reject(); - } - }); - }); -} - -run(); \ No newline at end of file diff --git a/scripts/ismp-get/package.json b/scripts/ismp-get/package.json deleted file mode 100644 index d552e771..00000000 --- a/scripts/ismp-get/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "dependencies": { - "@polkadot/api": "^12.3.1" - }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" -} \ No newline at end of file diff --git a/scripts/ismp-get/types.ts b/scripts/ismp-get/types.ts deleted file mode 100644 index 6ca684ca..00000000 --- a/scripts/ismp-get/types.ts +++ /dev/null @@ -1,75 +0,0 @@ -export type StateMachine = { Polkadot: number } | { Kusama: number }; - -export interface Events { - events: any[]; -} - -export interface Get { - source: StateMachine; - dest: StateMachine; - nonce: bigint; - from: string; - keys: Array; - height: bigint; - timeout_timestamp: bigint; -} - -export type IsmpRequest = { get: Get }; - -export const API_TYPES = { - HashAlgorithm: { - _enum: ["Keccak", "Blake2"], - }, - StateMachineProof: { - hasher: "HashAlgorithm", - storage_proof: "Vec>", - }, - SubstrateStateProof: { - _enum: { - OverlayProof: "StateMachineProof", - StateProof: "StateMachineProof", - }, - }, - LeafIndexQuery: { - commitment: "H256", - }, - StateMachine: { - _enum: { - Ethereum: "Vec", - Polkadot: "Vec", - Kusama: "u32", - }, - }, - Get: { - // Can't be decoded directly to StateMachine type. - source: "String", - // Can't be decoded directly to StateMachine type. - dest: "String", - nonce: "u64", - from: "Vec", - keys: "Vec>", - height: "u64", - timeout_timestamp: "u64", - }, - Request: { - _enum: { - Post: "Post", - Get: "Get", - }, - }, -}; - -export const CUSTOM_RPC = { - ismp: { - queryRequests: { - description: "", - params: [ - { - name: "query", - type: "Vec", - }, - ], - type: "Vec", - }, - }, -}; \ No newline at end of file diff --git a/scripts/ismp-get/yarn.lock b/scripts/ismp-get/yarn.lock deleted file mode 100644 index f255620a..00000000 --- a/scripts/ismp-get/yarn.lock +++ /dev/null @@ -1,566 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@noble/curves@^1.3.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.6.0.tgz#be5296ebcd5a1730fccea4786d420f87abfeb40b" - integrity sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ== - dependencies: - "@noble/hashes" "1.5.0" - -"@noble/hashes@1.5.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.3.3": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.5.0.tgz#abadc5ca20332db2b1b2aa3e496e9af1213570b0" - integrity sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA== - -"@polkadot-api/json-rpc-provider-proxy@^0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider-proxy/-/json-rpc-provider-proxy-0.1.0.tgz#6e191f28e7d0fbbe8b540fc51d12a0adaeba297e" - integrity sha512-8GSFE5+EF73MCuLQm8tjrbCqlgclcHBSRaswvXziJ0ZW7iw3UEMsKkkKvELayWyBuOPa2T5i1nj6gFOeIsqvrg== - -"@polkadot-api/json-rpc-provider@0.0.1", "@polkadot-api/json-rpc-provider@^0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@polkadot-api/json-rpc-provider/-/json-rpc-provider-0.0.1.tgz#333645d40ccd9bccfd1f32503f17e4e63e76e297" - integrity sha512-/SMC/l7foRjpykLTUTacIH05H3mr9ip8b5xxfwXlVezXrNVLp3Cv0GX6uItkKd+ZjzVPf3PFrDF2B2/HLSNESA== - -"@polkadot-api/metadata-builders@0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@polkadot-api/metadata-builders/-/metadata-builders-0.3.2.tgz#007f158c9e0546cf79ba440befc0c753ab1a6629" - integrity sha512-TKpfoT6vTb+513KDzMBTfCb/ORdgRnsS3TDFpOhAhZ08ikvK+hjHMt5plPiAX/OWkm1Wc9I3+K6W0hX5Ab7MVg== - dependencies: - "@polkadot-api/substrate-bindings" "0.6.0" - "@polkadot-api/utils" "0.1.0" - -"@polkadot-api/observable-client@^0.3.0": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@polkadot-api/observable-client/-/observable-client-0.3.2.tgz#fd91efee350595a6e0ecfd3f294cc80de86c0cf7" - integrity sha512-HGgqWgEutVyOBXoGOPp4+IAq6CNdK/3MfQJmhCJb8YaJiaK4W6aRGrdQuQSTPHfERHCARt9BrOmEvTXAT257Ug== - dependencies: - "@polkadot-api/metadata-builders" "0.3.2" - "@polkadot-api/substrate-bindings" "0.6.0" - "@polkadot-api/utils" "0.1.0" - -"@polkadot-api/substrate-bindings@0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@polkadot-api/substrate-bindings/-/substrate-bindings-0.6.0.tgz#889b0c3ba19dc95282286506bf6e370a43ce119a" - integrity sha512-lGuhE74NA1/PqdN7fKFdE5C1gNYX357j1tWzdlPXI0kQ7h3kN0zfxNOpPUN7dIrPcOFZ6C0tRRVrBylXkI6xPw== - dependencies: - "@noble/hashes" "^1.3.1" - "@polkadot-api/utils" "0.1.0" - "@scure/base" "^1.1.1" - scale-ts "^1.6.0" - -"@polkadot-api/substrate-client@^0.1.2": - version "0.1.4" - resolved "https://registry.yarnpkg.com/@polkadot-api/substrate-client/-/substrate-client-0.1.4.tgz#7a808e5cb85ecb9fa2b3a43945090a6c807430ce" - integrity sha512-MljrPobN0ZWTpn++da9vOvt+Ex+NlqTlr/XT7zi9sqPtDJiQcYl+d29hFAgpaeTqbeQKZwz3WDE9xcEfLE8c5A== - dependencies: - "@polkadot-api/json-rpc-provider" "0.0.1" - "@polkadot-api/utils" "0.1.0" - -"@polkadot-api/utils@0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@polkadot-api/utils/-/utils-0.1.0.tgz#d36937cdc465c2ea302f3278cf53157340ab33a0" - integrity sha512-MXzWZeuGxKizPx2Xf/47wx9sr/uxKw39bVJUptTJdsaQn/TGq+z310mHzf1RCGvC1diHM8f593KrnDgc9oNbJA== - -"@polkadot/api-augment@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-12.4.2.tgz#6c52a6d04f398e786a834839948b0bc0069b391c" - integrity sha512-BkG2tQpUUO0iUm65nSqP8hwHkNfN8jQw8apqflJNt9H8EkEL6v7sqwbLvGqtlxM9wzdxbg7lrWp3oHg4rOP31g== - dependencies: - "@polkadot/api-base" "12.4.2" - "@polkadot/rpc-augment" "12.4.2" - "@polkadot/types" "12.4.2" - "@polkadot/types-augment" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/util" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/api-base@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-12.4.2.tgz#c8312bae8dfc70c0fdec0c1366e405906e66575f" - integrity sha512-XYI7Po8i6C4lYZah7Xo0v7zOAawBUfkmtx0YxsLY/665Sup8oqzEj666xtV9qjBzR9coNhQonIFOn+9fh27Ncw== - dependencies: - "@polkadot/rpc-core" "12.4.2" - "@polkadot/types" "12.4.2" - "@polkadot/util" "^13.0.2" - rxjs "^7.8.1" - tslib "^2.6.3" - -"@polkadot/api-derive@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-12.4.2.tgz#2a1fbd79ff4842edc20378957374000ca6f7bd70" - integrity sha512-R0AMANEnqs5AiTaiQX2FXCxUlOibeDSgqlkyG1/0KDsdr6PO/l3dJOgEO+grgAwh4hdqzk4I9uQpdKxG83f2Gw== - dependencies: - "@polkadot/api" "12.4.2" - "@polkadot/api-augment" "12.4.2" - "@polkadot/api-base" "12.4.2" - "@polkadot/rpc-core" "12.4.2" - "@polkadot/types" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/util" "^13.0.2" - "@polkadot/util-crypto" "^13.0.2" - rxjs "^7.8.1" - tslib "^2.6.3" - -"@polkadot/api@12.4.2", "@polkadot/api@^12.3.1": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-12.4.2.tgz#c13dc1ad7fab670c5fd6d8d970a8462b999d7c1d" - integrity sha512-e1KS048471iBWZU10TJNEYOZqLO+8h8ajmVqpaIBOVkamN7tmacBxmHgq0+IA8VrGxjxtYNa1xF5Sqrg76uBEg== - dependencies: - "@polkadot/api-augment" "12.4.2" - "@polkadot/api-base" "12.4.2" - "@polkadot/api-derive" "12.4.2" - "@polkadot/keyring" "^13.0.2" - "@polkadot/rpc-augment" "12.4.2" - "@polkadot/rpc-core" "12.4.2" - "@polkadot/rpc-provider" "12.4.2" - "@polkadot/types" "12.4.2" - "@polkadot/types-augment" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/types-create" "12.4.2" - "@polkadot/types-known" "12.4.2" - "@polkadot/util" "^13.0.2" - "@polkadot/util-crypto" "^13.0.2" - eventemitter3 "^5.0.1" - rxjs "^7.8.1" - tslib "^2.6.3" - -"@polkadot/keyring@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-13.0.2.tgz#05a655eb06c965ae5ee5f181d25916797ea50849" - integrity sha512-NeLbhyKDT5W8LI9seWTZGePxNTOVpDhv2018HSrEDwJq9Ie0C4TZhUf3KNERCkSveuThXjfQJMs+1CF33ZXPWw== - dependencies: - "@polkadot/util" "13.0.2" - "@polkadot/util-crypto" "13.0.2" - tslib "^2.6.2" - -"@polkadot/networks@13.0.2", "@polkadot/networks@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-13.0.2.tgz#0f8fc896b8fb2141212b6448739f4a00bc72b29c" - integrity sha512-ABAL+vug/gIwkdFEzeh87JoJd0YKrxSYg/HjUrZ+Zis2ucxQEKpvtCpJ34ku+YrjacBfVqIAkkwd3ZdIPGq9aQ== - dependencies: - "@polkadot/util" "13.0.2" - "@substrate/ss58-registry" "^1.46.0" - tslib "^2.6.2" - -"@polkadot/rpc-augment@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-12.4.2.tgz#fbe310260f3e5159fc2fa924c1a7c52f69162f9c" - integrity sha512-IEco5pnso+fYkZNMlMAN5i4XAxdXPv0PZ0HNuWlCwF/MmRvWl8pq5JFtY1FiByHEbeuHwMIUhHM5SDKQ85q9Hg== - dependencies: - "@polkadot/rpc-core" "12.4.2" - "@polkadot/types" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/util" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/rpc-core@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-12.4.2.tgz#d20cfdadd932978d58037a213115844a0c49464b" - integrity sha512-yaveqxNcmyluyNgsBT5tpnCa/md0CGbOtRK7K82LWsz7gsbh0x80GBbJrQGxsUybg1gPeZbO1q9IigwA6fY8ag== - dependencies: - "@polkadot/rpc-augment" "12.4.2" - "@polkadot/rpc-provider" "12.4.2" - "@polkadot/types" "12.4.2" - "@polkadot/util" "^13.0.2" - rxjs "^7.8.1" - tslib "^2.6.3" - -"@polkadot/rpc-provider@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-12.4.2.tgz#c6a4f9b9194a5227e4355cef026aac2b07430162" - integrity sha512-cAhfN937INyxwW1AdjABySdCKhC7QCIONRDHDea1aLpiuxq/w+QwjxauR9fCNGh3lTaAwwnmZ5WfFU2PtkDMGQ== - dependencies: - "@polkadot/keyring" "^13.0.2" - "@polkadot/types" "12.4.2" - "@polkadot/types-support" "12.4.2" - "@polkadot/util" "^13.0.2" - "@polkadot/util-crypto" "^13.0.2" - "@polkadot/x-fetch" "^13.0.2" - "@polkadot/x-global" "^13.0.2" - "@polkadot/x-ws" "^13.0.2" - eventemitter3 "^5.0.1" - mock-socket "^9.3.1" - nock "^13.5.4" - tslib "^2.6.3" - optionalDependencies: - "@substrate/connect" "0.8.11" - -"@polkadot/types-augment@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-12.4.2.tgz#8b8e278f4cbecbdd586470d31c27576e06e87074" - integrity sha512-3fDCOy2BEMuAtMYl4crKg76bv/0pDNEuzpAzV4EBUMIlJwypmjy5sg3gUPCMcA+ckX3xb8DhkWU4ceUdS7T2KQ== - dependencies: - "@polkadot/types" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/util" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/types-codec@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-12.4.2.tgz#aa601ddbbe4bb28ef751e4565bd87037dee9a49b" - integrity sha512-DiPGRFWtVMepD9i05eC3orSbGtpN7un/pXOrXu0oriU+oxLkpvZH68ZsPNtJhKdQy03cAYtvB8elJOFJZYqoqQ== - dependencies: - "@polkadot/util" "^13.0.2" - "@polkadot/x-bigint" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/types-create@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-12.4.2.tgz#1113746ab92694c3402abc59feb3e3fcaf980997" - integrity sha512-nOpeAKZLdSqNMfzS3waQXgyPPaNt8rUHEmR5+WNv6c/Ke/vyf710wjxiTewfp0wpBgtdrimlgG4DLX1J9Ms1LA== - dependencies: - "@polkadot/types-codec" "12.4.2" - "@polkadot/util" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/types-known@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-12.4.2.tgz#c47ffac0a0bcc544e120f09e92f39e6f61ed94c8" - integrity sha512-bvhO4KQu/dgPmdwQXsweSMRiRisJ7Bp38lZVEIFykfd2qYyRW3OQEbIPKYpx9raD+fDATU0bTiKQnELrSGhYXw== - dependencies: - "@polkadot/networks" "^13.0.2" - "@polkadot/types" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/types-create" "12.4.2" - "@polkadot/util" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/types-support@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-12.4.2.tgz#22df5c22a002aca271507355123aeb68e1399c03" - integrity sha512-bz6JSt23UEZ2eXgN4ust6z5QF9pO5uNH7UzCP+8I/Nm85ZipeBYj2Wu6pLlE3Hw30hWZpuPxMDOKoEhN5bhLgw== - dependencies: - "@polkadot/util" "^13.0.2" - tslib "^2.6.3" - -"@polkadot/types@12.4.2": - version "12.4.2" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-12.4.2.tgz#948e0191b30c37f0d89b8e120174d6be31ed9f9d" - integrity sha512-ivYtt7hYcRvo69ULb1BJA9BE1uefijXcaR089Dzosr9+sMzvsB1yslNQReOq+Wzq6h6AQj4qex6qVqjWZE6Z4A== - dependencies: - "@polkadot/keyring" "^13.0.2" - "@polkadot/types-augment" "12.4.2" - "@polkadot/types-codec" "12.4.2" - "@polkadot/types-create" "12.4.2" - "@polkadot/util" "^13.0.2" - "@polkadot/util-crypto" "^13.0.2" - rxjs "^7.8.1" - tslib "^2.6.3" - -"@polkadot/util-crypto@13.0.2", "@polkadot/util-crypto@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-13.0.2.tgz#fee602bcb39e9424300410f4144f170ee2a29292" - integrity sha512-woUsJJ6zd/caL7U+D30a5oM/+WK9iNI00Y8aNUHSj6Zq/KPzK9uqDBaLGWwlgrejoMQkxxiU2X0f2LzP15AtQg== - dependencies: - "@noble/curves" "^1.3.0" - "@noble/hashes" "^1.3.3" - "@polkadot/networks" "13.0.2" - "@polkadot/util" "13.0.2" - "@polkadot/wasm-crypto" "^7.3.2" - "@polkadot/wasm-util" "^7.3.2" - "@polkadot/x-bigint" "13.0.2" - "@polkadot/x-randomvalues" "13.0.2" - "@scure/base" "^1.1.5" - tslib "^2.6.2" - -"@polkadot/util@13.0.2", "@polkadot/util@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-13.0.2.tgz#f0a2572d74730fda8dfd690b60d53c131a688f3b" - integrity sha512-/6bS9sfhJLhs8QuqWaR1eRapzfDdGC5XAQZEPL9NN5sTTA7HxWos8rVleai0UERm8QUMabjZ9rK9KpzbXl7ojg== - dependencies: - "@polkadot/x-bigint" "13.0.2" - "@polkadot/x-global" "13.0.2" - "@polkadot/x-textdecoder" "13.0.2" - "@polkadot/x-textencoder" "13.0.2" - "@types/bn.js" "^5.1.5" - bn.js "^5.2.1" - tslib "^2.6.2" - -"@polkadot/wasm-bridge@7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.3.2.tgz#e1b01906b19e06cbca3d94f10f5666f2ae0baadc" - integrity sha512-AJEXChcf/nKXd5Q/YLEV5dXQMle3UNT7jcXYmIffZAo/KI394a+/24PaISyQjoNC0fkzS1Q8T5pnGGHmXiVz2g== - dependencies: - "@polkadot/wasm-util" "7.3.2" - tslib "^2.6.2" - -"@polkadot/wasm-crypto-asmjs@7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.3.2.tgz#c6d41bc4b48b5359d57a24ca3066d239f2d70a34" - integrity sha512-QP5eiUqUFur/2UoF2KKKYJcesc71fXhQFLT3D4ZjG28Mfk2ZPI0QNRUfpcxVQmIUpV5USHg4geCBNuCYsMm20Q== - dependencies: - tslib "^2.6.2" - -"@polkadot/wasm-crypto-init@7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.3.2.tgz#7e1fe79ba978fb0a4a0f74a92d976299d38bc4b8" - integrity sha512-FPq73zGmvZtnuJaFV44brze3Lkrki3b4PebxCy9Fplw8nTmisKo9Xxtfew08r0njyYh+uiJRAxPCXadkC9sc8g== - dependencies: - "@polkadot/wasm-bridge" "7.3.2" - "@polkadot/wasm-crypto-asmjs" "7.3.2" - "@polkadot/wasm-crypto-wasm" "7.3.2" - "@polkadot/wasm-util" "7.3.2" - tslib "^2.6.2" - -"@polkadot/wasm-crypto-wasm@7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.3.2.tgz#44e08ed5cf6499ce4a3aa7247071a5d01f6a74f4" - integrity sha512-15wd0EMv9IXs5Abp1ZKpKKAVyZPhATIAHfKsyoWCEFDLSOA0/K0QGOxzrAlsrdUkiKZOq7uzSIgIDgW8okx2Mw== - dependencies: - "@polkadot/wasm-util" "7.3.2" - tslib "^2.6.2" - -"@polkadot/wasm-crypto@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.3.2.tgz#61bbcd9e591500705c8c591e6aff7654bdc8afc9" - integrity sha512-+neIDLSJ6jjVXsjyZ5oLSv16oIpwp+PxFqTUaZdZDoA2EyFRQB8pP7+qLsMNk+WJuhuJ4qXil/7XiOnZYZ+wxw== - dependencies: - "@polkadot/wasm-bridge" "7.3.2" - "@polkadot/wasm-crypto-asmjs" "7.3.2" - "@polkadot/wasm-crypto-init" "7.3.2" - "@polkadot/wasm-crypto-wasm" "7.3.2" - "@polkadot/wasm-util" "7.3.2" - tslib "^2.6.2" - -"@polkadot/wasm-util@7.3.2", "@polkadot/wasm-util@^7.3.2": - version "7.3.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.3.2.tgz#4fe6370d2b029679b41a5c02cd7ebf42f9b28de1" - integrity sha512-bmD+Dxo1lTZyZNxbyPE380wd82QsX+43mgCm40boyKrRppXEyQmWT98v/Poc7chLuskYb6X8IQ6lvvK2bGR4Tg== - dependencies: - tslib "^2.6.2" - -"@polkadot/x-bigint@13.0.2", "@polkadot/x-bigint@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-13.0.2.tgz#25adca9ce0c5ed691f9bced283f44f7e7d824300" - integrity sha512-h2jKT/UaxiEal8LhQeH6+GCjO7GwEqVAD2SNYteCOXff6yNttqAZYJuHZsndbVjVNwqRNf8D5q/zZkD0HUd6xQ== - dependencies: - "@polkadot/x-global" "13.0.2" - tslib "^2.6.2" - -"@polkadot/x-fetch@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-13.0.2.tgz#841d901fae36cbc4157297324ca0d73fbe4d200e" - integrity sha512-B/gf9iriUr6za/Ui7zIFBfHz7UBZ68rJEIteWHx1UHRCZPcLqv+hgpev6xIGrkfFljI0/lI7IwtN2qy6HYzFBg== - dependencies: - "@polkadot/x-global" "13.0.2" - node-fetch "^3.3.2" - tslib "^2.6.2" - -"@polkadot/x-global@13.0.2", "@polkadot/x-global@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-13.0.2.tgz#77afc4fbd4cfac8ba78cf120836f30ecc7322a74" - integrity sha512-OoNIXLB5y8vIKpk4R+XmpDPhipNXWSUvEwUnpQT7NAxNLmzgMq1FhbrwBWWPRNHPrQonp7mqxV/X+v5lv1HW/g== - dependencies: - tslib "^2.6.2" - -"@polkadot/x-randomvalues@13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-13.0.2.tgz#78ae28b345895cc816ffcad0b336c31cadfcf928" - integrity sha512-SGj+L0H/7TWZtSmtkWlixO4DFzXDdluI0UscN2h285os2Ns8PnmBbue+iJ8PVSzpY1BOxd66gvkkpboPz+jXFQ== - dependencies: - "@polkadot/x-global" "13.0.2" - tslib "^2.6.2" - -"@polkadot/x-textdecoder@13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-13.0.2.tgz#662a6855af8e7a5af17f86890e59ab44f829243a" - integrity sha512-mauglOkTJxLGmLwLc3J5Jlq/W+SHP53eiy3F8/8JxxfnXrZKgWoQXGpvXYPjFnMZj0MzDSy/6GjyGWnDCgdQFA== - dependencies: - "@polkadot/x-global" "13.0.2" - tslib "^2.6.2" - -"@polkadot/x-textencoder@13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-13.0.2.tgz#5e178e0f759df50592e6870346c8db2a445af957" - integrity sha512-Lq08H2OnVXj97uaOwg7tcmRS7a4VJYkHEeWO4FyEMOk6P6lU6W8OVNjjxG0se9PCEgmyZPUDbJI//1ynzP4cXw== - dependencies: - "@polkadot/x-global" "13.0.2" - tslib "^2.6.2" - -"@polkadot/x-ws@^13.0.2": - version "13.0.2" - resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-13.0.2.tgz#d0392a87adcba851a44fc6f7f56792e529228f3e" - integrity sha512-nC5e2eY5D5ZR5teQOB7ib+dWLbmNws86cTz3BjKCalSMBBIn6i3V9ElgABpierBmnSJe9D94EyrH1BxdVfDxUg== - dependencies: - "@polkadot/x-global" "13.0.2" - tslib "^2.6.2" - ws "^8.16.0" - -"@scure/base@^1.1.1", "@scure/base@^1.1.5": - version "1.1.8" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.8.tgz#8f23646c352f020c83bca750a82789e246d42b50" - integrity sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg== - -"@substrate/connect-extension-protocol@^2.0.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-2.1.0.tgz#7df153f704702b98559e7e5e8a2ce17881fe1d1d" - integrity sha512-Wz5Cbn6S6P4vWfHyrsnPW7g15IAViMaXCk+jYkq4nNEMmzPtTKIEbtxrdDMBKrouOFtYKKp0znx5mh9KTCNqlA== - -"@substrate/connect-known-chains@^1.1.5": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@substrate/connect-known-chains/-/connect-known-chains-1.4.0.tgz#ee0562056cf98a3ee1103a64fa33ff21d86c69fd" - integrity sha512-p/mxn1GobtxJ+7xbIkUH4+/njH1neRHHKTcSGHNOC78Cf6Ch1Xzp082+nMjOBDLQLmraK5PF74AKV3WXHGuALw== - -"@substrate/connect@0.8.11": - version "0.8.11" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.8.11.tgz#983ec69a05231636e217b573b8130a6b942af69f" - integrity sha512-ofLs1PAO9AtDdPbdyTYj217Pe+lBfTLltdHDs3ds8no0BseoLeAGxpz1mHfi7zB4IxI3YyAiLjH6U8cw4pj4Nw== - dependencies: - "@substrate/connect-extension-protocol" "^2.0.0" - "@substrate/connect-known-chains" "^1.1.5" - "@substrate/light-client-extension-helpers" "^1.0.0" - smoldot "2.0.26" - -"@substrate/light-client-extension-helpers@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@substrate/light-client-extension-helpers/-/light-client-extension-helpers-1.0.0.tgz#7b60368c57e06e5cf798c6557422d12e6d81f1ff" - integrity sha512-TdKlni1mBBZptOaeVrKnusMg/UBpWUORNDv5fdCaJklP4RJiFOzBCrzC+CyVI5kQzsXBisZ+2pXm+rIjS38kHg== - dependencies: - "@polkadot-api/json-rpc-provider" "^0.0.1" - "@polkadot-api/json-rpc-provider-proxy" "^0.1.0" - "@polkadot-api/observable-client" "^0.3.0" - "@polkadot-api/substrate-client" "^0.1.2" - "@substrate/connect-extension-protocol" "^2.0.0" - "@substrate/connect-known-chains" "^1.1.5" - rxjs "^7.8.1" - -"@substrate/ss58-registry@^1.46.0": - version "1.50.0" - resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.50.0.tgz#2d2a3d060cd4eadd200e4538078461ba73e13d6d" - integrity sha512-mkmlMlcC+MSd9rA+PN8ljGAm5fVZskvVwkXIsbx4NFwaT8kt38r7e9cyDWscG3z2Zn40POviZvEMrJSk+r2SgQ== - -"@types/bn.js@^5.1.5": - version "5.1.5" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.5.tgz#2e0dacdcce2c0f16b905d20ff87aedbc6f7b4bf0" - integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== - dependencies: - "@types/node" "*" - -"@types/node@*": - version "22.5.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.4.tgz#83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8" - integrity sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg== - dependencies: - undici-types "~6.19.2" - -bn.js@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - -data-uri-to-buffer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" - integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== - -debug@^4.1.0: - version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" - integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== - dependencies: - ms "^2.1.3" - -eventemitter3@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" - integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== - -fetch-blob@^3.1.2, fetch-blob@^3.1.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" - integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== - dependencies: - node-domexception "^1.0.0" - web-streams-polyfill "^3.0.3" - -formdata-polyfill@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" - integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== - dependencies: - fetch-blob "^3.1.2" - -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 sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -mock-socket@^9.3.1: - version "9.3.1" - resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.3.1.tgz#24fb00c2f573c84812aa4a24181bb025de80cc8e" - integrity sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw== - -ms@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -nock@^13.5.4: - version "13.5.5" - resolved "https://registry.yarnpkg.com/nock/-/nock-13.5.5.tgz#cd1caaca281d42be17d51946367a3d53a6af3e78" - integrity sha512-XKYnqUrCwXC8DGG1xX4YH5yNIrlh9c065uaMZZHUoeUUINTOyt+x/G+ezYk0Ft6ExSREVIs+qBJDK503viTfFA== - dependencies: - debug "^4.1.0" - json-stringify-safe "^5.0.1" - propagate "^2.0.0" - -node-domexception@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== - -node-fetch@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" - integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== - dependencies: - data-uri-to-buffer "^4.0.0" - fetch-blob "^3.1.4" - formdata-polyfill "^4.0.10" - -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== - -rxjs@^7.8.1: - version "7.8.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" - integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== - dependencies: - tslib "^2.1.0" - -scale-ts@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/scale-ts/-/scale-ts-1.6.0.tgz#e9641093c5a9e50f964ddb1607139034e3e932e9" - integrity sha512-Ja5VCjNZR8TGKhUumy9clVVxcDpM+YFjAnkMuwQy68Hixio3VRRvWdE3g8T/yC+HXA0ZDQl2TGyUmtmbcVl40Q== - -smoldot@2.0.26: - version "2.0.26" - resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-2.0.26.tgz#0e64c7fcd26240fbe4c8d6b6e4b9a9aca77e00f6" - integrity sha512-F+qYmH4z2s2FK+CxGj8moYcd1ekSIKH8ywkdqlOz88Dat35iB1DIYL11aILN46YSGMzQW/lbJNS307zBSDN5Ig== - dependencies: - ws "^8.8.1" - -tslib@^2.1.0, tslib@^2.6.2, tslib@^2.6.3: - version "2.7.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" - integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== - -undici-types@~6.19.2: - version "6.19.8" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" - integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== - -web-streams-polyfill@^3.0.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" - integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== - -ws@^8.16.0, ws@^8.8.1: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== From fc576547e8382076567d1ca7252be80513fbf413 Mon Sep 17 00:00:00 2001 From: Peter White Date: Fri, 13 Sep 2024 15:39:50 -0600 Subject: [PATCH 7/8] refactor: small cleanups to conditional RuntimeApiExt --- node/src/service.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node/src/service.rs b/node/src/service.rs index 8ff9db85..02638f29 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -500,7 +500,7 @@ where } #[cfg(not(feature = "ismp"))] -mod runtime_api_ext { +mod traits { use pop_runtime_common::{AccountId, AuraId, Balance, Block, Nonce}; use sp_core::Pair; use sp_runtime::app_crypto::AppCrypto; @@ -539,7 +539,7 @@ mod runtime_api_ext { } #[cfg(feature = "ismp")] -mod runtime_api_ext { +mod traits { use pop_runtime_common::{AccountId, AuraId, Balance, Block, Nonce}; use sp_core::{Pair, H256}; use sp_runtime::app_crypto::AppCrypto; @@ -576,9 +576,9 @@ mod runtime_api_ext { + ismp_parachain_runtime_api::IsmpParachainApi + pallet_ismp_runtime_api::IsmpRuntimeApi, RuntimeApi, - > crate::service::runtime_api_ext::RuntimeApiExt for T + > RuntimeApiExt for T { } } -use runtime_api_ext::RuntimeApiExt; +use traits::RuntimeApiExt; From b9619b2f2ece1f83456352f638ad674f1b557d26 Mon Sep 17 00:00:00 2001 From: Peter White Date: Thu, 19 Sep 2024 09:03:47 -0600 Subject: [PATCH 8/8] feat(ci): add ismp feature to ci, and choosing runtime for release (#276) Co-authored-by: Frank Bell <60948618+evilrobot-01@users.noreply.github.com> --- .github/workflows/ci.yml | 29 ++++++++++++ .github/workflows/release.yml | 87 +++++++++++++++++++++++------------ 2 files changed, 87 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee041702..e63420e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,16 @@ jobs: run: | cargo check --release --locked --features=runtime-benchmarks,try-runtime + check-ismp: + needs: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: "./.github/actions/init" + - name: Check Build with ISMP + run: | + cargo check --release --locked --features=ismp,runtime-benchmarks,try-runtime + clippy: needs: lint runs-on: ubuntu-latest @@ -63,6 +73,25 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} args: --release --locked --features=runtime-benchmarks + clippy-ismp: + needs: lint + runs-on: ubuntu-latest + permissions: + checks: write + env: + RUSTFLAGS: "-Wmissing_docs" + SKIP_WASM_BUILD: 1 + steps: + - uses: actions/checkout@v4 + + - uses: "./.github/actions/init" + + - name: Annotate with Clippy warnings + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --release --locked --features=runtime-benchmarks,ismp + test: needs: lint runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bbbac837..248ac51b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,45 +16,74 @@ on: description: Build node default: true runtime: - type: boolean - description: Build runtimes deterministically - default: true + description: 'Runtime to build (devnet, testnet, mainnet)' + default: '' + type: choice + options: + - '' + - devnet + - testnet + - mainnet jobs: srtool: runs-on: ubuntu-latest - if: github.event_name != 'workflow_dispatch' && 'true' || inputs.runtime + if: | + startsWith(github.event.release.tag_name, 'testnet') || + startsWith(github.event.release.tag_name, 'devnet') || + startsWith(github.event.release.tag_name, 'mainnet') || + github.event_name == 'workflow_dispatch' && + github.event.inputs.runtime != '' permissions: contents: write - strategy: - matrix: - runtime: [ "devnet", "testnet", "mainnet" ] steps: - name: Checkout sources uses: actions/checkout@v4 + - name: Determine Runtime and Set Node Build Opts + id: determine_runtime + run: | + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "RUNTIME=${{ github.event.inputs.runtime }}" >> $GITHUB_ENV + elif [[ "${{ github.event.release.tag_name }}" == devnet* ]]; then + echo "RUNTIME=devnet" >> $GITHUB_ENV + elif [[ "${{ github.event.release.tag_name }}" == testnet* ]]; then + echo "RUNTIME=testnet" >> $GITHUB_ENV + elif [[ "${{ github.event.release.tag_name }}" == mainnet* ]]; then + echo "RUNTIME=mainnet" >> $GITHUB_ENV + else + echo "RUNTIME=devnet" >> $GITHUB_ENV # Default to devnet if no tag matches + fi + + # if devnet, build the node with ismp feature + if [ "$RUNTIME" == "devnet" ]; then + echo "NODE_BUILD_OPTS=--features on-chain-release-build,ismp" >> $GITHUB_ENV + else + echo "NODE_BUILD_OPTS=--features on-chain-release-build" >> $GITHUB_ENV + fi - name: Cache runtime target dir uses: actions/cache@v4 with: - path: "${{ github.workspace }}/runtime/${{ matrix.runtime }}/target" - key: srtool-target-${{ matrix.runtime }}-${{ github.sha }} + path: "${{ github.workspace }}/runtime/${{ env.RUNTIME }}/target" + key: srtool-target-${{ env.RUNTIME }}-${{ github.sha }} restore-keys: | - srtool-target-${{ matrix.runtime }}- + srtool-target-${{ env.RUNTIME }}- srtool-target- - - name: Build ${{ matrix.runtime }} runtime + - name: Build ${{ env.RUNTIME }} runtime id: srtool_build uses: chevdor/srtool-actions@v0.9.2 env: - BUILD_OPTS: "--features on-chain-release-build" + # runtimes do not have ismp feature + BUILD_OPTS: '--features on-chain-release-build' with: - chain: ${{ matrix.runtime }} - package: "pop-runtime-${{ matrix.runtime }}" - runtime_dir: "runtime/${{ matrix.runtime }}" + chain: ${{ env.RUNTIME }} + package: "pop-runtime-${{ env.RUNTIME }}" + runtime_dir: "runtime/${{ env.RUNTIME }}" - name: Store srtool digest to disk run: | - echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.runtime }}-srtool-digest.json + echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ env.RUNTIME }}-srtool-digest.json # Manual trigger: add artifacts to run - name: Copy artifacts @@ -65,10 +94,10 @@ jobs: if: github.event_name != 'release' uses: actions/upload-artifact@v4 with: - name: ${{ matrix.runtime }}-runtime-${{ github.sha }} + name: ${{ env.RUNTIME }}-runtime-${{ github.sha }} path: | - pop_runtime_${{ matrix.runtime }}*.wasm - ${{ matrix.runtime }}-srtool-digest.json + pop_runtime_${{ env.RUNTIME }}*.wasm + ${{ env.RUNTIME }}-srtool-digest.json # We now get extra information thanks to subwasm, - name: Install subwasm ${{ env.SUBWASM_VERSION }} @@ -81,23 +110,23 @@ jobs: run: | subwasm info ${{ steps.srtool_build.outputs.wasm }} subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} - subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-info.json - subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-info_compressed.json + subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ env.RUNTIME }}-info.json + subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ env.RUNTIME }}-info_compressed.json - name: Extract the metadata run: | subwasm meta ${{ steps.srtool_build.outputs.wasm }} - subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-metadata.json + subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ env.RUNTIME }}-metadata.json - name: Archive Subwasm results if: github.event_name != 'release' uses: actions/upload-artifact@v4 with: - name: ${{ matrix.runtime }}-info + name: ${{ env.RUNTIME }}-info path: | - ${{ matrix.runtime }}-info.json - ${{ matrix.runtime }}-info_compressed.json - ${{ matrix.runtime }}-metadata.json + ${{ env.RUNTIME }}-info.json + ${{ env.RUNTIME }}-info_compressed.json + ${{ env.RUNTIME }}-metadata.json # Release published: add artifacts to release - name: Add artifacts to release @@ -106,7 +135,7 @@ jobs: with: append_body: true body: | - ## Runtime: `${{ matrix.runtime }}` + ## Runtime: `${{ env.RUNTIME }}` ``` 🏋️ Runtime Size: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.size }} bytes 🔥 Core Version: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.core_version.specName }}-${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.core_version.specVersion }} @@ -118,7 +147,7 @@ jobs: ``` files: | ${{ steps.srtool_build.outputs.wasm_compressed }} - ${{ matrix.runtime }}-srtool-digest.json + ${{ env.RUNTIME }}-srtool-digest.json build-node: runs-on: ${{ matrix.platform.os }} @@ -168,7 +197,7 @@ jobs: run: rustup target add ${{ matrix.platform.target }} - name: Build node - run: cargo build --profile=production -p pop-node --features on-chain-release-build --target ${{ matrix.platform.target }} + run: cargo build --profile=production -p pop-node $NODE_BUILD_OPTS --target ${{ matrix.platform.target }} - name: Package binary (Linux) if: contains(matrix.platform.target, 'linux')