From 32ebfd51e2012fedc6e6ad76afe14bcc8b27bce0 Mon Sep 17 00:00:00 2001 From: David Salami <31099392+Wizdave97@users.noreply.github.com> Date: Thu, 25 Apr 2024 17:05:01 +0100 Subject: [PATCH] Fork aware offchain Database (#184) Co-authored-by: Seun Lanlege --- .github/workflows/ci.yml | 8 + Cargo.lock | 313 +- Cargo.toml | 39 +- evm/abi/Cargo.toml | 4 +- evm/abi/src/conversions.rs | 2 +- evm/abi/src/generated/host_manager.rs | 4 +- evm/integration-tests/Cargo.toml | 5 +- evm/integration-tests/src/lib.rs | 11 +- .../src/tests/post_request.rs | 3 +- .../src/tests/post_response.rs | 9 +- evm/integration-tests/src/tests/utils.rs | 12 +- evm/src/consensus/BeefyV1.sol | 15 +- evm/src/consensus/Codec.sol | 15 +- evm/src/consensus/Header.sol | 15 +- evm/src/consensus/ZkBeefy.sol | 15 +- evm/src/consensus/verifiers/IVerifier.sol | 15 +- evm/src/hosts/Arbitrum.sol | 15 +- evm/src/hosts/Base.sol | 15 +- evm/src/hosts/Bsc.sol | 15 +- evm/src/hosts/Ethereum.sol | 15 +- evm/src/hosts/EvmHost.sol | 148 +- evm/src/hosts/Optimism.sol | 15 +- evm/src/hosts/Polygon.sol | 15 +- evm/src/interfaces/ICallDispatcher.sol | 17 +- evm/src/modules/CallDispatcher.sol | 17 +- evm/src/modules/HandlerV1.sol | 15 +- evm/src/modules/HostManager.sol | 15 +- evm/src/modules/TokenFaucet.sol | 15 +- evm/src/modules/TokenGateway.sol | 15 +- evm/test/BaseTest.sol | 16 +- evm/test/Beefy.sol | 15 +- evm/test/EvmHostTest.sol | 19 +- evm/test/FeeToken.sol | 15 +- evm/test/GetRequest.sol | 15 +- evm/test/HostManagerTest.sol | 15 +- evm/test/MainnetForkBaseTest.sol | 15 +- evm/test/MockUSDC.sol | 16 +- evm/test/PlonkTest.sol | 15 +- evm/test/PostRequest.sol | 15 +- evm/test/PostResponse.sol | 15 +- evm/test/TeleportSwapTest.sol | 15 +- evm/test/TestConsensusClient.sol | 15 +- evm/test/TestHost.sol | 15 +- evm/test/TokenGatewayTest.sol | 22 +- modules/client/Cargo.toml | 7 +- modules/client/src/lib.rs | 7 +- modules/client/src/providers/substrate.rs | 159 +- modules/client/src/types.rs | 41 +- modules/consensus/beefy/prover/Cargo.toml | 3 +- modules/consensus/bsc/prover/src/lib.rs | 25 +- modules/consensus/bsc/prover/src/test.rs | 2 +- .../consensus/bsc/verifier/src/primitives.rs | 2 +- modules/consensus/grandpa/prover/Cargo.toml | 2 +- modules/consensus/grandpa/verifier/Cargo.toml | 2 +- .../state-machine/substrate/src/lib.rs | 2 +- modules/ismp/core/src/handlers/request.rs | 7 +- modules/ismp/core/src/handlers/response.rs | 21 +- modules/ismp/core/src/handlers/timeout.rs | 47 +- modules/ismp/core/src/host.rs | 20 +- modules/ismp/core/src/lib.rs | 1 + modules/ismp/core/src/router.rs | 52 + modules/ismp/core/src/util.rs | 41 +- modules/ismp/pallet/Cargo.toml | 8 +- modules/ismp/pallet/relayer/src/lib.rs | 75 +- modules/ismp/pallet/rpc/Cargo.toml | 1 + modules/ismp/pallet/rpc/src/lib.rs | 3 +- modules/ismp/pallet/runtime-api/Cargo.toml | 9 +- modules/ismp/pallet/runtime-api/src/lib.rs | 13 +- modules/ismp/pallet/src/child_trie.rs | 2 +- modules/ismp/pallet/src/dispatcher.rs | 10 +- modules/ismp/pallet/src/handlers.rs | 76 - modules/ismp/pallet/src/host.rs | 51 +- modules/ismp/pallet/src/impls.rs | 218 + modules/ismp/pallet/src/lib.rs | 299 +- modules/ismp/pallet/src/mmr.rs | 127 +- modules/ismp/pallet/src/mmr/primitives.rs | 106 - modules/ismp/pallet/src/mmr/storage.rs | 188 - modules/ismp/pallet/src/mmr/utils.rs | 43 - modules/ismp/pallet/src/primitives.rs | 18 +- modules/ismp/pallet/testsuite/Cargo.toml | 4 +- modules/ismp/pallet/testsuite/src/runtime.rs | 11 +- .../testsuite/src/tests/pallet_fishermen.rs | 4 +- .../pallet/testsuite/src/tests/pallet_ismp.rs | 183 +- .../src/tests/pallet_ismp_relayer.rs | 86 +- modules/ismp/testsuite/src/mocks.rs | 39 +- modules/subxt/subxt-utils/Cargo.toml | 18 + .../subxt-utils/src/gargantua.rs} | 9461 +++++++++++------ modules/subxt/subxt-utils/src/lib.rs | 172 + modules/trees/mmr/Cargo.toml | 9 - modules/trees/mmr/gadget/Cargo.toml | 24 + modules/trees/mmr/gadget/src/aux_schema.rs | 99 + modules/trees/mmr/gadget/src/lib.rs | 202 + modules/trees/mmr/gadget/src/offchain_mmr.rs | 306 + modules/trees/mmr/pallet/Cargo.toml | 62 + .../trees/mmr/pallet/runtime-api/Cargo.toml | 19 + .../trees/mmr/pallet/runtime-api/src/lib.rs | 21 + modules/trees/mmr/pallet/src/lib.rs | 355 + modules/trees/mmr/pallet/src/mmr/mmr.rs | 199 + modules/trees/mmr/pallet/src/mmr/mod.rs | 44 + modules/trees/mmr/pallet/src/mmr/storage.rs | 217 + modules/trees/mmr/primitives/Cargo.toml | 29 + modules/trees/mmr/primitives/src/lib.rs | 210 + modules/trees/mmr/simnode-tests/Cargo.toml | 28 + modules/trees/mmr/simnode-tests/src/lib.rs | 357 + modules/trees/mmr/src/lib.rs | 44 - parachain/node/Cargo.toml | 21 + parachain/node/src/cli.rs | 4 + parachain/node/src/command.rs | 47 + parachain/node/src/main.rs | 3 + parachain/node/src/runtime_api.rs | 69 + parachain/node/src/service.rs | 13 +- parachain/node/src/simnode.rs | 151 + parachain/runtimes/gargantua/Cargo.toml | 15 +- parachain/runtimes/gargantua/src/ismp.rs | 11 +- parachain/runtimes/gargantua/src/lib.rs | 100 +- parachain/runtimes/messier/Cargo.toml | 15 +- parachain/runtimes/messier/src/ismp.rs | 11 +- parachain/runtimes/messier/src/lib.rs | 77 +- parachain/runtimes/nexus/Cargo.toml | 16 +- parachain/runtimes/nexus/src/ismp.rs | 11 +- parachain/runtimes/nexus/src/lib.rs | 79 +- 121 files changed, 10715 insertions(+), 4874 deletions(-) delete mode 100644 modules/ismp/pallet/src/handlers.rs create mode 100644 modules/ismp/pallet/src/impls.rs delete mode 100644 modules/ismp/pallet/src/mmr/primitives.rs delete mode 100644 modules/ismp/pallet/src/mmr/storage.rs delete mode 100644 modules/ismp/pallet/src/mmr/utils.rs create mode 100644 modules/subxt/subxt-utils/Cargo.toml rename modules/{client/src/runtime.rs => subxt/subxt-utils/src/gargantua.rs} (82%) create mode 100644 modules/subxt/subxt-utils/src/lib.rs delete mode 100644 modules/trees/mmr/Cargo.toml create mode 100644 modules/trees/mmr/gadget/Cargo.toml create mode 100644 modules/trees/mmr/gadget/src/aux_schema.rs create mode 100644 modules/trees/mmr/gadget/src/lib.rs create mode 100644 modules/trees/mmr/gadget/src/offchain_mmr.rs create mode 100644 modules/trees/mmr/pallet/Cargo.toml create mode 100644 modules/trees/mmr/pallet/runtime-api/Cargo.toml create mode 100644 modules/trees/mmr/pallet/runtime-api/src/lib.rs create mode 100644 modules/trees/mmr/pallet/src/lib.rs create mode 100644 modules/trees/mmr/pallet/src/mmr/mmr.rs create mode 100644 modules/trees/mmr/pallet/src/mmr/mod.rs create mode 100644 modules/trees/mmr/pallet/src/mmr/storage.rs create mode 100644 modules/trees/mmr/primitives/Cargo.toml create mode 100644 modules/trees/mmr/primitives/src/lib.rs create mode 100644 modules/trees/mmr/simnode-tests/Cargo.toml create mode 100644 modules/trees/mmr/simnode-tests/src/lib.rs delete mode 100644 modules/trees/mmr/src/lib.rs create mode 100644 parachain/node/src/simnode.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fefee789..689ae3c30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -312,6 +312,14 @@ jobs: run: | cargo test -p bsc-prover -- --nocapture --ignored + - name: Mmr gadget tests + run: | + cargo build -p hyperbridge --release --features simnode + ./target/release/hyperbridge simnode --chain gargantua-2000 --name=alice --tmp --state-pruning=archive --blocks-pruning=archive --rpc-port=9990 --port 40337 --log="mmr=trace" --unsafe-rpc-external --rpc-methods=unsafe & + sleep 20; + cargo test -p simnode-tests -- --nocapture --ignored + kill -9 $! + check-solidity: name: Check ismp-solidity runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index e712a8763..0bc198b6d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,9 +210,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -945,7 +945,6 @@ dependencies = [ "hex", "mmr-rpc", "pallet-beefy-mmr", - "pallet-mmr", "parity-scale-codec", "primitive-types", "rs_merkle", @@ -3408,6 +3407,16 @@ dependencies = [ "syn 2.0.57", ] +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" version = "0.10.2" @@ -3421,6 +3430,19 @@ dependencies = [ "termcolor", ] +[[package]] +name = "env_logger" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "environmental" version = "1.1.4" @@ -4001,7 +4023,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" dependencies = [ - "env_logger", + "env_logger 0.10.2", "log", ] @@ -4908,6 +4930,8 @@ dependencies = [ "pallet-ismp-relayer", "pallet-ismp-runtime-api", "pallet-message-queue", + "pallet-mmr 0.1.0", + "pallet-mmr-runtime-api", "pallet-session", "pallet-sudo", "pallet-timestamp", @@ -4919,6 +4943,7 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-runtime-common", "scale-info", + "simnode-runtime-api", "smallvec", "sp-api", "sp-block-builder", @@ -4926,6 +4951,7 @@ dependencies = [ "sp-core 28.0.0", "sp-genesis-builder", "sp-inherents", + "sp-mmr-primitives", "sp-offchain", "sp-runtime 31.0.1", "sp-session", @@ -5471,14 +5497,19 @@ dependencies = [ "cumulus-relay-chain-interface", "frame-benchmarking", "frame-benchmarking-cli", + "frame-system", "futures", "gargantua-runtime", "jsonrpsee 0.16.3", "log", "messier-runtime", + "mmr-gadget 29.0.0", "nexus-runtime", + "pallet-ismp", "pallet-ismp-rpc", "pallet-ismp-runtime-api", + "pallet-mmr-runtime-api", + "pallet-transaction-payment", "pallet-transaction-payment-rpc", "parity-scale-codec", "polkadot-cli", @@ -5496,6 +5527,7 @@ dependencies = [ "sc-offchain", "sc-rpc", "sc-service", + "sc-simnode", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -5503,6 +5535,7 @@ dependencies = [ "sc-transaction-pool-api", "serde", "serde_json", + "simnode-runtime-api", "sp-api", "sp-block-builder", "sp-blockchain", @@ -5510,6 +5543,7 @@ dependencies = [ "sp-core 28.0.0", "sp-io 30.0.0", "sp-keystore 0.34.0", + "sp-mmr-primitives", "sp-offchain", "sp-runtime 31.0.1", "sp-session", @@ -5548,6 +5582,7 @@ dependencies = [ "serde-wasm-bindgen", "serde_json", "subxt", + "subxt-utils", "tokio", "tracing", "tracing-wasm", @@ -5944,7 +5979,7 @@ dependencies = [ "ethers-contract-abigen", "forge-testsuite", "ismp", - "mmr-utils", + "mmr-primitives", "primitive-types", "sp-consensus-beefy", ] @@ -5968,10 +6003,11 @@ dependencies = [ "ismp", "ismp-solidity-abi", "libfuzzer-sys", - "mmr-utils", + "mmr-primitives", "once_cell", "pallet-ismp", "pallet-ismp-relayer", + "pallet-mmr 0.1.0", "parity-scale-codec", "primitive-types", "rs_merkle", @@ -7024,9 +7060,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru" @@ -7283,6 +7319,8 @@ dependencies = [ "pallet-ismp-relayer", "pallet-ismp-runtime-api", "pallet-message-queue", + "pallet-mmr 0.1.0", + "pallet-mmr-runtime-api", "pallet-session", "pallet-sudo", "pallet-timestamp", @@ -7294,6 +7332,7 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-runtime-common", "scale-info", + "simnode-runtime-api", "smallvec", "sp-api", "sp-block-builder", @@ -7301,6 +7340,7 @@ dependencies = [ "sp-core 28.0.0", "sp-genesis-builder", "sp-inherents", + "sp-mmr-primitives", "sp-offchain", "sp-runtime 31.0.1", "sp-session", @@ -7400,6 +7440,24 @@ dependencies = [ "zeroize", ] +[[package]] +name = "mmr-gadget" +version = "29.0.0" +dependencies = [ + "futures", + "log", + "pallet-ismp", + "pallet-mmr-runtime-api", + "parity-scale-codec", + "sc-client-api", + "sc-offchain", + "sp-api", + "sp-blockchain", + "sp-core 28.0.0", + "sp-mmr-primitives", + "sp-runtime 31.0.1", +] + [[package]] name = "mmr-gadget" version = "29.0.0" @@ -7420,6 +7478,20 @@ dependencies = [ "sp-runtime 31.0.1", ] +[[package]] +name = "mmr-primitives" +version = "0.1.0" +dependencies = [ + "ckb-merkle-mountain-range", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-mmr-primitives", + "sp-runtime 31.0.1", + "sp-std 14.0.0", +] + [[package]] name = "mmr-rpc" version = "28.0.0" @@ -7437,13 +7509,6 @@ dependencies = [ "sp-runtime 31.0.1", ] -[[package]] -name = "mmr-utils" -version = "0.1.0" -dependencies = [ - "ckb-merkle-mountain-range", -] - [[package]] name = "mockall" version = "0.11.4" @@ -7793,6 +7858,8 @@ dependencies = [ "pallet-ismp-relayer", "pallet-ismp-runtime-api", "pallet-message-queue", + "pallet-mmr 0.1.0", + "pallet-mmr-runtime-api", "pallet-session", "pallet-sudo", "pallet-timestamp", @@ -7804,6 +7871,7 @@ dependencies = [ "polkadot-parachain-primitives", "polkadot-runtime-common", "scale-info", + "simnode-runtime-api", "smallvec", "sp-api", "sp-block-builder", @@ -7811,6 +7879,7 @@ dependencies = [ "sp-core 28.0.0", "sp-genesis-builder", "sp-inherents", + "sp-mmr-primitives", "sp-offchain", "sp-runtime 31.0.1", "sp-session", @@ -8474,7 +8543,7 @@ dependencies = [ "frame-system", "log", "pallet-beefy", - "pallet-mmr", + "pallet-mmr 27.0.0", "pallet-session", "parity-scale-codec", "scale-info", @@ -8820,7 +8889,7 @@ dependencies = [ "ckb-merkle-mountain-range", "derive_more", "enum-as-inner", - "env_logger", + "env_logger 0.10.2", "fortuples", "frame-benchmarking", "frame-support", @@ -8828,7 +8897,9 @@ dependencies = [ "ismp", "ismp-testsuite", "log", + "mmr-primitives", "pallet-balances", + "pallet-mmr 0.1.0", "pallet-timestamp", "parity-scale-codec", "scale-info", @@ -8837,6 +8908,7 @@ dependencies = [ "sp-consensus-aura", "sp-core 28.0.0", "sp-io 30.0.0", + "sp-mmr-primitives", "sp-runtime 31.0.1", "sp-std 14.0.0", ] @@ -8927,6 +8999,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-core 28.0.0", + "sp-mmr-primitives", "sp-runtime 31.0.1", "sp-storage 19.0.0", "sp-trie 29.0.0", @@ -8943,6 +9016,7 @@ dependencies = [ "serde", "sp-api", "sp-core 28.0.0", + "sp-mmr-primitives", "sp-std 14.0.0", ] @@ -8959,7 +9033,7 @@ dependencies = [ "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", "dotenv", - "env_logger", + "env_logger 0.10.2", "ethereum-trie", "evm-common", "frame-support", @@ -8971,6 +9045,7 @@ dependencies = [ "ismp-bsc", "ismp-sync-committee", "ismp-testsuite", + "mmr-primitives", "pallet-asset-gateway", "pallet-assets", "pallet-balances", @@ -8981,6 +9056,7 @@ dependencies = [ "pallet-ismp-relayer", "pallet-ismp-rpc", "pallet-message-queue", + "pallet-mmr 0.1.0", "pallet-timestamp", "pallet-xcm", "parachains-common", @@ -9048,6 +9124,29 @@ dependencies = [ "sp-weights 27.0.0", ] +[[package]] +name = "pallet-mmr" +version = "0.1.0" +dependencies = [ + "array-bytes 6.2.2", + "ckb-merkle-mountain-range", + "env_logger 0.11.3", + "frame-benchmarking", + "frame-support", + "frame-system", + "itertools 0.10.5", + "log", + "mmr-primitives", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core 28.0.0", + "sp-io 30.0.0", + "sp-mmr-primitives", + "sp-runtime 31.0.1", + "sp-std 14.0.0", +] + [[package]] name = "pallet-mmr" version = "27.0.0" @@ -9067,6 +9166,18 @@ dependencies = [ "sp-std 14.0.0", ] +[[package]] +name = "pallet-mmr-runtime-api" +version = "0.1.0" +dependencies = [ + "parity-scale-codec", + "serde", + "sp-api", + "sp-core 28.0.0", + "sp-mmr-primitives", + "sp-std 14.0.0", +] + [[package]] name = "pallet-multisig" version = "28.0.0" @@ -11106,7 +11217,7 @@ dependencies = [ "kvdb", "kvdb-rocksdb", "log", - "mmr-gadget", + "mmr-gadget 29.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "pallet-babe", "pallet-im-online", "pallet-staking", @@ -12245,7 +12356,7 @@ dependencies = [ "pallet-indices", "pallet-membership", "pallet-message-queue", - "pallet-mmr", + "pallet-mmr 27.0.0", "pallet-multisig", "pallet-nis", "pallet-offences", @@ -13153,6 +13264,42 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sc-consensus-manual-seal" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b87636dd0b8aa3d294200100196b0fb51c389ed73e6722ff648feb0fd4adafdb" +dependencies = [ + "assert_matches", + "async-trait", + "futures", + "futures-timer", + "jsonrpsee 0.16.3", + "log", + "parity-scale-codec", + "sc-client-api", + "sc-consensus", + "sc-consensus-aura", + "sc-consensus-babe", + "sc-consensus-epochs", + "sc-transaction-pool", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-consensus-babe", + "sp-consensus-slots", + "sp-core 28.0.0", + "sp-inherents", + "sp-keystore 0.34.0", + "sp-runtime 31.0.1", + "sp-timestamp", + "substrate-prometheus-endpoint", + "thiserror", +] + [[package]] name = "sc-consensus-slots" version = "0.33.0" @@ -13686,6 +13833,72 @@ dependencies = [ "tracing-futures", ] +[[package]] +name = "sc-simnode" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d9e89833a86bcf0c106d7be604fecf8d081c5ecd2129d13055265d0b483c2be" +dependencies = [ + "async-trait", + "clap", + "cumulus-client-cli", + "cumulus-client-collator", + "cumulus-primitives-parachain-inherent", + "cumulus-test-relay-sproof-builder", + "frame-system", + "futures", + "jsonrpsee 0.16.3", + "log", + "num-traits", + "parity-scale-codec", + "polkadot-primitives", + "rand 0.8.5", + "sc-basic-authorship", + "sc-cli", + "sc-client-api", + "sc-client-db", + "sc-consensus", + "sc-consensus-aura", + "sc-consensus-babe", + "sc-consensus-manual-seal", + "sc-consensus-slots", + "sc-executor", + "sc-informant", + "sc-network", + "sc-offchain", + "sc-rpc", + "sc-rpc-server", + "sc-service", + "sc-telemetry", + "sc-tracing", + "sc-transaction-pool", + "sc-transaction-pool-api", + "simnode-runtime-api", + "sp-api", + "sp-block-builder", + "sp-blockchain", + "sp-consensus", + "sp-consensus-aura", + "sp-consensus-babe", + "sp-consensus-slots", + "sp-core 28.0.0", + "sp-externalities 0.25.0", + "sp-inherents", + "sp-io 30.0.0", + "sp-keyring", + "sp-offchain", + "sp-runtime 31.0.1", + "sp-runtime-interface 24.0.0", + "sp-session", + "sp-state-machine 0.35.0", + "sp-timestamp", + "sp-transaction-pool", + "sp-trie 29.0.0", + "sp-wasm-interface 20.0.0", + "staging-parachain-info", + "tokio", +] + [[package]] name = "sc-state-db" version = "0.30.0" @@ -13945,9 +14158,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.10.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" +checksum = "7c453e59a955f81fb62ee5d596b450383d699f152d350e9d23a0db2adb78e4c0" dependencies = [ "bitvec", "cfg-if", @@ -13959,9 +14172,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.10.0" +version = "2.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" +checksum = "18cf6c6447f813ef19eb450e985bcce6705f9ce7660db221b59093d15c79c4b7" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -14502,6 +14715,40 @@ dependencies = [ "wide", ] +[[package]] +name = "simnode-runtime-api" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6ff679d4634b044994463559e1986c869ed1f5b3e7aabd859ebd585d9b1506c" +dependencies = [ + "parity-scale-codec", + "sp-api", + "sp-std 14.0.0", +] + +[[package]] +name = "simnode-tests" +version = "0.1.0" +dependencies = [ + "anyhow", + "ckb-merkle-mountain-range", + "futures", + "ismp", + "mmr-primitives", + "pallet-ismp", + "pallet-ismp-rpc", + "pallet-mmr 0.1.0", + "parity-scale-codec", + "sc-consensus-manual-seal", + "sp-core 28.0.0", + "sp-keyring", + "sp-mmr-primitives", + "sp-runtime 31.0.1", + "subxt", + "subxt-utils", + "tokio", +] + [[package]] name = "simple-mermaid" version = "0.1.1" @@ -16630,6 +16877,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "subxt-utils" +version = "0.1.0" +dependencies = [ + "ismp", + "parity-scale-codec", + "sp-core-hashing 15.0.0", + "subxt", +] + [[package]] name = "svm-rs" version = "0.3.3" @@ -16713,7 +16970,7 @@ dependencies = [ "base2", "bls_on_arkworks", "dotenv", - "env_logger", + "env_logger 0.10.2", "ethers", "hex", "log", @@ -17023,9 +17280,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -18344,7 +18601,7 @@ dependencies = [ "pallet-indices", "pallet-membership", "pallet-message-queue", - "pallet-mmr", + "pallet-mmr 27.0.0", "pallet-multisig", "pallet-nomination-pools", "pallet-nomination-pools-benchmarking", diff --git a/Cargo.toml b/Cargo.toml index b7da9ecc2..87b5b1b95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,9 +31,9 @@ members = [ "modules/ismp/clients/arbitrum", "modules/ismp/clients/optimism", "modules/ismp/clients/sync-committee/evm-common", + "modules/ismp/clients/bsc", - # modules - "modules/trees/ethereum", + # cryptography "modules/consensus/sync-committee/prover", "modules/consensus/sync-committee/verifier", "modules/consensus/sync-committee/primitives", @@ -42,8 +42,11 @@ members = [ "modules/consensus/geth-primitives", "modules/consensus/bsc/verifier", "modules/consensus/bsc/prover", - "modules/ismp/clients/bsc", - "modules/trees/mmr", + "modules/trees/ethereum", + "modules/trees/mmr/pallet", + "modules/trees/mmr/primitives", + "modules/trees/mmr/gadget", + "modules/trees/mmr/pallet/runtime-api", # evm stuff "evm/integration-tests", @@ -51,6 +54,11 @@ members = [ # hyperclient "modules/client", + + # simnode + "modules/trees/mmr/simnode-tests", + # subxt subxt-utils + "modules/subxt/subxt-utils" ] # Config for 'cargo dist' @@ -103,6 +111,7 @@ sp-block-builder = { version = "26.0.0", default-features = false } sp-consensus-aura = { version = "0.32.0", default-features = false } sp-consensus-beefy = { version = "13.0.0", default-features = false } sp-core = { version = "28.0.0", default-features = false } +sp-core-hashing = { version = "15.0.0", default-features = false } sp-inherents = { version = "26.0.0", default-features = false } sp-offchain = { version = "26.0.0", default-features = false } sp-runtime = { version = "31.0.1", default-features = false } @@ -138,8 +147,8 @@ sp-mmr-primitives = { version = "26.0.0", default-features = false } sp-state-machine = { version = "0.35.0", default-features = false } sp-storage = { version = "19.0.0", default-features = false } pallet-beefy-mmr = { version = "28.0.0", default-features = false } -pallet-mmr = { version = "27.0.0", default-features = false } pallet-assets = { version = "29.0.0", default-features = false } +sp-keyring = "31.0.0" # client frame-benchmarking-cli = "32.0.0" @@ -147,8 +156,10 @@ pallet-transaction-payment-rpc = "30.0.0" sc-basic-authorship = "0.34.0" sc-chain-spec = "27.0.0" sc-cli = "0.36.0" +sc-block-builder = "0.33.0" sc-client-api = "28.0.0" sc-consensus = "0.33.0" +sc-consensus-manual-seal = "0.35.0" sc-executor = "0.32.0" sc-network = "0.34.0" sc-network-sync = "0.33.0" @@ -197,6 +208,7 @@ codec = { version = "3.1.3", package = "parity-scale-codec", default-features = scale-info = { version = "2.1.1", default-features = false, features = [ "derive", ] } +log = { version = "0.4.21", default-features = false } alloy-rlp = { version = "0.3.2", default-features = false } alloy-rlp-derive = "0.3.2" @@ -248,12 +260,27 @@ pallet-ismp-runtime-api = { path = "./modules/ismp/pallet/runtime-api", default- pallet-ismp-host-executive = { path = "modules/ismp/pallet/host-executive", default-features = false } pallet-call-decompressor = { path = "modules/ismp/pallet/call-decompressor", default-features = false } pallet-asset-gateway = { path = "modules/ismp/pallet/asset-gateway", default-features = false } +pallet-mmr = { path = "modules/trees/mmr/pallet", default-features = false } + +# Mmr +pallet-mmr-runtime-api = { path = "modules/trees/mmr/pallet/runtime-api", default-features = false } +mmr-gadget = { path = "modules/trees/mmr/gadget" } # merkle trees ethereum-trie = { path = "./modules/trees/ethereum", default-features = false } -mmr-utils = { path = "./modules/trees/mmr", default-features = false } +mmr-primitives = { path = "modules/trees/mmr/primitives", default-features = false } # runtimes gargantua-runtime = { path = "./parachain/runtimes/gargantua", default-features = false } messier-runtime = { path = "./parachain/runtimes/messier", default-features = false } nexus-runtime = { path = "./parachain/runtimes/nexus", default-features = false } + + +# Simnode +sc-simnode = { version = "1.6.1" } +simnode-runtime-api = { version = "1.6.0", default-features = false } +simnode-tests = { path = "modules/trees/mmr/simnode-tests" } + +# Subxt +subxt = { version = "0.30.1", default-features = false } +subxt-utils = { path = "modules/subxt/subxt-utils", default-features = false } diff --git a/evm/abi/Cargo.toml b/evm/abi/Cargo.toml index 4d1e1a875..92a87f96f 100644 --- a/evm/abi/Cargo.toml +++ b/evm/abi/Cargo.toml @@ -17,7 +17,7 @@ anyhow = "1.0.79" ethers = { workspace = true } ismp = { workspace = true } -mmr-utils = { workspace = true, optional = true } +mmr-primitives = { workspace = true, optional = true } sp-consensus-beefy = { workspace = true, features = ["default"], optional = true } merkle-mountain-range = { workspace = true, features = ["default"], optional = true } beefy-verifier-primitives = { workspace = true, optional = true } @@ -26,4 +26,4 @@ beefy-verifier-primitives = { workspace = true, optional = true } [features] default = ["beefy"] build-abi = [] -beefy = ["merkle-mountain-range", "sp-consensus-beefy", "beefy-verifier-primitives", "mmr-utils"] \ No newline at end of file +beefy = ["merkle-mountain-range", "sp-consensus-beefy", "beefy-verifier-primitives", "mmr-primitives"] \ No newline at end of file diff --git a/evm/abi/src/conversions.rs b/evm/abi/src/conversions.rs index 1d813ae83..f01471d99 100644 --- a/evm/abi/src/conversions.rs +++ b/evm/abi/src/conversions.rs @@ -80,7 +80,7 @@ mod beefy { impl From for RelayChainProof { fn from(value: MmrProof) -> Self { let leaf_index = value.mmr_proof.leaf_indices[0]; - let k_index = mmr_utils::mmr_position_to_k_index( + let k_index = mmr_primitives::mmr_position_to_k_index( vec![leaf_index_to_pos(leaf_index)], leaf_index_to_mmr_size(leaf_index), )[0] diff --git a/evm/abi/src/generated/host_manager.rs b/evm/abi/src/generated/host_manager.rs index 7a46ce340..105d793fe 100644 --- a/evm/abi/src/generated/host_manager.rs +++ b/evm/abi/src/generated/host_manager.rs @@ -254,12 +254,12 @@ pub mod host_manager { pub static HOSTMANAGER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> = ::ethers::contract::Lazy::new(__abi); #[rustfmt::skip] - const __BYTECODE: &[u8] = b"`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`@Qa\x14\xB88\x03\x80a\x14\xB8\x839\x81\x01`@\x81\x90Ra\0/\x91a\0\x83V[\x80Q`\0\x80T`\x01`\x01`\xA0\x1B\x03\x19\x90\x81\x16`\x01`\x01`\xA0\x1B\x03\x93\x84\x16\x17\x90\x91U` \x90\x92\x01Q`\x01\x80T\x90\x93\x16\x91\x16\x17\x90Ua\0\xEBV[\x80Q`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\0~W`\0\x80\xFD[\x91\x90PV[`\0`@\x82\x84\x03\x12\x15a\0\x95W`\0\x80\xFD[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\0\xC5WcNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Ra\0\xD1\x83a\0gV[\x81Ra\0\xDF` \x84\x01a\0gV[` \x82\x01R\x93\x92PPPV[a\x13\xBE\x80a\0\xFA`\09`\0\xF3\xFE`\x80`@R4\x80\x15a\0\x10W`\0\x80\xFD[P`\x046\x10a\0\x88W`\x005`\xE0\x1C\x80c\xB5\xA9\x82K\x11a\0[W\x80c\xB5\xA9\x82K\x14a\0\xD6W\x80c\xBC\r\xD4G\x14a\0\xE9W\x80c\xC4\x92\xE4&\x14a\0\xFCW\x80c\xCF\xF0\xAB\x96\x14a\x01\nW`\0\x80\xFD[\x80c\x0B\xC3{\xAB\x14a\0\x8DW\x80c\x0E\x83$\xA2\x14a\0\xA2W\x80c\x0F\xEE2\xCE\x14a\0\xB5W\x80c\xB2\xA0\x1B\xF5\x14a\0\xC8W[`\0\x80\xFD[a\0\xA0a\0\x9B6`\x04a\t\nV[a\x01]V[\0[a\0\xA0a\0\xB06`\x04a\t]V[a\x01\xB9V[a\0\xA0a\0\xC36`\x04a\t\x7FV[a\x02`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E`@Q\x81c\xFF\xFF\xFF\xFF\x16`\xE0\x1B\x81R`\x04\x01`\0`@Q\x80\x83\x03\x81\x86Z\xFA\x15\x80\x15a\x02\xFBW=`\0\x80>=`\0\xFD[PPPP`@Q=`\0\x82>`\x1F=\x90\x81\x01`\x1F\x19\x16\x82\x01`@Ra\x03#\x91\x90\x81\x01\x90a\x0E\x14V[a\x03-\x83\x80a\x0E\x8AV[\x80\x80`\x1F\x01` \x80\x91\x04\x02` \x01`@Q\x90\x81\x01`@R\x80\x93\x92\x91\x90\x81\x81R` \x01\x83\x83\x80\x82\x847`\0\x92\x01\x91\x90\x91RP\x92\x93\x92PPa\x05\xF8\x90PV[a\x03\xADW`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x14`$\x82\x01Rs\x15[\x98]]\x1A\x1B\xDC\x9A^\x99Y\x08\x1C\x99\\]Y\\\xDD`b\x1B`D\x82\x01R`d\x01a\x01\xB0V[`\0a\x03\xBC`\xC0\x83\x01\x83a\x0E\x8AV[`\0\x81\x81\x10a\x03\xCDWa\x03\xCDa\x0E\xD7V[\x91\x90\x91\x015`\xF8\x1C\x90P`\x01\x81\x11\x15a\x03\xE8Wa\x03\xE8a\x0E\xEDV[\x90P`\0\x81`\x01\x81\x11\x15a\x03\xFEWa\x03\xFEa\x0E\xEDV[\x03a\x04\xA1W`\0a\x04\x12`\xC0\x84\x01\x84a\x0E\x8AV[a\x04 \x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04-\x91\x90a\x0F-V[`\x01T`@Qc=`\0\xFD[PPPPPPPPV[`\x01\x81`\x01\x81\x11\x15a\x04\xB5Wa\x04\xB5a\x0E\xEDV[\x03a\x05\x15W`\0a\x04\xC9`\xC0\x84\x01\x84a\x0E\x8AV[a\x04\xD7\x91`\x01\x90\x82\x90a\x0F\x03V[\x81\x01\x90a\x04\xE4\x91\x90a\x10@V[`\x01T`@Qc{H\x1F\xE1`\xE1\x1B\x81R\x91\x92P`\x01`\x01`\xA0\x1B\x03\x16\x90c\xF6\x90?\xC2\x90a\x04i\x90\x84\x90`\x04\x01a\x12MV[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`\x0E`$\x82\x01Rm*\xB75\xB77\xBB\xB7\x100\xB1\xBA4\xB7\xB7`\x91\x1B`D\x82\x01R`d\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`$\x80\x82\x01R\x7FIsmpModule doesn't emit Get requ`D\x82\x01Rcests`\xE0\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`@QbF\x1B\xCD`\xE5\x1B\x81R` `\x04\x82\x01R`%`$\x82\x01R\x7FIsmpModule doesn't emit Post req`D\x82\x01Rduests`\xD8\x1B`d\x82\x01R`\x84\x01a\x01\xB0V[`\0\x81Q\x83Q\x14a\x06\x0BWP`\0a\x06\x1FV[P\x81Q` \x82\x81\x01\x82\x90 \x90\x84\x01\x91\x90\x91 \x14[\x92\x91PPV[cNH{q`\xE0\x1B`\0R`A`\x04R`$`\0\xFD[`@Q`\xE0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@R\x90V[`@\x80Q\x90\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Qa\x01\xC0\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06]Wa\x06]a\x06%V[`@Q`\x1F\x82\x01`\x1F\x19\x16\x81\x01`\x01`\x01`@\x1B\x03\x81\x11\x82\x82\x10\x17\x15a\x06\xD0Wa\x06\xD0a\x06%V[`@R\x91\x90PV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\x06\xF1Wa\x06\xF1a\x06%V[P`\x1F\x01`\x1F\x19\x16` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\x07\x10W`\0\x80\xFD[\x815a\x07#a\x07\x1E\x82a\x06\xD8V[a\x06\xA8V[\x81\x81R\x84` \x83\x86\x01\x01\x11\x15a\x078W`\0\x80\xFD[\x81` \x85\x01` \x83\x017`\0\x91\x81\x01` \x01\x91\x90\x91R\x93\x92PPPV[\x805`\x01`\x01`@\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[\x91\x90PV[`\0`\xE0\x82\x84\x03\x12\x15a\x07\x83W`\0\x80\xFD[a\x07\x8Ba\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x07\xA4W`\0\x80\xFD[a\x07\xB0\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x07\xC6W`\0\x80\xFD[a\x07\xD2\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x07\xE3`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x07\xFCW`\0\x80\xFD[a\x08\x08\x85\x83\x86\x01a\x06\xFFV[``\x84\x01R`\x80\x84\x015\x91P\x80\x82\x11\x15a\x08!W`\0\x80\xFD[a\x08-\x85\x83\x86\x01a\x06\xFFV[`\x80\x84\x01Ra\x08>`\xA0\x85\x01a\x07UV[`\xA0\x84\x01R`\xC0\x84\x015\x91P\x80\x82\x11\x15a\x08WW`\0\x80\xFD[Pa\x08d\x84\x82\x85\x01a\x06\xFFV[`\xC0\x83\x01RP\x92\x91PPV[`\0``\x82\x84\x03\x12\x15a\x08\x82W`\0\x80\xFD[`@Q``\x81\x01`\x01`\x01`@\x1B\x03\x82\x82\x10\x81\x83\x11\x17\x15a\x08\xA5Wa\x08\xA5a\x06%V[\x81`@R\x82\x93P\x845\x91P\x80\x82\x11\x15a\x08\xBDW`\0\x80\xFD[a\x08\xC9\x86\x83\x87\x01a\x07qV[\x83R` \x85\x015\x91P\x80\x82\x11\x15a\x08\xDFW`\0\x80\xFD[Pa\x08\xEC\x85\x82\x86\x01a\x06\xFFV[` \x83\x01RPa\x08\xFE`@\x84\x01a\x07UV[`@\x82\x01RP\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\t\x1CW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t2W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\x08pV[\x94\x93PPPPV[\x805`\x01`\x01`\xA0\x1B\x03\x81\x16\x81\x14a\x07lW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\toW`\0\x80\xFD[a\tx\x82a\tFV[\x93\x92PPPV[`\0` \x82\x84\x03\x12\x15a\t\x91W`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\t\xA7W`\0\x80\xFD[\x82\x01`@\x81\x85\x03\x12\x15a\txW`\0\x80\xFD[`\0` \x82\x84\x03\x12\x15a\t\xCBW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\t\xE2W`\0\x80\xFD[\x90\x83\x01\x90`@\x82\x86\x03\x12\x15a\t\xF6W`\0\x80\xFD[a\t\xFEa\x06cV[\x825\x82\x81\x11\x15a\n\rW`\0\x80\xFD[a\n\x19\x87\x82\x86\x01a\x08pV[\x82RPa\n(` \x84\x01a\tFV[` \x82\x01R\x95\x94PPPPPV[`\0`\x01`\x01`@\x1B\x03\x82\x11\x15a\nOWa\nOa\x06%V[P`\x05\x1B` \x01\x90V[`\0\x82`\x1F\x83\x01\x12a\njW`\0\x80\xFD[\x815` a\nza\x07\x1E\x83a\n6V[\x82\x81R`\x05\x92\x90\x92\x1B\x84\x01\x81\x01\x91\x81\x81\x01\x90\x86\x84\x11\x15a\n\x99W`\0\x80\xFD[\x82\x86\x01[\x84\x81\x10\x15a\n\xD8W\x805`\x01`\x01`@\x1B\x03\x81\x11\x15a\n\xBCW`\0\x80\x81\xFD[a\n\xCA\x89\x86\x83\x8B\x01\x01a\x06\xFFV[\x84RP\x91\x83\x01\x91\x83\x01a\n\x9DV[P\x96\x95PPPPPPV[`\0`\xE0\x82\x84\x03\x12\x15a\n\xF5W`\0\x80\xFD[a\n\xFDa\x06;V[\x90P\x815`\x01`\x01`@\x1B\x03\x80\x82\x11\x15a\x0B\x16W`\0\x80\xFD[a\x0B\"\x85\x83\x86\x01a\x06\xFFV[\x83R` \x84\x015\x91P\x80\x82\x11\x15a\x0B8W`\0\x80\xFD[a\x0BD\x85\x83\x86\x01a\x06\xFFV[` \x84\x01Ra\x0BU`@\x85\x01a\x07UV[`@\x84\x01R``\x84\x015\x91P\x80\x82\x11\x15a\x0BnW`\0\x80\xFD[a\x0Bz\x85\x83\x86\x01a\x06\xFFV[``\x84\x01Ra\x0B\x8B`\x80\x85\x01a\x07UV[`\x80\x84\x01R`\xA0\x84\x015\x91P\x80\x82\x11\x15a\x0B\xA4W`\0\x80\xFD[Pa\x0B\xB1\x84\x82\x85\x01a\nYV[`\xA0\x83\x01RPa\x0B\xC3`\xC0\x83\x01a\x07UV[`\xC0\x82\x01R\x92\x91PPV[`\0` \x82\x84\x03\x12\x15a\x0B\xE0W`\0\x80\xFD[`\x01`\x01`@\x1B\x03\x80\x835\x11\x15a\x0B\xF6W`\0\x80\xFD[\x825\x83\x01`@\x81\x86\x03\x12\x15a\x0C\nW`\0\x80\xFD[a\x0C\x12a\x06cV[\x82\x825\x11\x15a\x0C W`\0\x80\xFD[\x815\x82\x01`@\x81\x88\x03\x12\x15a\x0C4W`\0\x80\xFD[a\x0C\x84\x82\x85\x01a\x07qV[`\0` \x82\x84\x03\x12\x15a\r\xAEW`\0\x80\xFD[\x815`\x01`\x01`@\x1B\x03\x81\x11\x15a\r\xC4W`\0\x80\xFD[a\t>\x84\x82\x85\x01a\n\xE3V[`\0\x825`\xDE\x19\x836\x03\x01\x81\x12a\r\xE6W`\0\x80\xFD[\x91\x90\x91\x01\x92\x91PPV[`\0[\x83\x81\x10\x15a\x0E\x0BW\x81\x81\x01Q\x83\x82\x01R` \x01a\r\xF3V[PP`\0\x91\x01RV[`\0` \x82\x84\x03\x12\x15a\x0E&W`\0\x80\xFD[\x81Q`\x01`\x01`@\x1B\x03\x81\x11\x15a\x0E; + +impl rs_merkle::Hasher for Keccak256 { type Hash = [u8; 32]; fn hash(data: &[u8]) -> [u8; 32] { @@ -52,4 +55,4 @@ impl From for NumberHash { } } -pub type Mmr = MemMMR>; +pub type Mmr = MemMMR>; diff --git a/evm/integration-tests/src/tests/post_request.rs b/evm/integration-tests/src/tests/post_request.rs index 174d52819..fb496e834 100644 --- a/evm/integration-tests/src/tests/post_request.rs +++ b/evm/integration-tests/src/tests/post_request.rs @@ -13,7 +13,8 @@ use ismp_solidity_abi::{ handler::{PostRequestLeaf, PostRequestMessage}, shared_types::StateCommitment, }; -use pallet_ismp::mmr::primitives::{DataOrHash, Leaf}; +use mmr_primitives::DataOrHash; +use pallet_ismp::mmr::Leaf; use std::{env, path::PathBuf}; #[tokio::test(flavor = "multi_thread")] diff --git a/evm/integration-tests/src/tests/post_response.rs b/evm/integration-tests/src/tests/post_response.rs index 249750cd9..21a60545f 100644 --- a/evm/integration-tests/src/tests/post_response.rs +++ b/evm/integration-tests/src/tests/post_response.rs @@ -23,7 +23,8 @@ use ismp_solidity_abi::{ shared_types::{PostRequest, PostResponse, StateCommitment, StateMachineHeight}, }; -use pallet_ismp::mmr::primitives::{DataOrHash, Leaf}; +use mmr_primitives::DataOrHash; +use pallet_ismp::mmr::Leaf; use primitive_types::H256; use std::{env, path::PathBuf}; @@ -60,11 +61,11 @@ async fn test_post_response_proof() -> Result<(), anyhow::Error> { } let pos = mmr.push(response)?; - let k_index = mmr_utils::mmr_position_to_k_index(vec![pos], mmr.mmr_size())[0].1; + let k_index = mmr_primitives::mmr_position_to_k_index(vec![pos], mmr.mmr_size())[0].1; let proof = mmr.gen_proof(vec![pos])?; - let overlay_root = mmr.get_root()?.hash::().0; - let multiproof = proof.proof_items().iter().map(|h| h.hash::().0).collect(); + let overlay_root = mmr.get_root()?.hash().0; + let multiproof = proof.proof_items().iter().map(|h| h.hash().0).collect(); // create intermediate state let height = StateMachineHeight { state_machine_id: U256::from(2000), height: U256::from(10) }; diff --git a/evm/integration-tests/src/tests/utils.rs b/evm/integration-tests/src/tests/utils.rs index 0cb0e3795..24545090e 100644 --- a/evm/integration-tests/src/tests/utils.rs +++ b/evm/integration-tests/src/tests/utils.rs @@ -1,10 +1,10 @@ -use crate::{Keccak256, Mmr}; +use std::collections::{BTreeMap, HashSet}; + +use crate::{DataOrHash, Mmr}; use ismp_solidity_abi::{beefy::StateMachineHeight, handler::Proof}; -use pallet_ismp::mmr::primitives::DataOrHash; use primitive_types::{H256, U256}; use sp_core::KeccakHasher; use sp_trie::{LayoutV0, MemoryDB, StorageProof, TrieDBBuilder, EMPTY_PREFIX}; -use std::collections::{BTreeMap, HashSet}; use trie_db::{HashDB, Recorder, Trie, TrieDBMutBuilder, TrieMut}; /// Initialize an MMR tree, inserting the given leaf into it and returning the root of the tree, the @@ -28,10 +28,10 @@ pub fn initialize_mmr_tree( mmr.push(DataOrHash::Hash(hash))?; } - let k_index = mmr_utils::mmr_position_to_k_index(vec![pos], mmr.mmr_size())[0].1; + let k_index = mmr_primitives::mmr_position_to_k_index(vec![pos], mmr.mmr_size())[0].1; let proof = mmr.gen_proof(vec![pos])?; - let root = mmr.get_root()?.hash::().0; - let multiproof = proof.proof_items().iter().map(|h| h.hash::().0).collect(); + let root = mmr.get_root()?.hash().0; + let multiproof = proof.proof_items().iter().map(|h| h.hash().0).collect(); let height = StateMachineHeight { state_machine_id: U256::from(2000), height: U256::from(block_height) }; let proof = Proof { height, multiproof, leaf_count: (61).into() }; diff --git a/evm/src/consensus/BeefyV1.sol b/evm/src/consensus/BeefyV1.sol index edd6b25f2..fd4ef7b91 100644 --- a/evm/src/consensus/BeefyV1.sol +++ b/evm/src/consensus/BeefyV1.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./Codec.sol"; diff --git a/evm/src/consensus/Codec.sol b/evm/src/consensus/Codec.sol index 71c82b293..2cf61ad2b 100644 --- a/evm/src/consensus/Codec.sol +++ b/evm/src/consensus/Codec.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "solidity-merkle-trees/MerkleMultiProof.sol"; diff --git a/evm/src/consensus/Header.sol b/evm/src/consensus/Header.sol index 1443616ac..0aab474f4 100644 --- a/evm/src/consensus/Header.sol +++ b/evm/src/consensus/Header.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {StateCommitment} from "ismp/IConsensusClient.sol"; diff --git a/evm/src/consensus/ZkBeefy.sol b/evm/src/consensus/ZkBeefy.sol index b9fff5dfb..3aed9759b 100644 --- a/evm/src/consensus/ZkBeefy.sol +++ b/evm/src/consensus/ZkBeefy.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./Codec.sol"; diff --git a/evm/src/consensus/verifiers/IVerifier.sol b/evm/src/consensus/verifiers/IVerifier.sol index f8cdba51a..5e7e9b8a9 100644 --- a/evm/src/consensus/verifiers/IVerifier.sol +++ b/evm/src/consensus/verifiers/IVerifier.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity ^0.8.0; interface IVerifier { diff --git a/evm/src/hosts/Arbitrum.sol b/evm/src/hosts/Arbitrum.sol index c80de28ac..1b1377772 100644 --- a/evm/src/hosts/Arbitrum.sol +++ b/evm/src/hosts/Arbitrum.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./EvmHost.sol"; diff --git a/evm/src/hosts/Base.sol b/evm/src/hosts/Base.sol index d646729c4..1e073bc67 100644 --- a/evm/src/hosts/Base.sol +++ b/evm/src/hosts/Base.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./EvmHost.sol"; diff --git a/evm/src/hosts/Bsc.sol b/evm/src/hosts/Bsc.sol index 855d458ee..592b9ad50 100644 --- a/evm/src/hosts/Bsc.sol +++ b/evm/src/hosts/Bsc.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./EvmHost.sol"; diff --git a/evm/src/hosts/Ethereum.sol b/evm/src/hosts/Ethereum.sol index 9817944c1..3bffc744d 100644 --- a/evm/src/hosts/Ethereum.sol +++ b/evm/src/hosts/Ethereum.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./EvmHost.sol"; diff --git a/evm/src/hosts/EvmHost.sol b/evm/src/hosts/EvmHost.sol index 510f27ac0..b0f66eb14 100644 --- a/evm/src/hosts/EvmHost.sol +++ b/evm/src/hosts/EvmHost.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {Context} from "openzeppelin/utils/Context.sol"; @@ -104,11 +117,10 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { mapping(uint256 => mapping(uint256 => uint256)) private _stateCommitmentsUpdateTime; // mapping of state machine identifier to latest known height - // (stateMachineId => (blockHeight => timestamp)) + // (stateMachineId => blockHeight) mapping(uint256 => uint256) private _latestStateMachineHeight; // mapping of all known fishermen accounts - // (stateMachineId => (blockHeight => timestamp)) mapping(address => bool) private _fishermen; // mapping of state machine identifier to height vetoed to fisherman @@ -147,7 +159,9 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { event StateMachineUpdated(bytes stateMachineId, uint256 height); // Emitted when a state commitment is vetoed by a fisherman - event StateCommitmentVetoed(bytes stateMachineId, uint256 height, address fisherman); + event StateCommitmentVetoed( + bytes stateMachineId, uint256 height, StateCommitment stateCommitment, address fisherman + ); // Emitted when a new POST request is dispatched event PostRequestEvent( @@ -451,6 +465,7 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { * @dev Delete the state commitment at given state height. */ function deleteStateMachineCommitmentInternal(StateMachineHeight memory height, address fisherman) private { + StateCommitment memory stateCommitment = _stateCommitments[height.stateMachineId][height.height]; delete _stateCommitments[height.stateMachineId][height.height]; delete _stateCommitmentsUpdateTime[height.stateMachineId][height.height]; delete _latestStateMachineHeight[height.stateMachineId]; @@ -460,6 +475,7 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { emit StateCommitmentVetoed({ stateMachineId: stateMachineId(height.stateMachineId), + stateCommitment: stateCommitment, height: height.height, fisherman: fisherman }); @@ -511,16 +527,20 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { return; } + // replay protection + bytes32 commitment = request.hash(); + _requestReceipts[commitment] = relayer; + (bool success,) = address(destination).call( abi.encodeWithSelector(IIsmpModule.onAccept.selector, IncomingPostRequest(request, relayer)) ); - if (success) { - bytes32 commitment = request.hash(); - _requestReceipts[commitment] = relayer; - - emit PostRequestHandled({commitment: commitment, relayer: relayer}); + if (!success) { + // so that it can be retried + delete _requestReceipts[commitment]; + return; } + emit PostRequestHandled({commitment: commitment, relayer: relayer}); } /** @@ -529,16 +549,21 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { */ function dispatchIncoming(PostResponse memory response, address relayer) external onlyHandler { address origin = _bytesToAddress(response.request.from); + + // replay protection + bytes32 commitment = response.request.hash(); + _responseReceipts[commitment] = ResponseReceipt({relayer: relayer, responseCommitment: response.hash()}); + (bool success,) = address(origin).call( abi.encodeWithSelector(IIsmpModule.onPostResponse.selector, IncomingPostResponse(response, relayer)) ); - if (success) { - bytes32 commitment = response.request.hash(); - _responseReceipts[commitment] = ResponseReceipt({relayer: relayer, responseCommitment: response.hash()}); - - emit PostResponseHandled({commitment: commitment, relayer: relayer}); + if (!success) { + // so that it can be retried + delete _responseReceipts[commitment]; + return; } + emit PostResponseHandled({commitment: commitment, relayer: relayer}); } /** @@ -547,21 +572,28 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { */ function dispatchIncoming(GetResponse memory response, address relayer) external onlyHandler { address origin = _bytesToAddress(response.request.from); + + // replay protection + bytes32 commitment = response.request.hash(); + // don't commit the full response object, it's unused. + _responseReceipts[commitment] = ResponseReceipt({relayer: relayer, responseCommitment: bytes32(0)}); + (bool success,) = address(origin).call( abi.encodeWithSelector(IIsmpModule.onGetResponse.selector, IncomingGetResponse(response, relayer)) ); - if (success) { - FeeMetadata memory meta = _requestCommitments[response.request.hash()]; - if (meta.fee > 0) { - // pay the relayer their fee - IERC20(feeToken()).transfer(relayer, meta.fee); - } - bytes32 commitment = response.request.hash(); - // don't commit the full response object, it's unused. - _responseReceipts[commitment] = ResponseReceipt({relayer: relayer, responseCommitment: bytes32(0)}); - emit PostResponseHandled({commitment: commitment, relayer: relayer}); + if (!success) { + // so that it can be retried + delete _responseReceipts[commitment]; + return; + } + + FeeMetadata memory meta = _requestCommitments[response.request.hash()]; + if (meta.fee > 0) { + // pay the relayer their fee + IERC20(feeToken()).transfer(relayer, meta.fee); } + emit PostResponseHandled({commitment: commitment, relayer: relayer}); } /** @@ -573,19 +605,22 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { onlyHandler { address origin = _bytesToAddress(request.from); - (bool success,) = address(origin).call(abi.encodeWithSelector(IIsmpModule.onGetTimeout.selector, request)); - if (success) { - // delete memory of this request - delete _requestCommitments[commitment]; + // replay protection, delete memory of this request + delete _requestCommitments[commitment]; + (bool success,) = address(origin).call(abi.encodeWithSelector(IIsmpModule.onGetTimeout.selector, request)); - if (meta.fee > 0) { - // refund relayer fee - IERC20(feeToken()).transfer(meta.sender, meta.fee); - } + if (!success) { + // so that it can be retried + _requestCommitments[commitment] = meta; + return; + } - emit GetRequestTimeoutHandled({commitment: commitment}); + if (meta.fee > 0) { + // refund relayer fee + IERC20(feeToken()).transfer(meta.sender, meta.fee); } + emit GetRequestTimeoutHandled({commitment: commitment}); } /** @@ -597,20 +632,23 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { onlyHandler { address origin = _bytesToAddress(request.from); + + // replay protection, delete memory of this request + delete _requestCommitments[commitment]; (bool success,) = address(origin).call(abi.encodeWithSelector(IIsmpModule.onPostRequestTimeout.selector, request)); - if (success) { - // delete memory of this request - delete _requestCommitments[commitment]; - - if (meta.fee > 0) { - // refund relayer fee - IERC20(feeToken()).transfer(meta.sender, meta.fee); - } + if (!success) { + // so that it can be retried + _requestCommitments[commitment] = meta; + return; + } - emit PostRequestTimeoutHandled({commitment: commitment}); + if (meta.fee > 0) { + // refund relayer fee + IERC20(feeToken()).transfer(meta.sender, meta.fee); } + emit PostRequestTimeoutHandled({commitment: commitment}); } /** @@ -622,21 +660,26 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { onlyHandler { address origin = _bytesToAddress(response.request.to); + + // replay protection, delete memory of this response + bytes32 reqCommitment = response.request.hash(); + delete _responseCommitments[commitment]; + delete _responded[reqCommitment]; (bool success,) = address(origin).call(abi.encodeWithSelector(IIsmpModule.onPostResponseTimeout.selector, response)); - if (success) { - // delete memory of this response - delete _responseCommitments[commitment]; - delete _responded[response.request.hash()]; - - if (meta.fee > 0) { - // refund relayer fee - IERC20(feeToken()).transfer(meta.sender, meta.fee); - } + if (!success) { + // so that it can be retried + _responseCommitments[commitment] = meta; + _responded[reqCommitment] = true; + return; + } - emit PostResponseTimeoutHandled({commitment: commitment}); + if (meta.fee > 0) { + // refund relayer fee + IERC20(feeToken()).transfer(meta.sender, meta.fee); } + emit PostResponseTimeoutHandled({commitment: commitment}); } /** @@ -766,7 +809,6 @@ abstract contract EvmHost is IIsmpHost, IHostManager, Context { FeeMetadata memory metadata = _requestCommitments[commitment]; require(metadata.sender != address(0), "Unknown request"); - require(metadata.sender == _msgSender(), "User can only fund own requests"); IERC20(feeToken()).transferFrom(_msgSender(), address(this), amount); metadata.fee += amount; diff --git a/evm/src/hosts/Optimism.sol b/evm/src/hosts/Optimism.sol index e30efceb3..60f447453 100644 --- a/evm/src/hosts/Optimism.sol +++ b/evm/src/hosts/Optimism.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./EvmHost.sol"; diff --git a/evm/src/hosts/Polygon.sol b/evm/src/hosts/Polygon.sol index 46bf07e2c..290eff70c 100644 --- a/evm/src/hosts/Polygon.sol +++ b/evm/src/hosts/Polygon.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "./EvmHost.sol"; diff --git a/evm/src/interfaces/ICallDispatcher.sol b/evm/src/interfaces/ICallDispatcher.sol index 8c65058f7..19e6290c6 100644 --- a/evm/src/interfaces/ICallDispatcher.sol +++ b/evm/src/interfaces/ICallDispatcher.sol @@ -1,13 +1,24 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.17; +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +pragma solidity 0.8.17; struct CallDispatcherParams { address target; bytes data; } - interface ICallDispatcher { function dispatch(CallDispatcherParams memory params) external returns (bytes memory result, bool success); } diff --git a/evm/src/modules/CallDispatcher.sol b/evm/src/modules/CallDispatcher.sol index 73a2fcc00..fa497c5f9 100644 --- a/evm/src/modules/CallDispatcher.sol +++ b/evm/src/modules/CallDispatcher.sol @@ -1,10 +1,21 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {ICallDispatcher, CallDispatcherParams} from "../interfaces/ICallDispatcher.sol"; - - /// @notice This contract is used to dispatch calls to other contracts. contract CallDispatcher is ICallDispatcher { /// @dev funtion returns `success = false` if the target is not a contract and reverts if the call to the target contract fails. diff --git a/evm/src/modules/HandlerV1.sol b/evm/src/modules/HandlerV1.sol index 8438c10a2..d344caec1 100644 --- a/evm/src/modules/HandlerV1.sol +++ b/evm/src/modules/HandlerV1.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {MerkleMountainRange, MmrLeaf} from "solidity-merkle-trees/MerkleMountainRange.sol"; diff --git a/evm/src/modules/HostManager.sol b/evm/src/modules/HostManager.sol index 4fe7b3c02..fe72830ef 100644 --- a/evm/src/modules/HostManager.sol +++ b/evm/src/modules/HostManager.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity ^0.8.17; import {Bytes} from "solidity-merkle-trees/trie/Bytes.sol"; diff --git a/evm/src/modules/TokenFaucet.sol b/evm/src/modules/TokenFaucet.sol index f51ef142b..116faf31a 100644 --- a/evm/src/modules/TokenFaucet.sol +++ b/evm/src/modules/TokenFaucet.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {IERC6160Ext20} from "ERC6160/interfaces/IERC6160Ext20.sol"; diff --git a/evm/src/modules/TokenGateway.sol b/evm/src/modules/TokenGateway.sol index 0d2fd87a8..58aa87c03 100644 --- a/evm/src/modules/TokenGateway.sol +++ b/evm/src/modules/TokenGateway.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {IDispatcher, DispatchPost} from "ismp/IDispatcher.sol"; diff --git a/evm/test/BaseTest.sol b/evm/test/BaseTest.sol index 1ad15819b..ff79e6daa 100644 --- a/evm/test/BaseTest.sol +++ b/evm/test/BaseTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; @@ -114,6 +127,7 @@ contract BaseTest is Test { feeToken.superApprove(address(tx.origin), address(testModule)); feeToken.superApprove(address(tx.origin), address(host)); feeToken.superApprove(address(testModule), address(host)); + feeToken.superApprove(address(this), address(host)); miniStaking = new MiniStaking(address(feeToken)); } diff --git a/evm/test/Beefy.sol b/evm/test/Beefy.sol index 538c8d187..27a266c22 100644 --- a/evm/test/Beefy.sol +++ b/evm/test/Beefy.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/EvmHostTest.sol b/evm/test/EvmHostTest.sol index 283ac075c..db6f2c7e3 100644 --- a/evm/test/EvmHostTest.sol +++ b/evm/test/EvmHostTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {BaseTest} from "./BaseTest.sol"; @@ -87,8 +100,8 @@ contract EvmHostTest is BaseTest { vm.prank(tx.origin); host.fundRequest(keccak256(hex"dead"), 10 * 1e18); - // another person can't fund your request for safety reasons - vm.expectRevert("User can only fund own requests"); + // another person can fund your request + feeToken.mint(address(this), 10 * 1e18, ""); host.fundRequest(commitment, 10 * 1e18); } diff --git a/evm/test/FeeToken.sol b/evm/test/FeeToken.sol index 97767decb..bcfd4bf84 100644 --- a/evm/test/FeeToken.sol +++ b/evm/test/FeeToken.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {ERC6160Ext20} from "ERC6160/tokens/ERC6160Ext20.sol"; diff --git a/evm/test/GetRequest.sol b/evm/test/GetRequest.sol index 55987d4ec..b91f1bb93 100644 --- a/evm/test/GetRequest.sol +++ b/evm/test/GetRequest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/HostManagerTest.sol b/evm/test/HostManagerTest.sol index 527df672b..c88904a87 100644 --- a/evm/test/HostManagerTest.sol +++ b/evm/test/HostManagerTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/MainnetForkBaseTest.sol b/evm/test/MainnetForkBaseTest.sol index 4ab098e5e..36f47f91a 100644 --- a/evm/test/MainnetForkBaseTest.sol +++ b/evm/test/MainnetForkBaseTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/MockUSDC.sol b/evm/test/MockUSDC.sol index c8b5d5cd9..88e1f9d08 100644 --- a/evm/test/MockUSDC.sol +++ b/evm/test/MockUSDC.sol @@ -1,5 +1,17 @@ -// SPDX-License-Identifier: MIT -// Compatible with OpenZeppelin Contracts ^5.0.0 +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity ^0.8.17; import {ERC20} from "openzeppelin/token/ERC20/ERC20.sol"; diff --git a/evm/test/PlonkTest.sol b/evm/test/PlonkTest.sol index fc5377690..ca02dccfc 100644 --- a/evm/test/PlonkTest.sol +++ b/evm/test/PlonkTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/PostRequest.sol b/evm/test/PostRequest.sol index 4743f4493..e5e845157 100644 --- a/evm/test/PostRequest.sol +++ b/evm/test/PostRequest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/PostResponse.sol b/evm/test/PostResponse.sol index f1da28a48..33b7dbf89 100644 --- a/evm/test/PostResponse.sol +++ b/evm/test/PostResponse.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/TeleportSwapTest.sol b/evm/test/TeleportSwapTest.sol index 029c45f5d..66572c695 100644 --- a/evm/test/TeleportSwapTest.sol +++ b/evm/test/TeleportSwapTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; diff --git a/evm/test/TestConsensusClient.sol b/evm/test/TestConsensusClient.sol index bacbb5140..9b44faedd 100644 --- a/evm/test/TestConsensusClient.sol +++ b/evm/test/TestConsensusClient.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import {IConsensusClient, IntermediateState} from "ismp/IConsensusClient.sol"; diff --git a/evm/test/TestHost.sol b/evm/test/TestHost.sol index f94514ae3..7544e371c 100644 --- a/evm/test/TestHost.sol +++ b/evm/test/TestHost.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "../src/hosts/EvmHost.sol"; diff --git a/evm/test/TokenGatewayTest.sol b/evm/test/TokenGatewayTest.sol index dc395aa42..117ff7980 100644 --- a/evm/test/TokenGatewayTest.sol +++ b/evm/test/TokenGatewayTest.sol @@ -1,4 +1,17 @@ -// SPDX-License-Identifier: UNLICENSED +// Copyright (C) Polytope Labs Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. pragma solidity 0.8.17; import "forge-std/Test.sol"; @@ -133,12 +146,7 @@ contract TokenGatewayTest is BaseTest { address calldataTarget = address(miniStaking); bytes memory stakeCalldata = abi.encodeWithSignature("recordStake(address)", address(this)); - CallDispatcherParams memory dispatchParams = CallDispatcherParams({ - target: calldataTarget, - data: stakeCalldata - }); - - + CallDispatcherParams memory dispatchParams = CallDispatcherParams({target: calldataTarget, data: stakeCalldata}); BodyWithCall memory body = BodyWithCall({ assetId: keccak256("USD.h"), diff --git a/modules/client/Cargo.toml b/modules/client/Cargo.toml index 5ea9dcce4..e562d2c1f 100644 --- a/modules/client/Cargo.toml +++ b/modules/client/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] wasm-bindgen = { version = "0.2.90" } -subxt = { version = "0.30.1", default-features = false } +subxt = { workspace = true } getrandom = { version = "0.2", default-features = false, features = ["js"] } anyhow = "1.0.75" hex-literal = { version = "0.4.1" } @@ -40,6 +40,7 @@ pallet-ismp = { workspace = true, features = ["disable-panic-handler"] } evm-common = { workspace = true } ismp-solidity-abi = { workspace = true } ethereum-trie = { workspace = true } +subxt-utils = { workspace = true } [dependencies.reconnecting-jsonrpsee-ws-client] git = "https://github.com/niklasad1/reconnecting-jsonrpsee-ws-client" @@ -48,8 +49,8 @@ default-features = false [features] default = ["std"] -wasm = ["subxt/web", "subxt/jsonrpsee", "reconnecting-jsonrpsee-ws-client/web"] -std = ["subxt/native", "subxt/jsonrpsee", "reconnecting-jsonrpsee-ws-client/native"] +wasm = ["subxt/web", "subxt/jsonrpsee", "reconnecting-jsonrpsee-ws-client/web", "subxt-utils/wasm"] +std = ["subxt/native", "subxt/jsonrpsee", "reconnecting-jsonrpsee-ws-client/native", "subxt-utils/std"] [dev-dependencies] json = { package = "serde_json", version = "1.0.114", default-features = false } diff --git a/modules/client/src/lib.rs b/modules/client/src/lib.rs index 6112c4a25..b8b87c341 100644 --- a/modules/client/src/lib.rs +++ b/modules/client/src/lib.rs @@ -2,7 +2,7 @@ pub mod internals; pub mod providers; -pub mod runtime; +pub use subxt_utils::gargantua as runtime; pub mod types; pub mod interfaces; @@ -16,11 +16,12 @@ use anyhow::anyhow; use crate::{ interfaces::{JsClientConfig, JsPost, JsPostResponse}, providers::{evm::EvmClient, substrate::SubstrateClient}, - types::{ChainConfig, HyperBridgeConfig, MessageStatusWithMetadata, TimeoutStatus}, + types::{ChainConfig, MessageStatusWithMetadata, TimeoutStatus}, }; use ethers::{types::H256, utils::keccak256}; use futures::StreamExt; use ismp::router::{Post, PostResponse}; +use subxt_utils::Hyperbridge; use wasm_bindgen::prelude::*; use wasm_streams::ReadableStream; @@ -244,7 +245,7 @@ pub struct HyperClient { #[wasm_bindgen(skip)] pub dest: EvmClient, #[wasm_bindgen(skip)] - pub hyperbridge: SubstrateClient, + pub hyperbridge: SubstrateClient, } impl HyperClient { diff --git a/modules/client/src/providers/substrate.rs b/modules/client/src/providers/substrate.rs index c587ff451..4490183b8 100644 --- a/modules/client/src/providers/substrate.rs +++ b/modules/client/src/providers/substrate.rs @@ -13,10 +13,14 @@ use hex_literal::hex; use ismp::{ consensus::{ConsensusStateId, StateCommitment, StateMachineHeight, StateMachineId}, events::{Event, StateMachineUpdated}, - host::{Ethereum, StateMachine}, + host::StateMachine, messaging::Message, }; use ismp_solidity_abi::evm_host::PostRequestHandledFilter; +use pallet_ismp::{ + child_trie::{ChildInfo, CHILD_TRIE_PREFIX}, + ResponseReceipt, +}; use reconnecting_jsonrpsee_ws_client::{Client as ReconnectClient, SubscriptionId}; use serde::{Deserialize, Serialize}; use std::{ @@ -26,8 +30,10 @@ use std::{ use subxt::{ config::Header, error::RpcError, - rpc::{RawValue, RpcClientT, RpcFuture, RpcSubscription}, - rpc_params, OnlineClient, + rpc::{types::StorageData, RawValue, RpcClientT, RpcFuture, RpcSubscription}, + rpc_params, + storage::StorageKey, + OnlineClient, }; #[derive(Debug, Clone)] @@ -125,14 +131,16 @@ impl Client for SubstrateClient { } async fn query_request_receipt(&self, request_hash: H256) -> Result { - let addr = runtime::api::storage().ismp().request_receipts(&request_hash); - let receipt = self.client.storage().at_latest().await?.fetch(&addr).await?; + let child_storage_key = ChildInfo::new_default(CHILD_TRIE_PREFIX).prefixed_storage_key(); + let storage_key = StorageKey(self.request_receipt_full_key(request_hash)); + let params = rpc_params![child_storage_key, storage_key, Option::::None]; - if let Some(receipt) = receipt { - Ok(H160::from_slice(&receipt[..20])) - } else { - Ok(H160::zero()) - } + let response: Option = + self.client.rpc().request("childstate_getStorage", params).await?; + let data = response.ok_or_else(|| anyhow!("Request fee metadata query returned None"))?; + let relayer = Vec::decode(&mut &*data.0)?; + + Ok(H160::from_slice(&relayer[..20])) } async fn query_state_proof(&self, at: u64, keys: Vec>) -> Result, Error> { @@ -155,13 +163,17 @@ impl Client for SubstrateClient { } async fn query_response_receipt(&self, request_commitment: H256) -> Result { - let addr = runtime::api::storage().ismp().response_receipts(&request_commitment); - let receipt = self.client.storage().at_latest().await?.fetch(&addr).await?; - if let Some(receipt) = receipt { - Ok(H160::from_slice(&receipt.relayer[..20])) - } else { - Ok(H160::zero()) - } + let key = self.response_receipt_full_key(request_commitment); + let child_storage_key = ChildInfo::new_default(CHILD_TRIE_PREFIX).prefixed_storage_key(); + let storage_key = StorageKey(key); + let params = rpc_params![child_storage_key, storage_key, Option::::None]; + + let response: Option = + self.client.rpc().request("childstate_getStorage", params).await?; + let data = response.ok_or_else(|| anyhow!("Response fee metadata query returned None"))?; + let receipt = ResponseReceipt::decode(&mut &*data.0)?; + + Ok(H160::from_slice(&receipt.relayer[..20])) } async fn ismp_events_stream( @@ -461,116 +473,3 @@ impl RpcClientT for ClientWrapper { }) } } - -impl From for StateCommitment { - fn from(commitment: runtime::api::runtime_types::ismp::consensus::StateCommitment) -> Self { - StateCommitment { - timestamp: commitment.timestamp, - overlay_root: commitment.overlay_root, - state_root: commitment.state_root, - } - } -} - -impl From for StateMachineHeight { - fn from( - state_machine_height: runtime::api::runtime_types::ismp::consensus::StateMachineHeight, - ) -> Self { - StateMachineHeight { - id: state_machine_height.id.into(), - height: state_machine_height.height, - } - } -} - -impl From for StateMachineId { - fn from( - state_machine_id: runtime::api::runtime_types::ismp::consensus::StateMachineId, - ) -> Self { - StateMachineId { - state_id: state_machine_id.state_id.into(), - consensus_state_id: state_machine_id.consensus_state_id, - } - } -} - -impl From for StateMachine { - fn from(state_machine_id: runtime::api::runtime_types::ismp::host::StateMachine) -> Self { - match state_machine_id { - runtime::api::runtime_types::ismp::host::StateMachine::Ethereum(ethereum) => - match ethereum { - runtime::api::runtime_types::ismp::host::Ethereum::ExecutionLayer => - StateMachine::Ethereum(Ethereum::ExecutionLayer), - runtime::api::runtime_types::ismp::host::Ethereum::Optimism => - StateMachine::Ethereum(Ethereum::Optimism), - runtime::api::runtime_types::ismp::host::Ethereum::Arbitrum => - StateMachine::Ethereum(Ethereum::Arbitrum), - runtime::api::runtime_types::ismp::host::Ethereum::Base => - StateMachine::Ethereum(Ethereum::Base), - }, - runtime::api::runtime_types::ismp::host::StateMachine::Polkadot(id) => - StateMachine::Polkadot(id), - runtime::api::runtime_types::ismp::host::StateMachine::Kusama(id) => - StateMachine::Kusama(id), - runtime::api::runtime_types::ismp::host::StateMachine::Grandpa(consensus_state_id) => - StateMachine::Grandpa(consensus_state_id), - runtime::api::runtime_types::ismp::host::StateMachine::Beefy(consensus_state_id) => - StateMachine::Beefy(consensus_state_id), - runtime::api::runtime_types::ismp::host::StateMachine::Polygon => StateMachine::Polygon, - runtime::api::runtime_types::ismp::host::StateMachine::Bsc => StateMachine::Bsc, - } - } -} - -impl From for runtime::api::runtime_types::ismp::consensus::StateMachineHeight { - fn from(state_machine_height: StateMachineHeight) -> Self { - runtime::api::runtime_types::ismp::consensus::StateMachineHeight { - id: state_machine_height.id.into(), - height: state_machine_height.height, - } - } -} - -impl From for runtime::api::runtime_types::ismp::consensus::StateMachineId { - fn from(state_machine_id: StateMachineId) -> Self { - Self { - state_id: state_machine_id.state_id.into(), - consensus_state_id: state_machine_id.consensus_state_id, - } - } -} - -impl From for runtime::api::runtime_types::ismp::host::StateMachine { - fn from(state_machine_id: StateMachine) -> Self { - match state_machine_id { - StateMachine::Ethereum(ethereum) => match ethereum { - Ethereum::ExecutionLayer => - runtime::api::runtime_types::ismp::host::StateMachine::Ethereum( - runtime::api::runtime_types::ismp::host::Ethereum::ExecutionLayer, - ), - Ethereum::Optimism => - runtime::api::runtime_types::ismp::host::StateMachine::Ethereum( - runtime::api::runtime_types::ismp::host::Ethereum::Optimism, - ), - Ethereum::Arbitrum => - runtime::api::runtime_types::ismp::host::StateMachine::Ethereum( - runtime::api::runtime_types::ismp::host::Ethereum::Arbitrum, - ), - Ethereum::Base => runtime::api::runtime_types::ismp::host::StateMachine::Ethereum( - runtime::api::runtime_types::ismp::host::Ethereum::Base, - ), - }, - StateMachine::Polkadot(id) => - runtime::api::runtime_types::ismp::host::StateMachine::Polkadot(id), - StateMachine::Kusama(id) => - runtime::api::runtime_types::ismp::host::StateMachine::Kusama(id), - StateMachine::Grandpa(consensus_state_id) => - runtime::api::runtime_types::ismp::host::StateMachine::Grandpa(consensus_state_id), - StateMachine::Beefy(consensus_state_id) => - runtime::api::runtime_types::ismp::host::StateMachine::Beefy(consensus_state_id), - - StateMachine::Polygon => runtime::api::runtime_types::ismp::host::StateMachine::Polygon, - StateMachine::Bsc => runtime::api::runtime_types::ismp::host::StateMachine::Bsc, - } - } -} diff --git a/modules/client/src/types.rs b/modules/client/src/types.rs index 7c30890b3..774924694 100644 --- a/modules/client/src/types.rs +++ b/modules/client/src/types.rs @@ -2,48 +2,19 @@ use crate::providers::{evm::EvmClient, interface::Client, substrate::SubstrateCl use anyhow::anyhow; use codec::Encode; use core::pin::Pin; -use ethers::{types::H160, utils::keccak256}; +use ethers::types::H160; pub use evm_common::types::EvmStateProof; use futures::Stream; use ismp::{consensus::ConsensusStateId, host::StateMachine}; pub use pallet_ismp::primitives::{HashAlgorithm, SubstrateStateProof}; use serde::{Deserialize, Serialize}; -use subxt::{ - config::{polkadot::PolkadotExtrinsicParams, substrate::SubstrateHeader, Hasher}, - tx::TxPayload, - utils::{AccountId32, MultiAddress, MultiSignature, H256}, - Config, Metadata, -}; +use subxt::{tx::TxPayload, utils::H256, Config, Metadata}; +use subxt_utils::Hyperbridge; // ======================================== // TYPES // ======================================== -/// Implements [`subxt::Config`] for substrate chains with keccak as their hashing algorithm -#[derive(Clone)] -pub struct HyperBridgeConfig; - -/// A type that can hash values using the keccak_256 algorithm. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode)] -pub struct KeccakHasher; - -impl Hasher for KeccakHasher { - type Output = H256; - fn hash(s: &[u8]) -> Self::Output { - keccak256(s).into() - } -} - -impl Config for HyperBridgeConfig { - type Hash = H256; - type AccountId = AccountId32; - type Address = MultiAddress; - type Signature = MultiSignature; - type Hasher = KeccakHasher; - type Header = SubstrateHeader; - type ExtrinsicParams = PolkadotExtrinsicParams; -} - pub type BoxStream = Pin>>>; #[derive(Clone, Serialize, Deserialize, Debug, Eq, PartialEq)] @@ -283,11 +254,9 @@ impl ClientConfig { } } - pub async fn hyperbridge_client( - &self, - ) -> Result, anyhow::Error> { + pub async fn hyperbridge_client(&self) -> Result, anyhow::Error> { match self.hyperbridge { - ChainConfig::Substrate(ref config) => config.into_client::().await, + ChainConfig::Substrate(ref config) => config.into_client::().await, _ => Err(anyhow!("Hyperbridge config should be a substrate variant")), } } diff --git a/modules/consensus/beefy/prover/Cargo.toml b/modules/consensus/beefy/prover/Cargo.toml index e22ca9249..26cc7a5d6 100644 --- a/modules/consensus/beefy/prover/Cargo.toml +++ b/modules/consensus/beefy/prover/Cargo.toml @@ -21,14 +21,13 @@ sp-storage = { workspace = true, features = ["default"] } sp-io = { workspace = true, features = ["default"] } frame-support = { workspace = true, features = ["default"]} pallet-beefy-mmr = { workspace = true, features = ["default"] } -pallet-mmr = { workspace = true, features = ["default"] } sp-mmr-primitives = { workspace = true, features = ["default"] } sp-consensus-beefy = { workspace = true, features = ["default"] } sp-trie = { workspace = true, features = ["default"] } mmr-rpc = { workspace = true } # Optional deps -subxt = { version = "0.30.1", features = ["substrate-compat"] } +subxt = { workspace = true, features = ["substrate-compat"], default-features = true } serde_json = { version = "1.0.74" } hex = { version = "0.4.3" } diff --git a/modules/consensus/bsc/prover/src/lib.rs b/modules/consensus/bsc/prover/src/lib.rs index 3521df36d..f279d0325 100644 --- a/modules/consensus/bsc/prover/src/lib.rs +++ b/modules/consensus/bsc/prover/src/lib.rs @@ -51,6 +51,11 @@ impl BscPosProver { &self, attested_header: CodecHeader, validator_size: u64, + // Current consensus client epoch + epoch: u64, + // Use this bool to force fetching of validator set change outside of the default rotation + // period + fetch_val_set_change: bool, ) -> Result, anyhow::Error> { trace!(target: "bsc-prover", "fetching bsc update for {:?}", attested_header.number); let parse_extra_data = parse_extra::(&attested_header.extra_data) @@ -71,17 +76,18 @@ impl BscPosProver { .await? .ok_or_else(|| anyhow!("header block could not be fetched {target_hash}"))?; - let source_header_epoch = compute_epoch(source_header.number.low_u64()); - let epoch_header_number = source_header_epoch * EPOCH_LENGTH; - let mut epoch_header_ancestry = vec![]; - + let epoch_header_number = epoch * EPOCH_LENGTH; // If we are still in authority rotation period get the epoch header ancestry alongside // update only if the finalized header is not the epoch block let rotation_block = get_rotation_block(epoch_header_number, validator_size) - 1; - if attested_header.number.low_u64() >= epoch_header_number + 2 && + if (attested_header.number.low_u64() >= epoch_header_number + 2 && attested_header.number.low_u64() <= rotation_block && - source_header.number.low_u64() > epoch_header_number + source_header.number.low_u64() > epoch_header_number) || + // If forcing a fetching of validator set, the source header must still be greater than epoch header number + // To avoid the issue seen here https://testnet.bscscan.com/block/39713004 where the source header is lesser than the epoch header + // We will skip such updates. + (fetch_val_set_change && source_header.number.low_u64() > epoch_header_number) { let mut header = self.fetch_header(source_header.parent_hash).await?.ok_or_else(|| { @@ -96,11 +102,16 @@ impl BscPosProver { } } + let source_header_number = source_header.number.low_u64(); + let attested_header_number = attested_header.number.low_u64(); + let ancestry_len = epoch_header_ancestry.len(); let bsc_client_update = BscClientUpdate { source_header, target_header, attested_header, - epoch_header_ancestry: epoch_header_ancestry.try_into().expect("Infallible: Qed"), + epoch_header_ancestry: epoch_header_ancestry.try_into().map_err(|_| { + anyhow!("Epoch ancestry too large, Length {:?}, Epoch Header {epoch_header_number:?}, Source Header {source_header_number:?}, Attested Header {attested_header_number:?}",ancestry_len) + })?, }; Ok(Some(bsc_client_update)) diff --git a/modules/consensus/bsc/prover/src/test.rs b/modules/consensus/bsc/prover/src/test.rs index c02a027c3..a80fc99ce 100644 --- a/modules/consensus/bsc/prover/src/test.rs +++ b/modules/consensus/bsc/prover/src/test.rs @@ -55,7 +55,7 @@ async fn verify_bsc_pos_headers() { let block_epoch = compute_epoch(header.number.low_u64()); if let Some(mut update) = prover - .fetch_bsc_update::(header.clone(), validators.len() as u64) + .fetch_bsc_update::(header.clone(), validators.len() as u64, current_epoch, false) .await .unwrap() { diff --git a/modules/consensus/bsc/verifier/src/primitives.rs b/modules/consensus/bsc/verifier/src/primitives.rs index 6439e24b3..344e79c77 100644 --- a/modules/consensus/bsc/verifier/src/primitives.rs +++ b/modules/consensus/bsc/verifier/src/primitives.rs @@ -28,7 +28,7 @@ pub struct BscClientUpdate { pub attested_header: CodecHeader, /// Epoch header ancestry up to source header /// The Epoch header should the first header in the vector - pub epoch_header_ancestry: sp_runtime::BoundedVec>, + pub epoch_header_ancestry: sp_runtime::BoundedVec>, } #[derive(Debug, Clone)] diff --git a/modules/consensus/grandpa/prover/Cargo.toml b/modules/consensus/grandpa/prover/Cargo.toml index b052897a9..eaceb1362 100644 --- a/modules/consensus/grandpa/prover/Cargo.toml +++ b/modules/consensus/grandpa/prover/Cargo.toml @@ -9,7 +9,7 @@ authors = ["Polytope Labs "] hex = "0.4.3" anyhow = "1.0.64" serde = "1.0.144" -subxt = "0.29.0" +subxt = { workspace = true, default-features = true } codec = { package = "parity-scale-codec", version = "3.2.2", features = ["derive"] } derive_more = "0.99.17" downcast-rs = "1.2.0" diff --git a/modules/consensus/grandpa/verifier/Cargo.toml b/modules/consensus/grandpa/verifier/Cargo.toml index e6bfee18c..ab9b43922 100644 --- a/modules/consensus/grandpa/verifier/Cargo.toml +++ b/modules/consensus/grandpa/verifier/Cargo.toml @@ -28,7 +28,7 @@ substrate-state-machine = { path = "../../pallet-ismp/primitives/state-machine", [dev-dependencies] polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" } -subxt = { version = "0.29.0", features = ["substrate-compat"] } +subxt = { workspace = true, features = ["substrate-compat"], default-features = true } futures = "0.3.24" hex = "0.4.3" env_logger = "0.9.0" diff --git a/modules/ismp/clients/state-machine/substrate/src/lib.rs b/modules/ismp/clients/state-machine/substrate/src/lib.rs index 569a6e6da..bc9afd094 100644 --- a/modules/ismp/clients/state-machine/substrate/src/lib.rs +++ b/modules/ismp/clients/state-machine/substrate/src/lib.rs @@ -20,7 +20,7 @@ extern crate alloc; -use alloc::{collections::BTreeMap, format, vec, vec::Vec}; +use alloc::{collections::BTreeMap, format, string::ToString, vec, vec::Vec}; use codec::Decode; use core::{fmt::Debug, marker::PhantomData}; use frame_support::ensure; diff --git a/modules/ismp/core/src/handlers/request.rs b/modules/ismp/core/src/handlers/request.rs index db001099c..930103dac 100644 --- a/modules/ismp/core/src/handlers/request.rs +++ b/modules/ismp/core/src/handlers/request.rs @@ -88,6 +88,8 @@ where let wrapped_req = Request::Post(request.clone()); let lambda = || { let cb = router.module_for_id(request.to.clone())?; + // Store request receipt to prevent reentrancy attack + host.store_request_receipt(&wrapped_req, &msg.signer)?; let res = cb.on_accept(request.clone()).map(|_| { let commitment = hash_request::(&wrapped_req); Event::PostRequestHandled(RequestResponseHandled { @@ -95,8 +97,9 @@ where relayer: signer.clone(), }) }); - if res.is_ok() { - host.store_request_receipt(&wrapped_req, &msg.signer)?; + // Delete receipt if module callback failed so it can be timed out + if res.is_err() { + host.delete_request_receipt(&wrapped_req)?; } Ok(res) }; diff --git a/modules/ismp/core/src/handlers/response.rs b/modules/ismp/core/src/handlers/response.rs index bd43a4a4c..77da7c6ac 100644 --- a/modules/ismp/core/src/handlers/response.rs +++ b/modules/ismp/core/src/handlers/response.rs @@ -88,6 +88,8 @@ where .into_iter() .map(|response| { let cb = router.module_for_id(response.destination_module())?; + // Store response receipt to prevent reentrancy attack + host.store_response_receipt(&response, &msg.signer)?; let res = cb.on_response(response.clone()).map(|_| { let commitment = hash_response::(&response); Event::PostResponseHandled(RequestResponseHandled { @@ -95,8 +97,9 @@ where relayer: signer.clone(), }) }); - if res.is_ok() { - host.store_response_receipt(&response, &msg.signer)?; + // Delete receipt if module callback failed so it can be timed out + if res.is_err() { + host.delete_response_receipt(&response)?; } Ok(res) }) @@ -149,6 +152,11 @@ where let router = host.ismp_router(); let cb = router.module_for_id(request.from.clone())?; + let response = Response::Get(GetResponse { + get: request.clone(), + values: Default::default(), + }); + host.store_response_receipt(&response, &msg.signer)?; let res = cb .on_response(Response::Get(GetResponse { get: request.clone(), values })) .map(|_| { @@ -158,12 +166,9 @@ where relayer: signer.clone(), }) }); - let response = Response::Get(GetResponse { - get: request.clone(), - values: Default::default(), - }); - if res.is_ok() { - host.store_response_receipt(&response, &msg.signer)?; + // Delete receipt if module callback failed so it can be timed out + if res.is_err() { + host.delete_response_receipt(&response)?; } Ok(res) }) diff --git a/modules/ismp/core/src/handlers/timeout.rs b/modules/ismp/core/src/handlers/timeout.rs index b276948d5..9bb4f7f1e 100644 --- a/modules/ismp/core/src/handlers/timeout.rs +++ b/modules/ismp/core/src/handlers/timeout.rs @@ -84,15 +84,23 @@ where .into_iter() .map(|request| { let cb = router.module_for_id(request.source_module())?; + // Delete commitment to prevent rentrancy attack + let meta = host.delete_request_commitment(&request)?; + let mut signer = None; + // If it was a routed request delete the receipt + if host.host_state_machine() != request.source_chain() { + signer = host.delete_request_receipt(&request).ok(); + } let res = cb.on_timeout(request.clone().into()).map(|_| { let commitment = hash_request::(&request); Event::PostRequestTimeoutHandled(TimeoutHandled { commitment }) }); - if res.is_ok() { - host.delete_request_commitment(&request)?; - // If the request was routed we delete it's receipt - if host.host_state_machine() != request.source_chain() { - host.delete_request_receipt(&request)?; + // If module callback failed restore commitment so it can be retried + if res.is_err() { + host.store_request_commitment(&request, meta)?; + // If the request was routed we store it's receipt + if host.host_state_machine() != request.source_chain() && signer.is_some() { + host.store_request_receipt(&request, &signer.expect("Infaliible"))?; } } Ok(res) @@ -143,15 +151,27 @@ where .into_iter() .map(|response| { let cb = router.module_for_id(response.source_module())?; + // Delete commitment to prevent rentrancy + let meta = host.delete_response_commitment(&response)?; + // If the response was routed we delete it's receipt + let mut signer = None; + if host.host_state_machine() != response.source_chain() { + signer = + host.delete_response_receipt(&Response::Post(response.clone())).ok(); + } let res = cb.on_timeout(response.clone().into()).map(|_| { let commitment = hash_post_response::(&response); Event::PostResponseTimeoutHandled(TimeoutHandled { commitment }) }); - if res.is_ok() { - host.delete_response_commitment(&response)?; - // If the response was routed we delete it's receipt - if host.host_state_machine() != response.source_chain() { - host.delete_response_receipt(&response)?; + // If module callback failed restore commitment so it can be retried + if res.is_err() { + host.store_response_commitment(&response, meta)?; + if host.host_state_machine() != response.source_chain() && signer.is_some() + { + host.store_response_receipt( + &Response::Post(response), + &signer.expect("Infallible"), + )?; } } Ok(res) @@ -181,12 +201,15 @@ where .into_iter() .map(|request| { let cb = router.module_for_id(request.source_module())?; + // Delete commitment to prevent reentrancy + let meta = host.delete_request_commitment(&request)?; let res = cb.on_timeout(request.clone().into()).map(|_| { let commitment = hash_request::(&request); Event::GetRequestTimeoutHandled(TimeoutHandled { commitment }) }); - if res.is_ok() { - host.delete_request_commitment(&request)?; + // If module callback failed, restore commitment so it can be retried + if res.is_err() { + host.store_request_commitment(&request, meta)?; } Ok(res) }) diff --git a/modules/ismp/core/src/host.rs b/modules/ismp/core/src/host.rs index 0d77a828d..9a5215149 100644 --- a/modules/ismp/core/src/host.rs +++ b/modules/ismp/core/src/host.rs @@ -155,20 +155,24 @@ pub trait IsmpHost: Keccak256 { /// Delete a request commitment from storage, used when a request is timed out. /// Make sure to refund the user their relayer fee here. - fn delete_request_commitment(&self, req: &Request) -> Result<(), Error>; + /// Returns the scale encoded commitment metadata + fn delete_request_commitment(&self, req: &Request) -> Result, Error>; /// Delete a request commitment from storage, used when a response is timed out. /// Make sure to refund the user their relayer fee here. /// Also delete the request from the responded map. - fn delete_response_commitment(&self, res: &PostResponse) -> Result<(), Error>; + /// Returns the scale encoded commitment metadata + fn delete_response_commitment(&self, res: &PostResponse) -> Result, Error>; /// Delete a request receipt from storage, used when a request is timed out. /// Should only ever be called by a routing state machine - fn delete_request_receipt(&self, req: &Request) -> Result<(), Error>; + /// Returns the signer + fn delete_request_receipt(&self, req: &Request) -> Result, Error>; - /// Delete a request commitment from storage, used when a response is timed out. + /// Delete a response receipt from storage, used when a response is timed out. /// Should only ever be called by a routing state machine - fn delete_response_receipt(&self, res: &PostResponse) -> Result<(), Error>; + /// Returns the signer + fn delete_response_receipt(&self, res: &Response) -> Result, Error>; /// Stores a receipt for an incoming request after it is successfully routed to a module. /// Prevents duplicate incoming requests from being processed. Includes the relayer account @@ -179,6 +183,12 @@ pub trait IsmpHost: Keccak256 { /// Implementors should map the request commitment to the response object commitment. fn store_response_receipt(&self, req: &Response, signer: &Vec) -> Result<(), Error>; + /// Stores a commitment for an outgoing request alongside some scale encoded metadata + fn store_request_commitment(&self, req: &Request, meta: Vec) -> Result<(), Error>; + + /// Stores a commitment for an outgoing response alongside some scale encoded metadata + fn store_response_commitment(&self, res: &PostResponse, meta: Vec) -> Result<(), Error>; + /// Should return a handle to the consensus client based on the id fn consensus_client(&self, id: ConsensusClientId) -> Result, Error> { self.consensus_clients() diff --git a/modules/ismp/core/src/lib.rs b/modules/ismp/core/src/lib.rs index d1d29d386..f1a812e9d 100644 --- a/modules/ismp/core/src/lib.rs +++ b/modules/ismp/core/src/lib.rs @@ -21,6 +21,7 @@ pub mod module; pub mod router; pub mod util; +pub use error::Error; pub mod prelude { //! Some useful imports in the crate prelude. pub use alloc::{format, str::FromStr, string::String, vec, vec::Vec}; diff --git a/modules/ismp/core/src/router.rs b/modules/ismp/core/src/router.rs index cbad0770e..b14cd962c 100644 --- a/modules/ismp/core/src/router.rs +++ b/modules/ismp/core/src/router.rs @@ -221,6 +221,34 @@ impl Request { Request::Get(get) => Ok(get.clone()), } } + + /// Returns the encoded request + pub fn encode(&self) -> Vec { + match self { + Request::Post(post) => { + let mut buf = Vec::new(); + buf.extend_from_slice(post.source.to_string().as_bytes()); + buf.extend_from_slice(post.dest.to_string().as_bytes()); + buf.extend_from_slice(&post.nonce.to_be_bytes()); + buf.extend_from_slice(&post.timeout_timestamp.to_be_bytes()); + buf.extend_from_slice(&post.from); + buf.extend_from_slice(&post.to); + buf.extend_from_slice(&post.data); + buf + }, + Request::Get(get) => { + let mut buf = Vec::new(); + buf.extend_from_slice(get.source.to_string().as_bytes()); + buf.extend_from_slice(get.dest.to_string().as_bytes()); + buf.extend_from_slice(&get.nonce.to_be_bytes()); + buf.extend_from_slice(&get.height.to_be_bytes()); + buf.extend_from_slice(&get.timeout_timestamp.to_be_bytes()); + buf.extend_from_slice(&get.from); + get.keys.iter().for_each(|key| buf.extend_from_slice(key)); + buf + }, + } + } } /// The response to a POST request @@ -284,6 +312,22 @@ impl PostResponse { pub fn timed_out(&self, proof_timestamp: Duration) -> bool { proof_timestamp >= self.timeout() } + + /// Returns the encoded response + pub fn encode(&self) -> Vec { + let mut buf = Vec::new(); + let req = &self.post; + buf.extend_from_slice(req.source.to_string().as_bytes()); + buf.extend_from_slice(req.dest.to_string().as_bytes()); + buf.extend_from_slice(&req.nonce.to_be_bytes()); + buf.extend_from_slice(&req.timeout_timestamp.to_be_bytes()); + buf.extend_from_slice(&req.from); + buf.extend_from_slice(&req.to); + buf.extend_from_slice(&req.data); + buf.extend_from_slice(&self.response); + buf.extend_from_slice(&self.timeout_timestamp.to_be_bytes()); + buf + } } /// The response to a POST request @@ -373,6 +417,14 @@ impl Response { Response::Post(res) => proof_timestamp >= res.timeout(), } } + + /// Returns the encoded response + pub fn encode(&self) -> Vec { + match self { + Response::Post(res) => res.encode(), + Response::Get(res) => Request::Get(res.get.clone()).encode(), + } + } } /// Convenience enum for membership verification. diff --git a/modules/ismp/core/src/util.rs b/modules/ismp/core/src/util.rs index 5f532779a..4fddcb65e 100644 --- a/modules/ismp/core/src/util.rs +++ b/modules/ismp/core/src/util.rs @@ -1,7 +1,6 @@ //! ISMP utilities use crate::router::{PostResponse, Request, Response}; -use alloc::{string::ToString, vec::Vec}; use primitive_types::H256; /// A trait that returns a 256 bit keccak has of some bytes @@ -14,31 +13,8 @@ pub trait Keccak256 { /// Return the keccak256 hash of a request pub fn hash_request(req: &Request) -> H256 { - match req { - Request::Post(post) => { - let mut buf = Vec::new(); - - buf.extend_from_slice(post.source.to_string().as_bytes()); - buf.extend_from_slice(post.dest.to_string().as_bytes()); - buf.extend_from_slice(&post.nonce.to_be_bytes()); - buf.extend_from_slice(&post.timeout_timestamp.to_be_bytes()); - buf.extend_from_slice(&post.from); - buf.extend_from_slice(&post.to); - buf.extend_from_slice(&post.data); - H::keccak256(&buf[..]) - }, - Request::Get(get) => { - let mut buf = Vec::new(); - buf.extend_from_slice(get.source.to_string().as_bytes()); - buf.extend_from_slice(get.dest.to_string().as_bytes()); - buf.extend_from_slice(&get.nonce.to_be_bytes()); - buf.extend_from_slice(&get.height.to_be_bytes()); - buf.extend_from_slice(&get.timeout_timestamp.to_be_bytes()); - buf.extend_from_slice(&get.from); - get.keys.iter().for_each(|key| buf.extend_from_slice(key)); - H::keccak256(&buf[..]) - }, - } + let encoded = req.encode(); + H::keccak256(&encoded) } /// Return the keccak256 of a response @@ -51,16 +27,5 @@ pub fn hash_response(res: &Response) -> H256 { /// Return the keccak256 of a response pub fn hash_post_response(res: &PostResponse) -> H256 { - let req = &res.post; - let mut buf = Vec::new(); - buf.extend_from_slice(req.source.to_string().as_bytes()); - buf.extend_from_slice(req.dest.to_string().as_bytes()); - buf.extend_from_slice(&req.nonce.to_be_bytes()); - buf.extend_from_slice(&req.timeout_timestamp.to_be_bytes()); - buf.extend_from_slice(&req.from); - buf.extend_from_slice(&req.to); - buf.extend_from_slice(&req.data); - buf.extend_from_slice(&res.response); - buf.extend_from_slice(&res.timeout_timestamp.to_be_bytes()); - H::keccak256(&buf[..]) + H::keccak256(&res.encode()) } diff --git a/modules/ismp/pallet/Cargo.toml b/modules/ismp/pallet/Cargo.toml index 11bccb44f..21071db95 100644 --- a/modules/ismp/pallet/Cargo.toml +++ b/modules/ismp/pallet/Cargo.toml @@ -22,6 +22,9 @@ sp-consensus-aura = { workspace = true } ismp = { workspace = true } codec = { workspace = true } scale-info = { workspace = true } +sp-mmr-primitives = { workspace = true } +pallet-mmr = { workspace = true } +mmr-primitives = { workspace = true } # crates.io fortuples = "0.9.1" @@ -53,7 +56,10 @@ std = [ "sp-api/std", "serde/default", "pallet-balances/std", - "sp-consensus-aura/std" + "sp-consensus-aura/std", + "sp-mmr-primitives/std", + "pallet-mmr/std", + "mmr-primitives/std" ] disable-panic-handler = ["sp-io/disable_panic_handler", "sp-io/disable_oom", "sp-io/disable_allocator"] diff --git a/modules/ismp/pallet/relayer/src/lib.rs b/modules/ismp/pallet/relayer/src/lib.rs index 80393125f..0442bd050 100644 --- a/modules/ismp/pallet/relayer/src/lib.rs +++ b/modules/ismp/pallet/relayer/src/lib.rs @@ -43,7 +43,11 @@ use ismp::{ router::{DispatchPost, DispatchRequest, IsmpDispatcher}, }; pub use pallet::*; -use pallet_ismp::{dispatcher::Dispatcher, host::Host}; +use pallet_ismp::{ + child_trie::{RequestCommitments, ResponseCommitments}, + dispatcher::Dispatcher, + host::Host, +}; use pallet_ismp_host_executive::HostParams; use sp_core::U256; use sp_runtime::DispatchError; @@ -87,11 +91,6 @@ pub mod pallet { pub type Nonce = StorageDoubleMap<_, Twox64Concat, Vec, Twox64Concat, StateMachine, u64, ValueQuery>; - /// Request and response commitments that have been claimed - #[pallet::storage] - #[pallet::getter(fn claimed)] - pub type Claimed = StorageMap<_, Identity, H256, bool, ValueQuery>; - #[pallet::error] pub enum Error { /// Withdrawal Proof Validation Error @@ -338,9 +337,22 @@ where .commitments .into_iter() .filter(|key| match key { - Key::Request(req) => !Claimed::::contains_key(req), - Key::Response { response_commitment, .. } => - !Claimed::::contains_key(&response_commitment), + Key::Request(req) => { + match RequestCommitments::::get(*req) { + Some(leaf_meta) => !leaf_meta.meta.claimed, + // If request commitment does not exist in storage which should not be + // possible, we skip it + None => false, + } + }, + Key::Response { response_commitment, .. } => { + match ResponseCommitments::::get(*response_commitment) { + Some(leaf_meta) => !leaf_meta.meta.claimed, + // If request commitment does not exist in storage which should not be + // possible, we skip it + None => false, + } + }, }) .collect(); ensure!(!withdrawal_proof.commitments.is_empty(), Error::::MissingCommitments); @@ -369,7 +381,7 @@ where &withdrawal_proof.dest_proof, dest_keys.clone().into_iter().chain(slot_2_keys).collect(), )?; - let (result, commitments) = Self::validate_results( + let (result, claimed_commitments) = Self::validate_results( &withdrawal_proof, source_keys, dest_keys, @@ -386,8 +398,35 @@ where }); } - for commitment in commitments { - Claimed::::insert(commitment, true) + for key in withdrawal_proof.commitments { + match key { + Key::Request(req) => { + if !claimed_commitments.contains(&req) { + continue + } + match RequestCommitments::::get(req) { + Some(mut leaf_meta) => { + leaf_meta.meta.claimed = true; + RequestCommitments::::insert(req, leaf_meta) + }, + // Unreachable + None => {}, + } + }, + Key::Response { response_commitment, .. } => { + if !claimed_commitments.contains(&response_commitment) { + continue + } + match ResponseCommitments::::get(response_commitment) { + Some(mut leaf_meta) => { + leaf_meta.meta.claimed = true; + ResponseCommitments::::insert(response_commitment, leaf_meta); + }, + // Unreachable + None => {}, + } + }, + } } for address in result.keys().collect::>().into_iter() { @@ -435,9 +474,8 @@ where StateMachine::Polkadot(_) | StateMachine::Kusama(_) | StateMachine::Grandpa(_) | - StateMachine::Beefy(_) => keys.push( - pallet_ismp::child_trie::RequestCommitments::::storage_key(*commitment), - ), + StateMachine::Beefy(_) => + keys.push(RequestCommitments::::storage_key(*commitment)), }, Key::Response { response_commitment, .. } => { match proof.source_proof.height.id.state_id { @@ -454,11 +492,8 @@ where StateMachine::Polkadot(_) | StateMachine::Kusama(_) | StateMachine::Grandpa(_) | - StateMachine::Beefy(_) => keys.push( - pallet_ismp::child_trie::ResponseCommitments::::storage_key( - *response_commitment, - ), - ), + StateMachine::Beefy(_) => + keys.push(ResponseCommitments::::storage_key(*response_commitment)), } }, } diff --git a/modules/ismp/pallet/rpc/Cargo.toml b/modules/ismp/pallet/rpc/Cargo.toml index bf2ca1fde..afa37c6f7 100644 --- a/modules/ismp/pallet/rpc/Cargo.toml +++ b/modules/ismp/pallet/rpc/Cargo.toml @@ -18,6 +18,7 @@ serde_json = "1.0.45" ismp = { workspace = true, default-features = true } pallet-ismp = { workspace = true, default-features = true } pallet-ismp-runtime-api = { workspace = true, default-features = true } +sp-mmr-primitives = { workspace = true, default-features = true } frame-system = { workspace = true, default-features = true } sc-client-api = { workspace = true, default-features = true } diff --git a/modules/ismp/pallet/rpc/src/lib.rs b/modules/ismp/pallet/rpc/src/lib.rs index 40c8f7961..b154014d0 100644 --- a/modules/ismp/pallet/rpc/src/lib.rs +++ b/modules/ismp/pallet/rpc/src/lib.rs @@ -31,7 +31,7 @@ use ismp::{ }; use pallet_ismp::{ child_trie::CHILD_TRIE_PREFIX, - mmr::primitives::{Leaf, NodeIndex}, + mmr::Leaf, primitives::{LeafIndexAndPos, LeafIndexQuery}, ProofKeys, }; @@ -44,6 +44,7 @@ use sp_core::{ offchain::{storage::OffchainDb, OffchainDbExt, OffchainStorage}, H256, }; +use sp_mmr_primitives::NodeIndex; use sp_runtime::traits::{Block as BlockT, Hash, Header}; use sp_trie::LayoutV0; use std::{collections::HashMap, fmt::Display, sync::Arc}; diff --git a/modules/ismp/pallet/runtime-api/Cargo.toml b/modules/ismp/pallet/runtime-api/Cargo.toml index bffe28068..da3a828f3 100644 --- a/modules/ismp/pallet/runtime-api/Cargo.toml +++ b/modules/ismp/pallet/runtime-api/Cargo.toml @@ -14,13 +14,10 @@ sp-core = { workspace = true } pallet-ismp = { path = "..", default-features = false } ismp = { package = "ismp", path = "../../core", default-features = false } serde = { version = "1.0.136", features = ["derive"], optional = true } +sp-mmr-primitives = { workspace = true } +codec = { workspace = true, features = ["derive"] } -[dependencies.codec] -package = "parity-scale-codec" -version = "3.0.0" -features = ["derive"] -default-features = false [features] default = ['std'] -std = ['sp-api/std', 'sp-std/std', 'codec/std', "pallet-ismp/std", "ismp/std", "serde", "sp-core/std"] +std = ['sp-api/std', 'sp-std/std', 'codec/std', "pallet-ismp/std", "ismp/std", "serde", "sp-core/std", "sp-mmr-primitives/std"] diff --git a/modules/ismp/pallet/runtime-api/src/lib.rs b/modules/ismp/pallet/runtime-api/src/lib.rs index e4cf6187b..eee896d89 100644 --- a/modules/ismp/pallet/runtime-api/src/lib.rs +++ b/modules/ismp/pallet/runtime-api/src/lib.rs @@ -22,24 +22,15 @@ use ismp::{ consensus::{ConsensusClientId, StateMachineId}, router::{Request, Response}, }; -use pallet_ismp::{ - mmr::primitives::{Leaf, LeafIndex}, - primitives::{Error, Proof}, - ProofKeys, -}; +use pallet_ismp::{mmr::Leaf, primitives::Proof, ProofKeys}; use sp_core::H256; +use sp_mmr_primitives::Error; #[cfg(not(feature = "std"))] use sp_std::vec::Vec; sp_api::decl_runtime_apis! { /// ISMP Runtime Apis pub trait IsmpRuntimeApi { - /// Return the number of MMR leaves. - fn mmr_leaf_count() -> Result; - - /// Return the on-chain MMR root hash. - fn mmr_root() -> Result; - /// Generate a proof for the provided leaf indices fn generate_proof( commitments: ProofKeys diff --git a/modules/ismp/pallet/src/child_trie.rs b/modules/ismp/pallet/src/child_trie.rs index 118206576..99e32c956 100644 --- a/modules/ismp/pallet/src/child_trie.rs +++ b/modules/ismp/pallet/src/child_trie.rs @@ -4,7 +4,7 @@ use alloc::vec::Vec; use core::marker::PhantomData; use frame_support::storage::child; -use sp_core::{storage::ChildInfo, H256}; +pub use sp_core::{storage::ChildInfo, H256}; use crate::{dispatcher::LeafMetadata, Config, ResponseReceipt}; diff --git a/modules/ismp/pallet/src/dispatcher.rs b/modules/ismp/pallet/src/dispatcher.rs index 2e0e2b114..bfd345026 100644 --- a/modules/ismp/pallet/src/dispatcher.rs +++ b/modules/ismp/pallet/src/dispatcher.rs @@ -34,7 +34,7 @@ pub enum Receipt { } /// Queries a request leaf in the mmr -#[derive(codec::Encode, codec::Decode, scale_info::TypeInfo)] +#[derive(codec::Encode, codec::Decode, scale_info::TypeInfo, Clone)] #[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] #[scale_info(skip_type_params(T))] pub struct LeafMetadata { @@ -45,7 +45,7 @@ pub struct LeafMetadata { } /// This is used for tracking user fee payments for requests -#[derive(codec::Encode, codec::Decode, scale_info::TypeInfo)] +#[derive(codec::Encode, codec::Decode, scale_info::TypeInfo, Clone)] #[scale_info(skip_type_params(T))] #[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] pub struct FeeMetadata { @@ -53,6 +53,8 @@ pub struct FeeMetadata { pub origin: T::AccountId, /// The amount they paid pub fee: T::Balance, + /// Has fee been claimed? + pub claimed: bool, } /// The dispatcher commits outgoing requests and responses to the mmr @@ -116,7 +118,7 @@ where }, }; - Pallet::::dispatch_request(request, FeeMetadata { origin, fee })?; + Pallet::::dispatch_request(request, FeeMetadata { origin, fee, claimed: false })?; Ok(()) } @@ -133,7 +135,7 @@ where } let response = Response::Post(response); - Pallet::::dispatch_response(response, FeeMetadata { origin, fee })?; + Pallet::::dispatch_response(response, FeeMetadata { origin, fee, claimed: false })?; Ok(()) } diff --git a/modules/ismp/pallet/src/handlers.rs b/modules/ismp/pallet/src/handlers.rs deleted file mode 100644 index 2be099055..000000000 --- a/modules/ismp/pallet/src/handlers.rs +++ /dev/null @@ -1,76 +0,0 @@ -//! Some extra utilities for pallet-ismp - -use crate::{ - child_trie::{RequestCommitments, ResponseCommitments}, - dispatcher::{FeeMetadata, LeafMetadata}, - host::Host, - mmr::primitives::Leaf, - Config, Event, Pallet, Responded, -}; -use alloc::string::ToString; -use ismp::{ - error::Error as IsmpError, - router::{Request, Response}, - util::{hash_request, hash_response}, -}; - -impl Pallet { - /// Dispatch an outgoing request - pub fn dispatch_request(request: Request, meta: FeeMetadata) -> Result<(), IsmpError> { - let commitment = hash_request::>(&request); - - if RequestCommitments::::contains_key(commitment) { - Err(IsmpError::ImplementationSpecific("Duplicate request".to_string()))? - } - - let (dest_chain, source_chain, nonce) = - (request.dest_chain(), request.source_chain(), request.nonce()); - let leaf_index_and_pos = - Pallet::::mmr_push(Leaf::Request(request)).ok_or_else(|| { - IsmpError::ImplementationSpecific("Failed to push request into mmr".to_string()) - })?; - // Deposit Event - Pallet::::deposit_event(Event::Request { - request_nonce: nonce, - source_chain, - dest_chain, - commitment, - }); - - RequestCommitments::::insert(commitment, LeafMetadata { mmr: leaf_index_and_pos, meta }); - - Ok(()) - } - - /// Dispatch an outgoing response - pub fn dispatch_response(response: Response, meta: FeeMetadata) -> Result<(), IsmpError> { - let req_commitment = hash_request::>(&response.request()); - - if Responded::::contains_key(req_commitment) { - Err(IsmpError::ImplementationSpecific("Request has been responded to".to_string()))? - } - - let commitment = hash_response::>(&response); - - let (dest_chain, source_chain, nonce) = - (response.dest_chain(), response.source_chain(), response.nonce()); - - let leaf_index_and_pos = - Pallet::::mmr_push(Leaf::Response(response)).ok_or_else(|| { - IsmpError::ImplementationSpecific("Failed to push response into mmr".to_string()) - })?; - - Pallet::::deposit_event(Event::Response { - request_nonce: nonce, - dest_chain, - source_chain, - commitment, - }); - ResponseCommitments::::insert( - commitment, - LeafMetadata { mmr: leaf_index_and_pos, meta }, - ); - Responded::::insert(req_commitment, true); - Ok(()) - } -} diff --git a/modules/ismp/pallet/src/host.rs b/modules/ismp/pallet/src/host.rs index ae9e78689..23a806df7 100644 --- a/modules/ismp/pallet/src/host.rs +++ b/modules/ismp/pallet/src/host.rs @@ -16,12 +16,14 @@ //! Host implementation for ISMP use crate::{ child_trie::{RequestCommitments, RequestReceipts, ResponseCommitments, ResponseReceipts}, + dispatcher::LeafMetadata, primitives::ConsensusClientProvider, ChallengePeriod, Config, ConsensusClientUpdateTime, ConsensusStateClient, ConsensusStates, FrozenConsensusClients, FrozenStateMachine, LatestStateMachineHeight, Nonce, Responded, ResponseReceipt, StateCommitments, StateMachineUpdateTime, UnbondingPeriod, }; use alloc::{format, string::ToString}; +use codec::{Decode, Encode}; use core::time::Duration; use frame_support::traits::{Get, UnixTime}; use ismp::{ @@ -228,33 +230,44 @@ impl IsmpHost for Host { Ok(()) } - fn delete_request_commitment(&self, req: &Request) -> Result<(), Error> { + fn delete_request_commitment(&self, req: &Request) -> Result, Error> { let hash = hash_request::(req); // We can't delete actual leaves in the mmr so this serves as a replacement for that + let meta = RequestCommitments::::get(hash).ok_or_else(|| { + Error::ImplementationSpecific("Request Commitment not found".to_string()) + })?; RequestCommitments::::remove(hash); - Ok(()) + Ok(meta.encode()) } - fn delete_response_commitment(&self, res: &PostResponse) -> Result<(), Error> { + fn delete_response_commitment(&self, res: &PostResponse) -> Result, Error> { let req_commitment = hash_request::(&res.request()); let hash = hash_post_response::(res); - + let meta = ResponseCommitments::::get(hash).ok_or_else(|| { + Error::ImplementationSpecific("Response Commitment not found".to_string()) + })?; // We can't delete actual leaves in the mmr so this serves as a replacement for that ResponseCommitments::::remove(hash); Responded::::remove(req_commitment); - Ok(()) + Ok(meta.encode()) } - fn delete_request_receipt(&self, req: &Request) -> Result<(), Error> { + fn delete_request_receipt(&self, req: &Request) -> Result, Error> { let req_commitment = hash_request::(req); + let relayer = RequestReceipts::::get(req_commitment).ok_or_else(|| { + Error::ImplementationSpecific("Request receipt not found".to_string()) + })?; RequestReceipts::::remove(req_commitment); - Ok(()) + Ok(relayer) } - fn delete_response_receipt(&self, res: &PostResponse) -> Result<(), Error> { + fn delete_response_receipt(&self, res: &Response) -> Result, Error> { let hash = hash_request::(&res.request()); + let meta = ResponseReceipts::::get(hash).ok_or_else(|| { + Error::ImplementationSpecific("Response receipt not found".to_string()) + })?; ResponseReceipts::::remove(hash); - Ok(()) + Ok(meta.relayer) } fn store_request_receipt(&self, req: &Request, signer: &Vec) -> Result<(), Error> { @@ -303,6 +316,26 @@ impl IsmpHost for Host { FrozenStateMachine::::insert(state_machine, true); Ok(()) } + + fn store_request_commitment(&self, req: &Request, meta: Vec) -> Result<(), Error> { + let hash = hash_request::(req); + let leaf_meta = LeafMetadata::::decode(&mut &*meta).map_err(|_| { + Error::ImplementationSpecific("Failed to decode leaf metadata".to_string()) + })?; + RequestCommitments::::insert(hash, leaf_meta); + Ok(()) + } + + fn store_response_commitment(&self, res: &PostResponse, meta: Vec) -> Result<(), Error> { + let hash = hash_post_response::(res); + let req_commitment = hash_request::(&res.request()); + let leaf_meta = LeafMetadata::::decode(&mut &*meta).map_err(|_| { + Error::ImplementationSpecific("Failed to decode leaf metadata".to_string()) + })?; + ResponseCommitments::::insert(hash, leaf_meta); + Responded::::insert(req_commitment, true); + Ok(()) + } } impl ismp::util::Keccak256 for Host { diff --git a/modules/ismp/pallet/src/impls.rs b/modules/ismp/pallet/src/impls.rs new file mode 100644 index 000000000..7557efff7 --- /dev/null +++ b/modules/ismp/pallet/src/impls.rs @@ -0,0 +1,218 @@ +use crate::{ + child_trie::{RequestCommitments, ResponseCommitments}, + dispatcher::{FeeMetadata, LeafMetadata}, + errors::HandlingError, + events::deposit_ismp_events, + host::Host, + mmr::Leaf, + primitives::{LeafIndexAndPos, Proof}, + weight_info::get_weight, + ChallengePeriod, Config, ConsensusClientUpdateTime, ConsensusStates, Event, + LatestStateMachineHeight, Pallet, ProofKeys, Responded, WeightConsumed, +}; +use alloc::{string::ToString, vec, vec::Vec}; +use frame_support::dispatch::{DispatchResultWithPostInfo, Pays, PostDispatchInfo}; +use ismp::{ + consensus::{ConsensusClientId, StateMachineId}, + handlers::{handle_incoming_message, MessageResult}, + messaging::Message, + router::{Request, Response}, + util::{hash_request, hash_response}, +}; +use log::debug; +use mmr_primitives::MerkleMountainRangeTree; +use sp_core::H256; + +impl Pallet { + /// Generate an MMR proof for the given `leaf_indices`. + /// Note this method can only be used from an off-chain context + /// (Offchain Worker or Runtime API call), since it requires + /// all the leaves to be present. + /// It may return an error or panic if used incorrectly. + pub fn generate_proof( + keys: ProofKeys, + ) -> Result<(Vec, Proof), sp_mmr_primitives::Error> { + let leaf_indices_and_positions = match keys { + ProofKeys::Requests(commitments) => commitments + .into_iter() + .map(|commitment| { + let val = RequestCommitments::::get(commitment) + .ok_or_else(|| sp_mmr_primitives::Error::LeafNotFound)? + .mmr; + Ok(val) + }) + .collect::, _>>()?, + ProofKeys::Responses(commitments) => commitments + .into_iter() + .map(|commitment| { + let val = ResponseCommitments::::get(commitment) + .ok_or_else(|| sp_mmr_primitives::Error::LeafNotFound)? + .mmr; + Ok(val) + }) + .collect::, _>>()?, + }; + let indices = + leaf_indices_and_positions.iter().map(|val| val.leaf_index).collect::>(); + let (leaves, proof) = T::Mmr::generate_proof(indices)?; + let proof = Proof { + leaf_positions: leaf_indices_and_positions, + leaf_count: proof.leaf_count, + items: proof.items, + }; + + Ok((leaves.into_iter().map(|leaf| leaf.into()).collect(), proof)) + } + + /// Provides a way to handle messages. + pub fn handle_messages(messages: Vec) -> DispatchResultWithPostInfo { + // Define a host + WeightConsumed::::kill(); + let host = Host::::default(); + let mut errors: Vec = vec![]; + let total_weight = get_weight::(&messages); + for message in messages { + match handle_incoming_message(&host, message.clone()) { + Ok(MessageResult::ConsensusMessage(res)) => deposit_ismp_events::( + res.into_iter().map(|ev| Ok(ev)).collect(), + &mut errors, + ), + Ok(MessageResult::Response(res)) => deposit_ismp_events::(res, &mut errors), + Ok(MessageResult::Request(res)) => deposit_ismp_events::(res, &mut errors), + Ok(MessageResult::Timeout(res)) => deposit_ismp_events::(res, &mut errors), + Ok(MessageResult::FrozenClient(id)) => + Self::deposit_event(Event::::ConsensusClientFrozen { + consensus_client_id: id, + }), + Err(err) => { + errors.push(err.into()); + }, + } + } + + if !errors.is_empty() { + debug!(target: "ismp", "Handling Errors {:?}", errors); + Self::deposit_event(Event::::Errors { errors }) + } + + Ok(PostDispatchInfo { + actual_weight: { + let acc_weight = WeightConsumed::::get(); + Some((total_weight - acc_weight.weight_limit) + acc_weight.weight_used) + }, + pays_fee: Pays::Yes, + }) + } + + /// Dispatch an outgoing request + pub fn dispatch_request(request: Request, meta: FeeMetadata) -> Result<(), ismp::Error> { + let commitment = hash_request::>(&request); + + if RequestCommitments::::contains_key(commitment) { + Err(ismp::Error::ImplementationSpecific("Duplicate request".to_string()))? + } + + let (dest_chain, source_chain, nonce) = + (request.dest_chain(), request.source_chain(), request.nonce()); + let leaf_index_and_pos = T::Mmr::push(Leaf::Request(request)); + // Deposit Event + Pallet::::deposit_event(Event::Request { + request_nonce: nonce, + source_chain, + dest_chain, + commitment, + }); + + RequestCommitments::::insert( + commitment, + LeafMetadata { + mmr: LeafIndexAndPos { + leaf_index: leaf_index_and_pos.index, + pos: leaf_index_and_pos.position, + }, + meta, + }, + ); + + Ok(()) + } + + /// Dispatch an outgoing response + pub fn dispatch_response(response: Response, meta: FeeMetadata) -> Result<(), ismp::Error> { + let req_commitment = hash_request::>(&response.request()); + + if Responded::::contains_key(req_commitment) { + Err(ismp::Error::ImplementationSpecific("Request has been responded to".to_string()))? + } + + let commitment = hash_response::>(&response); + + let (dest_chain, source_chain, nonce) = + (response.dest_chain(), response.source_chain(), response.nonce()); + + let leaf_index_and_pos = T::Mmr::push(Leaf::Response(response)); + + Pallet::::deposit_event(Event::Response { + request_nonce: nonce, + dest_chain, + source_chain, + commitment, + }); + ResponseCommitments::::insert( + commitment, + LeafMetadata { + mmr: LeafIndexAndPos { + leaf_index: leaf_index_and_pos.index, + pos: leaf_index_and_pos.position, + }, + meta, + }, + ); + Responded::::insert(req_commitment, true); + Ok(()) + } + + /// Gets the request from the offchain storage + pub fn get_request(commitment: H256) -> Option { + let pos = RequestCommitments::::get(commitment)?.mmr.pos; + let Ok(Some(Leaf::Request(req))) = T::Mmr::get_leaf(pos) else { None? }; + Some(req) + } + + /// Gets the response from the offchain storage + pub fn get_response(commitment: H256) -> Option { + let pos = ResponseCommitments::::get(commitment)?.mmr.pos; + let Ok(Some(Leaf::Response(res))) = T::Mmr::get_leaf(pos) else { None? }; + Some(res) + } + + /// Return the scale encoded consensus state + pub fn get_consensus_state(id: ConsensusClientId) -> Option> { + ConsensusStates::::get(id) + } + + /// Return the timestamp this client was last updated in seconds + pub fn get_consensus_update_time(id: ConsensusClientId) -> Option { + ConsensusClientUpdateTime::::get(id) + } + + /// Return the challenge period + pub fn get_challenge_period(id: ConsensusClientId) -> Option { + ChallengePeriod::::get(id) + } + + /// Return the latest height of the state machine + pub fn get_latest_state_machine_height(id: StateMachineId) -> Option { + Some(LatestStateMachineHeight::::get(id)) + } + + /// Get actual requests + pub fn get_requests(commitments: Vec) -> Vec { + commitments.into_iter().filter_map(|cm| Self::get_request(cm)).collect() + } + + /// Get actual requests + pub fn get_responses(commitments: Vec) -> Vec { + commitments.into_iter().filter_map(|cm| Self::get_response(cm)).collect() + } +} diff --git a/modules/ismp/pallet/src/lib.rs b/modules/ismp/pallet/src/lib.rs index 46cb535bd..5ed536f2f 100644 --- a/modules/ismp/pallet/src/lib.rs +++ b/modules/ismp/pallet/src/lib.rs @@ -25,45 +25,34 @@ extern crate core; pub mod dispatcher; mod errors; pub mod events; -pub mod handlers; pub mod host; pub mod mmr; -use events::deposit_ismp_events; pub use mmr::ProofKeys; pub mod child_trie; +mod impls; pub mod primitives; pub mod weight_info; -pub use mmr::utils::NodesUtils; +pub use sp_mmr_primitives::utils::NodesUtils; use crate::host::Host; use codec::{Decode, Encode}; use frame_support::{ - dispatch::{DispatchResult, DispatchResultWithPostInfo, Pays, PostDispatchInfo}, + dispatch::{DispatchResult, DispatchResultWithPostInfo}, traits::Get, }; use ismp::{ - consensus::{ConsensusClientId, StateMachineId}, handlers::{handle_incoming_message, MessageResult}, messaging::CreateConsensusState, - router::{Request, Response}, + router::Request, util::hash_request, }; -use log::debug; -use sp_core::{offchain::StorageKind, H256}; +use sp_core::H256; // Re-export pallet items so that they can be accessed from the crate namespace. -use crate::{ - errors::HandlingError, - mmr::{ - primitives::{DataOrHash, Leaf, LeafIndex, NodeIndex}, - Mmr, - }, - primitives::LeafIndexAndPos, - weight_info::get_weight, -}; +use crate::{mmr::Leaf, weight_info::get_weight}; use frame_system::pallet_prelude::BlockNumberFor; -use ismp::{host::IsmpHost, messaging::Message}; -use merkle_mountain_range::leaf_index_to_pos; +use ismp::host::IsmpHost; +use mmr_primitives::MerkleMountainRangeTree; pub use pallet::*; use sp_runtime::{ traits::ValidateUnsigned, @@ -71,7 +60,6 @@ use sp_runtime::{ InvalidTransaction, TransactionLongevity, TransactionSource, TransactionValidity, TransactionValidityError, ValidTransaction, }, - RuntimeDebug, }; use sp_std::prelude::*; @@ -87,7 +75,6 @@ pub mod pallet { use crate::{ child_trie::CHILD_TRIE_PREFIX, errors::HandlingError, - mmr::primitives::{LeafIndex, NodeIndex}, primitives::{ConsensusClientProvider, WeightUsed, ISMP_ID}, weight_info::WeightProvider, }; @@ -111,9 +98,6 @@ pub mod pallet { /// The overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Prefix for elements stored in the Off-chain DB via Indexing API - const INDEXING_PREFIX: &'static [u8]; - /// Admin origin for privileged actions type AdminOrigin: EnsureOrigin; @@ -134,6 +118,9 @@ pub mod pallet { /// Weight provider for consensus clients and module callbacks type WeightProvider: WeightProvider; + + /// Mmr Implementation + type Mmr: MerkleMountainRangeTree; } // Simple declaration of the `Pallet` type. It is placeholder we use to implement traits and @@ -142,24 +129,6 @@ pub mod pallet { #[pallet::without_storage_info] pub struct Pallet(_); - /// Latest MMR Root hash - #[pallet::storage] - #[pallet::getter(fn mmr_root_hash)] - pub type RootHash = StorageValue<_, H256, ValueQuery>; - - /// Current size of the MMR (number of leaves) for requests. - #[pallet::storage] - #[pallet::getter(fn number_of_leaves)] - pub type NumberOfLeaves = StorageValue<_, LeafIndex, ValueQuery>; - - /// Hashes of the nodes in the MMR for requests. - /// - /// Note this collection only contains MMR peaks, the inner nodes (and leaves) - /// are pruned and only stored in the Offchain DB. - #[pallet::storage] - #[pallet::getter(fn request_peaks)] - pub type Nodes = StorageMap<_, Identity, NodeIndex, H256, OptionQuery>; - /// Holds a map of state machine heights to their verified state commitments #[pallet::storage] #[pallet::getter(fn state_commitments)] @@ -238,83 +207,17 @@ pub mod pallet { #[pallet::getter(fn weight_consumed)] pub type WeightConsumed = StorageValue<_, WeightUsed, ValueQuery>; - /// Mmr positions to commitments - #[pallet::storage] - #[pallet::getter(fn mmr_positions)] - pub type MmrPositions = - StorageMap<_, Blake2_128Concat, NodeIndex, H256, OptionQuery>; - - /// Temporary leaf storage for when the block is still executing - #[pallet::storage] - #[pallet::getter(fn intermediate_leaves)] - pub type IntermediateLeaves = - CountedStorageMap<_, Blake2_128Concat, NodeIndex, Leaf, OptionQuery>; - - /// Temporary store to increment the leaf index as the block is executed - #[pallet::storage] - #[pallet::getter(fn intermediate_number_of_leaves)] - pub type IntermediateNumberOfLeaves = StorageValue<_, LeafIndex, ValueQuery>; - // Pallet implements [`Hooks`] trait to define some logic to execute in some context. #[pallet::hooks] impl Hooks> for Pallet { - fn on_initialize(_n: BlockNumberFor) -> Weight { - IntermediateNumberOfLeaves::::put(Self::number_of_leaves()); - Weight::default() - } - fn on_finalize(_n: BlockNumberFor) { // Only finalize if mmr was modified - let leaves = Self::intermediate_number_of_leaves(); - let root = if leaves != 0 { - let mut mmr: Mmr = - Mmr::new(Self::number_of_leaves()); - let range = Self::number_of_leaves()..leaves; - for index in range { - let leaf = IntermediateLeaves::::get(index) - .expect("Infallible: Leaf was inserted in this block"); - // Mmr push should never fail - match mmr.push(leaf) { - None => { - log::error!(target: "ismp::mmr", "MMR push failed "); - }, - Some(position) => { - log::trace!(target: "ismp::mmr", "MMR push {position}"); - }, - } - } - - // Update the size, `mmr.commit()` should also never fail. - match mmr.commit() { - Ok(_) => { - log::trace!(target: "ismp::mmr", "Committed to mmr, No of leaves: {leaves}"); - }, - Err(e) => { - log::error!(target: "ismp::mmr", "MMR finalize failed: {:?}", e); - return; - }, - } - - // Calculate the mmr's new root - let mmr: Mmr = Mmr::new(leaves); - // Update the size, `mmr.finalize()` should also never fail. - let root = match mmr.finalize() { - Ok(root) => root, - Err(e) => { - log::error!(target: "ismp::mmr", "MMR finalize failed: {:?}", e); - return; - }, - }; - - // Insert root in storage - >::put(root); - // Clear intermediate values - let total = IntermediateLeaves::::count(); - let _ = IntermediateLeaves::::clear(total, None); - IntermediateNumberOfLeaves::::kill(); - root - } else { - H256::default() + let root = match T::Mmr::finalize() { + Ok(root) => root, + Err(e) => { + log::error!(target:"ismp", "Failed to finalize MMR {e:?}"); + return + }, }; let child_trie_root = frame_support::storage::child::root( @@ -324,14 +227,12 @@ pub mod pallet { let log = IsmpConsensusLog { child_trie_root: H256::from_slice(&child_trie_root), - mmr_root: root, + mmr_root: root.into(), }; let digest = sp_runtime::generic::DigestItem::Consensus(ISMP_ID, log.encode()); >::deposit_log(digest); } - - fn offchain_worker(_n: BlockNumberFor) {} } /// Params to update the unbonding period for a consensus state @@ -593,167 +494,3 @@ pub struct ResponseReceipt { /// Address of the relayer pub relayer: Vec, } - -/// Digest log for mmr root hash -#[derive(RuntimeDebug, Encode, Decode)] -pub struct RequestResponseLog { - /// The mmr root hash - mmr_root_hash: ::Hash, -} - -impl Pallet { - /// Generate an MMR proof for the given `leaf_indices`. - /// Note this method can only be used from an off-chain context - /// (Offchain Worker or Runtime API call), since it requires - /// all the leaves to be present. - /// It may return an error or panic if used incorrectly. - pub fn generate_proof( - commitments: ProofKeys, - ) -> Result<(Vec, primitives::Proof), primitives::Error> { - let leaves_count = NumberOfLeaves::::get(); - let mmr = Mmr::::new(leaves_count); - mmr.generate_proof(commitments) - } - - /// Provides a way to handle messages. - pub fn handle_messages(messages: Vec) -> DispatchResultWithPostInfo { - // Define a host - WeightConsumed::::kill(); - let host = Host::::default(); - let mut errors: Vec = vec![]; - let total_weight = get_weight::(&messages); - for message in messages { - match handle_incoming_message(&host, message.clone()) { - Ok(MessageResult::ConsensusMessage(res)) => deposit_ismp_events::( - res.into_iter().map(|ev| Ok(ev)).collect(), - &mut errors, - ), - Ok(MessageResult::Response(res)) => deposit_ismp_events::(res, &mut errors), - Ok(MessageResult::Request(res)) => deposit_ismp_events::(res, &mut errors), - Ok(MessageResult::Timeout(res)) => deposit_ismp_events::(res, &mut errors), - Ok(MessageResult::FrozenClient(id)) => - Self::deposit_event(Event::::ConsensusClientFrozen { - consensus_client_id: id, - }), - Err(err) => { - errors.push(err.into()); - }, - } - } - - if !errors.is_empty() { - debug!(target: "ismp", "Handling Errors {:?}", errors); - Self::deposit_event(Event::::Errors { errors }) - } - - Ok(PostDispatchInfo { - actual_weight: { - let acc_weight = WeightConsumed::::get(); - Some((total_weight - acc_weight.weight_limit) + acc_weight.weight_used) - }, - pays_fee: Pays::Yes, - }) - } - - /// Return the on-chain MMR root hash. - pub fn mmr_root() -> H256 { - Self::mmr_root_hash() - } - - /// Return mmr leaf count - pub fn mmr_leaf_count() -> LeafIndex { - Self::number_of_leaves() - } - /// Get a node from runtime storage - fn get_node(pos: NodeIndex) -> Option { - Nodes::::get(pos).map(DataOrHash::Hash) - } - - /// Insert a node into storage - fn insert_node(pos: NodeIndex, node: H256) { - Nodes::::insert(pos, node) - } - - /// Set the number of leaves in the mmr - fn set_num_leaves(num_leaves: LeafIndex) { - NumberOfLeaves::::put(num_leaves) - } - - /// Returns the offchain key for a request or response leaf index - pub fn full_leaf_offchain_key(commitment: H256) -> Vec { - (T::INDEXING_PREFIX, commitment).encode() - } - - /// Gets the request from the offchain storage - pub fn get_request(commitment: H256) -> Option { - let key = Pallet::::full_leaf_offchain_key(commitment); - if let Some(elem) = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, &key) { - let data_or_hash = DataOrHash::decode(&mut &*elem).ok()?; - return match data_or_hash { - DataOrHash::Data(leaf) => match leaf { - Leaf::Request(req) => Some(req), - _ => None, - }, - _ => None, - }; - } - None - } - - /// Gets the response from the offchain storage - pub fn get_response(commitment: H256) -> Option { - let key = Pallet::::full_leaf_offchain_key(commitment); - if let Some(elem) = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, &key) { - let data_or_hash = DataOrHash::decode(&mut &*elem).ok()?; - return match data_or_hash { - DataOrHash::Data(leaf) => match leaf { - Leaf::Response(res) => Some(res), - _ => None, - }, - _ => None, - }; - } - None - } - - /// Return the scale encoded consensus state - pub fn get_consensus_state(id: ConsensusClientId) -> Option> { - ConsensusStates::::get(id) - } - - /// Return the timestamp this client was last updated in seconds - pub fn get_consensus_update_time(id: ConsensusClientId) -> Option { - ConsensusClientUpdateTime::::get(id) - } - - /// Return the challenge period - pub fn get_challenge_period(id: ConsensusClientId) -> Option { - ChallengePeriod::::get(id) - } - - /// Return the latest height of the state machine - pub fn get_latest_state_machine_height(id: StateMachineId) -> Option { - Some(LatestStateMachineHeight::::get(id)) - } - - /// Get actual requests - pub fn get_requests(commitments: Vec) -> Vec { - commitments.into_iter().filter_map(|cm| Self::get_request(cm)).collect() - } - - /// Get actual requests - pub fn get_responses(commitments: Vec) -> Vec { - commitments.into_iter().filter_map(|cm| Self::get_response(cm)).collect() - } - - /// Insert a leaf into the mmr and return the position and leaf index - pub(crate) fn mmr_push(leaf: Leaf) -> Option { - let commitment = leaf.hash::>(); - let leaf_index = Pallet::::intermediate_number_of_leaves(); - IntermediateLeaves::::insert(leaf_index, leaf); - let pos = leaf_index_to_pos(leaf_index); - IntermediateNumberOfLeaves::::put(leaf_index + 1); - MmrPositions::::insert(pos, commitment); - Some(LeafIndexAndPos { pos, leaf_index }) - } -} diff --git a/modules/ismp/pallet/src/mmr.rs b/modules/ismp/pallet/src/mmr.rs index 707884e83..4e28bd7c8 100644 --- a/modules/ismp/pallet/src/mmr.rs +++ b/modules/ismp/pallet/src/mmr.rs @@ -14,72 +14,30 @@ // limitations under the License. //! Mmr utilities -pub mod primitives; -pub(crate) mod storage; -pub(crate) mod utils; - -use crate::{ - child_trie::{RequestCommitments, ResponseCommitments}, - host::Host, - mmr::{ - primitives::{DataOrHash, Leaf, MmrHasher, NodeIndex}, - storage::{OffchainStorage, RuntimeStorage, Storage}, - utils::NodesUtils, - }, - primitives::{Error, Proof}, - Config, Pallet, -}; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_core::H256; use sp_std::prelude::*; -/// A wrapper around an MMR library to expose limited functionality. -/// -/// Available functions depend on the storage kind ([Runtime](crate::mmr::storage::RuntimeStorage) -/// vs [Off-chain](crate::mmr::storage::OffchainStorage)). -pub(crate) struct Mmr -where - T: Config, - Storage: merkle_mountain_range::MMRStore, -{ - mmr: merkle_mountain_range::MMR>, Storage>, -} - -impl Mmr -where - T: Config, - Storage: merkle_mountain_range::MMRStore, -{ - /// Create a pointer to an existing MMR with given number of leaves. - pub fn new(leaves: NodeIndex) -> Self { - let size = NodesUtils::new(leaves).size(); - Self { mmr: merkle_mountain_range::MMR::new(size, Default::default()) } - } -} +use ismp::router::{Request, Response}; -/// Runtime specific MMR functions. -impl Mmr -where - T: Config, -{ - /// Push another item to the MMR - /// - /// Returns the element position (index). - pub fn push(&mut self, leaf: Leaf) -> Option { - let pos = self.mmr.push(DataOrHash::Data(leaf)).map_err(|_| Error::Push).ok()?; - Some(pos) - } +use mmr_primitives::FullLeaf; - /// Calculate the new MMR's root hash. - pub fn finalize(self) -> Result { - let root = self.mmr.get_root().map_err(|_| Error::GetRoot)?; - Ok(root.hash::>()) - } +/// A concrete Leaf for the MMR +#[derive(Debug, Clone, Encode, Decode, PartialEq, Eq, scale_info::TypeInfo)] +pub enum Leaf { + /// A request variant + Request(Request), + /// A response variant + Response(Response), +} - /// Commit the changes to the mmr - pub fn commit(self) -> Result<(), Error> { - self.mmr.commit().map_err(|_| Error::Commit) +impl FullLeaf for Leaf { + fn preimage(&self) -> Vec { + match self { + Leaf::Request(req) => req.encode(), + Leaf::Response(res) => res.encode(), + } } } @@ -92,56 +50,3 @@ pub enum ProofKeys { /// Response commitments Responses(Vec), } - -/// On-chain specific MMR functions. -impl Mmr -where - T: Config, -{ - /// Generate a proof for given leaf indices. - /// - /// Proof generation requires all the nodes (or their hashes) to be available in the storage. - /// (i.e. you can't run the function in the pruned storage). - pub fn generate_proof(&self, keys: ProofKeys) -> Result<(Vec, Proof), Error> { - let leaf_indices_and_positions = match keys { - ProofKeys::Requests(commitments) => commitments - .into_iter() - .map(|commitment| { - let val = RequestCommitments::::get(commitment) - .ok_or_else(|| Error::LeafNotFound)? - .mmr; - Ok(val) - }) - .collect::, _>>()?, - ProofKeys::Responses(commitments) => commitments - .into_iter() - .map(|commitment| { - let val = ResponseCommitments::::get(commitment) - .ok_or_else(|| Error::LeafNotFound)? - .mmr; - Ok(val) - }) - .collect::, _>>()?, - }; - let store = >::default(); - let positions = leaf_indices_and_positions.iter().map(|val| val.pos).collect::>(); - let leaves = positions - .iter() - .map(|pos| match merkle_mountain_range::MMRStore::get_elem(&store, *pos) { - Ok(Some(DataOrHash::Data(leaf))) => Ok(leaf), - _ => Err(Error::LeafNotFound), - }) - .collect::, Error>>()?; - log::trace!(target: "ismp::mmr", "Positions {:?}", positions); - let leaf_count = Pallet::::number_of_leaves(); - self.mmr - .gen_proof(positions) - .map_err(|_| Error::GenerateProof) - .map(|p| Proof { - leaf_positions: leaf_indices_and_positions, - leaf_count, - items: p.proof_items().iter().map(|x| x.hash::>()).collect(), - }) - .map(|p| (leaves, p)) - } -} diff --git a/modules/ismp/pallet/src/mmr/primitives.rs b/modules/ismp/pallet/src/mmr/primitives.rs deleted file mode 100644 index 39eec143c..000000000 --- a/modules/ismp/pallet/src/mmr/primitives.rs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (C) 2023 Polytope Labs. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains code adapted from https://github.com/paritytech/substrate/blob/master/frame/merkle-mountain-range/src/mmr/mod.rs - -//! MMR utilities - -use core::fmt::Formatter; - -use codec::{Decode, Encode}; -use ismp::{ - router::{Request, Response}, - util::{hash_request, hash_response, Keccak256}, -}; -use sp_core::H256; - -/// Index of a leaf in the MMR -pub type LeafIndex = u64; -/// Index of a node in the MMR -pub type NodeIndex = u64; - -/// A concrete Leaf for the MMR -#[derive(Debug, Clone, Decode, Encode, PartialEq, Eq, scale_info::TypeInfo)] -pub enum Leaf { - /// A request variant - Request(Request), - /// A response variant - Response(Response), -} - -impl Leaf { - /// Returns the hash of a leaf - pub fn hash(&self) -> H256 { - match self { - Leaf::Request(req) => hash_request::(req), - Leaf::Response(res) => hash_response::(res), - } - } -} - -/// An element representing either full data or its hash. -#[derive(Clone, PartialEq, Eq, Encode, Decode, scale_info::TypeInfo)] -pub enum DataOrHash { - /// Arbitrary data in its full form. - Data(Leaf), - /// A hash of some data. - Hash(H256), -} - -impl core::fmt::Debug for DataOrHash { - fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { - match self { - DataOrHash::Data(leaf) => f.debug_struct("DataOrHash").field("Data", leaf).finish(), - DataOrHash::Hash(hash) => f.debug_struct("DataOrHash").field("Hash", hash).finish(), - } - } -} - -impl From for DataOrHash { - fn from(l: Leaf) -> Self { - Self::Data(l) - } -} - -impl DataOrHash { - /// Retrieve a hash of this item. - /// - /// Depending on the node type it's going to either be a contained value for [DataOrHash::Hash] - /// node, or a hash of SCALE-encoded [DataOrHash::Data] data. - pub fn hash(&self) -> H256 { - match *self { - Self::Data(ref leaf) => leaf.hash::(), - Self::Hash(ref hash) => *hash, - } - } -} - -/// Default Merging & Hashing behavior for MMR. -#[derive(Default)] -pub struct MmrHasher(core::marker::PhantomData); - -impl merkle_mountain_range::Merge for MmrHasher -where - H: Keccak256, -{ - type Item = DataOrHash; - - fn merge(left: &Self::Item, right: &Self::Item) -> merkle_mountain_range::Result { - let mut concat = left.hash::().as_ref().to_vec(); - concat.extend_from_slice(right.hash::().as_ref()); - - Ok(DataOrHash::Hash(sp_io::hashing::keccak_256(&concat).into())) - } -} diff --git a/modules/ismp/pallet/src/mmr/storage.rs b/modules/ismp/pallet/src/mmr/storage.rs deleted file mode 100644 index 4f8cd5cf2..000000000 --- a/modules/ismp/pallet/src/mmr/storage.rs +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (C) 2023 Polytope Labs. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! An MMR storage implementation. -use crate::mmr::primitives::{DataOrHash, NodeIndex}; -use codec::Encode; -use log::{debug, trace}; -use merkle_mountain_range::helper; -use sp_core::offchain::StorageKind; -use sp_std::iter::Peekable; -#[cfg(not(feature = "std"))] -use sp_std::prelude::*; - -use crate::{host::Host, mmr::utils::NodesUtils, Config, Pallet}; - -/// A marker type for runtime-specific storage implementation. -/// -/// Allows appending new items to the MMR and proof verification. -/// MMR nodes are appended to two different storages: -/// 1. We add nodes (leaves) hashes to the on-chain storage (see [crate::Nodes]). -/// 2. We add full leaves (and all inner nodes as well) into the `IndexingAPI` during block -/// processing, so the values end up in the Offchain DB if indexing is enabled. -pub struct RuntimeStorage; - -/// A marker type for offchain-specific storage implementation. -/// -/// Allows proof generation and verification, but does not support appending new items. -/// MMR nodes are assumed to be stored in the Off-Chain DB. Note this storage type -/// DOES NOT support adding new items to the MMR. -pub struct OffchainStorage; - -/// A storage layer for MMR. -/// -/// There are two different implementations depending on the use case. -/// See docs for [RuntimeStorage] and [OffchainStorage]. -pub struct Storage(sp_std::marker::PhantomData<(StorageType, T)>); - -impl Default for Storage { - fn default() -> Self { - Self(Default::default()) - } -} - -impl merkle_mountain_range::MMRStore for Storage -where - T: Config, -{ - fn get_elem(&self, pos: NodeIndex) -> merkle_mountain_range::Result> { - let commitment = Pallet::::mmr_positions(pos); - if let Some(commitment) = commitment { - let key = Pallet::::full_leaf_offchain_key(commitment); - debug!( - target: "ismp::mmr", "offchain db get {}: key {:?}", - pos, key - ); - // Try to retrieve the element from Off-chain DB. - if let Some(elem) = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, &key) { - return Ok(codec::Decode::decode(&mut &*elem).ok()); - } - } else { - return Ok(Pallet::::get_node(pos)); - } - - Ok(None) - } - - fn append(&mut self, _: NodeIndex, _: Vec) -> merkle_mountain_range::Result<()> { - panic!("MMR must not be altered in the off-chain context.") - } -} - -impl merkle_mountain_range::MMRStore for Storage -where - T: Config, -{ - fn get_elem(&self, pos: NodeIndex) -> merkle_mountain_range::Result> { - Ok(Pallet::::get_node(pos)) - } - - fn append( - &mut self, - pos: NodeIndex, - elems: Vec, - ) -> merkle_mountain_range::Result<()> { - if elems.is_empty() { - return Ok(()); - } - - trace!( - target: "ismp::mmr", "elems: {:?}", - elems.iter().map(|elem| elem.hash::>()).collect::>() - ); - - let leaves = Pallet::::number_of_leaves(); - let size = NodesUtils::new(leaves).size(); - - if pos != size { - return Err(merkle_mountain_range::Error::InconsistentStore); - } - - // Now we are going to iterate over elements to insert - // and keep track of the current `node_index` and `leaf_index`. - let mut leaf_index = leaves; - let mut node_index = size; - - for elem in elems { - // Store element - Self::store_to_elem(node_index, &elem); - - // Increase the indices. - if let DataOrHash::Data(..) = elem { - leaf_index += 1; - } - node_index += 1; - } - - // Update current number of leaves. - Pallet::::set_num_leaves(leaf_index); - - Ok(()) - } -} - -impl Storage -where - T: Config, -{ - /// Store a node in the offchain db or runtime storage - fn store_to_elem(pos: NodeIndex, node: &DataOrHash) { - let encoded_node = node.encode(); - let commitment = node.hash::>(); - match node { - DataOrHash::Data(_) => { - let key = Pallet::::full_leaf_offchain_key(commitment); - debug!( - target: "ismp::mmr", "offchain db set: pos {} key {:?}", - pos, key - ); - // Indexing API is used to store the full node content. - sp_io::offchain_index::set(&key, &encoded_node); - // Store leaf hash on chain - Pallet::::insert_node(pos, commitment); - }, - DataOrHash::Hash(hash) => { - Pallet::::insert_node(pos, *hash); - }, - }; - } -} - -/// Calculate peaks to prune and store -fn _peaks_to_prune_and_store( - old_size: NodeIndex, - new_size: NodeIndex, -) -> (impl Iterator, Peekable>) { - // A sorted (ascending) collection of peak indices before and after insertion. - // both collections may share a common prefix. - let peaks_before = if old_size == 0 { vec![] } else { helper::get_peaks(old_size) }; - let peaks_after = helper::get_peaks(new_size); - trace!(target: "ismp::mmr", "peaks_before: {:?}", peaks_before); - trace!(target: "ismp::mmr", "peaks_after: {:?}", peaks_after); - let mut peaks_before = peaks_before.into_iter().peekable(); - let mut peaks_after = peaks_after.into_iter().peekable(); - - // Consume a common prefix between `peaks_before` and `peaks_after`, - // since that's something we will not be touching anyway. - while peaks_before.peek() == peaks_after.peek() { - peaks_before.next(); - peaks_after.next(); - } - - // what's left in both collections is: - // 1. Old peaks to remove from storage - // 2. New peaks to persist in storage - (peaks_before, peaks_after) -} diff --git a/modules/ismp/pallet/src/mmr/utils.rs b/modules/ismp/pallet/src/mmr/utils.rs deleted file mode 100644 index dae8f02a3..000000000 --- a/modules/ismp/pallet/src/mmr/utils.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2023 Polytope Labs. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use crate::mmr::primitives::{LeafIndex, NodeIndex}; - -/// MMR nodes & size -related utilities. -pub struct NodesUtils { - no_of_leaves: LeafIndex, -} - -impl NodesUtils { - /// Create new instance of MMR nodes utilities for given number of leaves. - pub fn new(no_of_leaves: LeafIndex) -> Self { - Self { no_of_leaves } - } - - /// Calculate number of peaks in the MMR. - pub fn number_of_peaks(&self) -> NodeIndex { - self.number_of_leaves().count_ones() as NodeIndex - } - - /// Return the number of leaves in the MMR. - pub fn number_of_leaves(&self) -> LeafIndex { - self.no_of_leaves - } - - /// Calculate the total size of MMR (number of nodes). - pub fn size(&self) -> NodeIndex { - 2 * self.no_of_leaves - self.number_of_peaks() - } -} diff --git a/modules/ismp/pallet/src/primitives.rs b/modules/ismp/pallet/src/primitives.rs index e7f3b4f76..f0a260f8b 100644 --- a/modules/ismp/pallet/src/primitives.rs +++ b/modules/ismp/pallet/src/primitives.rs @@ -14,7 +14,6 @@ // limitations under the License. //! Pallet primitives -use crate::mmr::primitives::NodeIndex; use alloc::format; use codec::{Decode, Encode}; use core::time::Duration; @@ -26,6 +25,7 @@ use sp_core::{ crypto::{AccountId32, ByteArray}, H160, H256, }; +use sp_mmr_primitives::NodeIndex; use sp_runtime::{Digest, DigestItem, RuntimeDebug}; use sp_std::prelude::*; @@ -40,22 +40,6 @@ pub struct Proof { pub items: Vec, } -/// Merkle Mountain Range operation error. -#[derive(RuntimeDebug, codec::Encode, codec::Decode, PartialEq, Eq, scale_info::TypeInfo)] -#[allow(missing_docs)] -pub enum Error { - InvalidNumericOp, - Push, - GetRoot, - Commit, - GenerateProof, - Verify, - LeafNotFound, - PalletNotIncluded, - InvalidLeafIndex, - InvalidBestKnownBlock, -} - /// A trait that returns a list of all configured consensus clients /// This trait should be implemented in the runtime pub trait ConsensusClientProvider { diff --git a/modules/ismp/pallet/testsuite/Cargo.toml b/modules/ismp/pallet/testsuite/Cargo.toml index c00c18c6e..092d8680f 100644 --- a/modules/ismp/pallet/testsuite/Cargo.toml +++ b/modules/ismp/pallet/testsuite/Cargo.toml @@ -41,6 +41,8 @@ pallet-fishermen = { workspace = true, default-features = true } pallet-call-decompressor = { workspace = true, default-features = true } pallet-asset-gateway = { workspace = true, default-features = true } sp-state-machine = { workspace = true, default-features = true } +mmr-primitives = { workspace = true, default-features = true } +pallet-mmr = { workspace = true, default-features = true } # Polkadot pallet-xcm = { workspace = true, default-features = true } @@ -60,7 +62,7 @@ parachain-info = { workspace = true, default-features = true } cumulus-primitives-core = { workspace = true, default-features = true } cumulus-pallet-xcmp-queue = { workspace = true, default-features = true } cumulus-pallet-parachain-system = { workspace = true, default-features = true } -subxt = { version = "0.30.1", features = ["substrate-compat"] } +subxt = { workspace = true, features = ["substrate-compat"], default-features = true } [dev-dependencies] env_logger = "0.10.0" diff --git a/modules/ismp/pallet/testsuite/src/runtime.rs b/modules/ismp/pallet/testsuite/src/runtime.rs index ae6ddadb1..e05882d12 100644 --- a/modules/ismp/pallet/testsuite/src/runtime.rs +++ b/modules/ismp/pallet/testsuite/src/runtime.rs @@ -37,7 +37,7 @@ use ismp::{ router::{IsmpRouter, Post, RequestResponse, Response, Timeout}, }; use ismp_sync_committee::constants::sepolia::Sepolia; -use pallet_ismp::{host::Host, primitives::ModuleId}; +use pallet_ismp::{host::Host, mmr::Leaf, primitives::ModuleId}; use sp_core::{ crypto::AccountId32, offchain::{testing::TestOffchainExt, OffchainDbExt, OffchainWorkerExt}, @@ -58,6 +58,7 @@ frame_support::construct_runtime!( ParachainSystem: cumulus_pallet_parachain_system, ParachainInfo: parachain_info, Timestamp: pallet_timestamp, + Mmr: pallet_mmr, Ismp: pallet_ismp, Balances: pallet_balances, Relayer: pallet_ismp_relayer, @@ -170,7 +171,6 @@ parameter_types! { impl pallet_ismp::Config for Test { type RuntimeEvent = RuntimeEvent; - const INDEXING_PREFIX: &'static [u8] = b"ISMP"; type AdminOrigin = EnsureRoot; type HostStateMachine = StateMachineProvider; type Coprocessor = Coprocessor; @@ -181,9 +181,16 @@ impl pallet_ismp::Config for Test { ismp_sync_committee::SyncCommitteeConsensusClient, Sepolia>, ismp_bsc::BscClient>, ); + type Mmr = Mmr; type WeightProvider = (); } +impl pallet_mmr::Config for Test { + const INDEXING_PREFIX: &'static [u8] = b"ISMP"; + type Hashing = Keccak256; + type Leaf = Leaf; +} + impl pallet_ismp_relayer::Config for Test { type RuntimeEvent = RuntimeEvent; } diff --git a/modules/ismp/pallet/testsuite/src/tests/pallet_fishermen.rs b/modules/ismp/pallet/testsuite/src/tests/pallet_fishermen.rs index 2bf23fcf9..4b42a0a29 100644 --- a/modules/ismp/pallet/testsuite/src/tests/pallet_fishermen.rs +++ b/modules/ismp/pallet/testsuite/src/tests/pallet_fishermen.rs @@ -39,7 +39,7 @@ fn test_can_veto_state_commitments() { assert_eq!( result, Err(DispatchError::Module(ModuleError { - index: 7, + index: 8, error: [0, 0, 0, 0], message: Some("AlreadyAdded"), })) @@ -71,7 +71,7 @@ fn test_can_veto_state_commitments() { assert_eq!( result, Err(DispatchError::Module(ModuleError { - index: 7, + index: 8, error: [2, 0, 0, 0], message: Some("UnauthorizedAction"), })) diff --git a/modules/ismp/pallet/testsuite/src/tests/pallet_ismp.rs b/modules/ismp/pallet/testsuite/src/tests/pallet_ismp.rs index e92a68adb..a707b4e8e 100644 --- a/modules/ismp/pallet/testsuite/src/tests/pallet_ismp.rs +++ b/modules/ismp/pallet/testsuite/src/tests/pallet_ismp.rs @@ -16,19 +16,9 @@ #![cfg(test)] use crate::runtime::*; -use frame_support::pallet_prelude::Hooks; -use pallet_ismp::{ - child_trie::{RequestCommitments, RequestReceipts}, - dispatcher::{Dispatcher, FeeMetadata}, - host::Host, - mmr::primitives::{DataOrHash, MmrHasher}, - IntermediateLeaves, NodesUtils, ProofKeys, -}; +use pallet_ismp::{child_trie::RequestReceipts, dispatcher::Dispatcher, host::Host}; -use std::{ - ops::Range, - time::{Duration, SystemTime, UNIX_EPOCH}, -}; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; use ismp::{ consensus::{StateMachineHeight, StateMachineId}, @@ -45,175 +35,6 @@ use ismp_testsuite::{ check_challenge_period, check_client_expiry, missing_state_commitment_check, post_request_timeout_check, post_response_timeout_check, write_outgoing_commitments, }; -use merkle_mountain_range::MerkleProof; -use sp_core::{crypto::AccountId32, H256}; - -fn on_initialize() { - let number = frame_system::Pallet::::block_number() + 1; - let hash = H256::repeat_byte(number as u8); - - frame_system::Pallet::::reset_events(); - frame_system::Pallet::::initialize(&number, &hash, &Default::default()); - Ismp::on_initialize(number); -} - -fn push_leaves(range: Range) -> (Vec, Vec) { - // given - let mut commitments = vec![]; - let mut positions = vec![]; - for nonce in range { - let post = Post { - source: StateMachine::Kusama(2000), - dest: StateMachine::Kusama(2001), - nonce, - from: vec![0u8; 32], - to: vec![18; 32], - timeout_timestamp: 100 * nonce, - data: vec![2u8; 64], - }; - - let request = Request::Post(post); - let commitment = hash_request::>(&request); - - pallet_ismp::Pallet::::dispatch_request( - request, - FeeMetadata { origin: AccountId32::new([0u8; 32]), fee: 10u128 }, - ) - .unwrap(); - let metadata = RequestCommitments::::get(commitment).expect("Should exist"); - positions.push(metadata.mmr.pos); - commitments.push(commitment) - } - - (commitments, positions) -} - -#[test] -fn should_generate_proofs_correctly_for_single_leaf_mmr() { - let _ = env_logger::try_init(); - let mut ext = new_test_ext(); - let (root, (commitments, positions)) = ext.execute_with(|| { - on_initialize(); - // push some leaves into the mmr - let positions = push_leaves(0..12); - Ismp::on_finalize(frame_system::Pallet::::block_number() + 1); - let root = pallet_ismp::Pallet::::mmr_root(); - (root, positions) - }); - ext.persist_offchain_overlay(); - - // Try to generate proofs now. This requires the offchain extensions to be present - // to retrieve full leaf data. - - ext.execute_with(move || { - let (leaves, proof) = - pallet_ismp::Pallet::::generate_proof(ProofKeys::Requests(vec![commitments[0]])) - .unwrap(); - let mmr_size = NodesUtils::new(proof.leaf_count).size(); - let nodes = proof.items.into_iter().map(|h| DataOrHash::Hash(h.into())).collect(); - let proof = MerkleProof::>>::new(mmr_size, nodes); - let calculated_root = proof - .calculate_root(vec![(positions[0], DataOrHash::Data(leaves[0].clone()))]) - .unwrap(); - - assert_eq!(root, calculated_root.hash::>()); - - assert_eq!(IntermediateLeaves::::count(), 0); - }) -} - -#[test] -fn should_generate_and_verify_batch_proof_correctly() { - let _ = env_logger::try_init(); - let mut ext = new_test_ext(); - // Try to generate proofs now. This requires the offchain extensions to be present - // to retrieve full leaf data. - let (root, (commitments, positions)) = ext.execute_with(|| { - on_initialize(); - // push some leaves into the mmr - let positions = push_leaves(0..12); - Ismp::on_finalize(frame_system::Pallet::::block_number() + 1); - let root = pallet_ismp::Pallet::::mmr_root(); - (root, positions) - }); - ext.persist_offchain_overlay(); - - ext.execute_with(move || { - let proof_key = ProofKeys::Requests(vec![ - commitments[0], - commitments[3], - commitments[2], - commitments[5], - ]); - let indices = vec![positions[0], positions[3], positions[2], positions[5]]; - let (leaves, proof) = pallet_ismp::Pallet::::generate_proof(proof_key).unwrap(); - - let mmr_size = NodesUtils::new(proof.leaf_count).size(); - let nodes = proof.items.into_iter().map(|h| DataOrHash::Hash(h.into())).collect(); - let proof = MerkleProof::>>::new(mmr_size, nodes); - let calculated_root = proof - .calculate_root( - indices - .into_iter() - .zip(leaves.into_iter().map(|leaf| DataOrHash::Data(leaf))) - .collect(), - ) - .unwrap(); - - assert_eq!(root, calculated_root.hash::>()); - assert_eq!(IntermediateLeaves::::count(), 0); - }) -} - -#[test] -fn should_generate_and_verify_batch_proof_for_leaves_inserted_across_multiple_blocks_correctly() { - let _ = env_logger::try_init(); - let mut ext = new_test_ext(); - // Try to generate proofs now. This requires the offchain extensions to be present - // to retrieve full leaf data. - let (root, (commitments, positions)) = ext.execute_with(|| { - on_initialize(); - // push some leaves into the mmr - let (mut commitments, mut positions) = push_leaves(0..100); - Ismp::on_finalize(frame_system::Pallet::::block_number() + 1); - on_initialize(); - let (commitments_second, positions_second) = push_leaves(100..200); - Ismp::on_finalize(frame_system::Pallet::::block_number() + 1); - let root = pallet_ismp::Pallet::::mmr_root(); - positions.extend_from_slice(&positions_second); - commitments.extend_from_slice(&commitments_second); - (root, (commitments, positions)) - }); - ext.persist_offchain_overlay(); - - ext.execute_with(move || { - let indices = vec![positions[0], positions[120], positions[50], positions[195]]; - let proof_key = ProofKeys::Requests(vec![ - commitments[0], - commitments[120], - commitments[50], - commitments[195], - ]); - let (leaves, proof) = pallet_ismp::Pallet::::generate_proof(proof_key).unwrap(); - - let mmr_size = NodesUtils::new(proof.leaf_count).size(); - let nodes = proof.items.into_iter().map(|h| DataOrHash::Hash(h.into())).collect(); - let proof = MerkleProof::>>::new(mmr_size, nodes); - let calculated_root = proof - .calculate_root( - indices - .into_iter() - .zip(leaves.into_iter().map(|leaf| DataOrHash::Data(leaf))) - .collect(), - ) - .unwrap(); - - assert_eq!(root, calculated_root.hash::>()); - assert_eq!(IntermediateLeaves::::count(), 0); - - dbg!(NodesUtils::new(1_000_000_000).size() * 32); - }) -} fn set_timestamp(now: Option) { Timestamp::set_timestamp( diff --git a/modules/ismp/pallet/testsuite/src/tests/pallet_ismp_relayer.rs b/modules/ismp/pallet/testsuite/src/tests/pallet_ismp_relayer.rs index 09e703a2b..b5a0378ef 100644 --- a/modules/ismp/pallet/testsuite/src/tests/pallet_ismp_relayer.rs +++ b/modules/ismp/pallet/testsuite/src/tests/pallet_ismp_relayer.rs @@ -37,7 +37,6 @@ use pallet_ismp::{ use pallet_ismp_relayer::{ self as pallet_ismp_relayer, message, withdrawal::{Key, Signature, WithdrawalInputData, WithdrawalProof}, - Claimed, }; use sp_core::{Pair, H160, H256, U256}; use sp_trie::LayoutV0; @@ -114,9 +113,14 @@ fn test_withdrawal_proof() { for request in &requests { let request_commitment_key = RequestCommitments::::storage_key(*request); let request_receipt_key = RequestReceipts::::storage_key(*request); - let fee_metadata = FeeMetadata:: { origin: [0; 32].into(), fee: 1000u128.into() }; + let fee_metadata = FeeMetadata:: { + origin: [0; 32].into(), + fee: 1000u128.into(), + claimed: false, + }; let leaf_meta = LeafMetadata { mmr: LeafIndexAndPos { leaf_index: 0, pos: 0 }, meta: fee_metadata }; + RequestCommitments::::insert(*request, leaf_meta.clone()); source_trie.insert(&request_commitment_key, &leaf_meta.encode()).unwrap(); dest_trie.insert(&request_receipt_key, &vec![1u8; 32].encode()).unwrap(); } @@ -124,9 +128,14 @@ fn test_withdrawal_proof() { for (request, response) in &responses { let response_commitment_key = ResponseCommitments::::storage_key(*response); let response_receipt_key = ResponseReceipts::::storage_key(*request); - let fee_metadata = FeeMetadata:: { origin: [0; 32].into(), fee: 1000u128.into() }; + let fee_metadata = FeeMetadata:: { + origin: [0; 32].into(), + fee: 1000u128.into(), + claimed: false, + }; let leaf_meta = LeafMetadata { mmr: LeafIndexAndPos { leaf_index: 0, pos: 0 }, meta: fee_metadata }; + ResponseCommitments::::insert(*response, leaf_meta.clone()); source_trie.insert(&response_commitment_key, &leaf_meta.encode()).unwrap(); let receipt = ResponseReceipt { response: *response, relayer: vec![2; 32] }; dest_trie.insert(&response_receipt_key, &receipt.encode()).unwrap(); @@ -354,7 +363,32 @@ fn test_evm_accumulate_fees() { dbg!(claim_proof.len()); let mut claim_proof = WithdrawalProof::decode(&mut &*claim_proof).unwrap(); - + for key in claim_proof.commitments.clone() { + match key { + Key::Request(req) => { + let leaf_meta = LeafMetadata { + mmr: LeafIndexAndPos { leaf_index: 0, pos: 0 }, + meta: FeeMetadata:: { + origin: [0; 32].into(), + fee: 1000u128.into(), + claimed: false, + }, + }; + RequestCommitments::::insert(req, leaf_meta) + }, + Key::Response { response_commitment, .. } => { + let leaf_meta = LeafMetadata { + mmr: LeafIndexAndPos { leaf_index: 0, pos: 0 }, + meta: FeeMetadata:: { + origin: [0; 32].into(), + fee: 1000u128.into(), + claimed: false, + }, + }; + ResponseCommitments::::insert(response_commitment, leaf_meta); + }, + } + } let mut source_evm_proof = EvmStateProof::decode(&mut &*claim_proof.source_proof.proof).unwrap(); let mut dest_evm_proof = @@ -507,7 +541,22 @@ fn test_evm_accumulate_fees_with_zero_fee_values() { ) .unwrap(); assert_eq!(claim_proof.commitments.len(), 6); - assert_eq!(Claimed::::iter().count(), 5); + let claimed = claim_proof.commitments.into_iter().fold(0u32, |acc, key| match key { + Key::Request(req) => RequestCommitments::::get(req) + .unwrap() + .meta + .claimed + .then(|| acc + 1) + .unwrap_or(acc), + Key::Response { response_commitment, .. } => + ResponseCommitments::::get(response_commitment) + .unwrap() + .meta + .claimed + .then(|| acc + 1) + .unwrap_or(acc), + }); + assert_eq!(claimed, 5); }) } @@ -528,6 +577,33 @@ fn setup_host_for_accumulate_fees() -> WithdrawalProof { let claim_proof = WithdrawalProof::decode(&mut &*claim_proof).unwrap(); + for key in claim_proof.commitments.clone() { + match key { + Key::Request(req) => { + let leaf_meta = LeafMetadata { + mmr: LeafIndexAndPos { leaf_index: 0, pos: 0 }, + meta: FeeMetadata:: { + origin: [0; 32].into(), + fee: 1000u128.into(), + claimed: false, + }, + }; + RequestCommitments::::insert(req, leaf_meta) + }, + Key::Response { response_commitment, .. } => { + let leaf_meta = LeafMetadata { + mmr: LeafIndexAndPos { leaf_index: 0, pos: 0 }, + meta: FeeMetadata:: { + origin: [0; 32].into(), + fee: 1000u128.into(), + claimed: false, + }, + }; + ResponseCommitments::::insert(response_commitment, leaf_meta); + }, + } + } + let host = Host::::default(); host.store_state_machine_commitment( claim_proof.source_proof.height, diff --git a/modules/ismp/testsuite/src/mocks.rs b/modules/ismp/testsuite/src/mocks.rs index f1b9c43b0..759d22096 100644 --- a/modules/ismp/testsuite/src/mocks.rs +++ b/modules/ismp/testsuite/src/mocks.rs @@ -1,3 +1,4 @@ +use codec::Encode; use ismp::{ consensus::{ ConsensusClient, ConsensusClientId, ConsensusStateId, StateCommitment, StateMachineClient, @@ -323,28 +324,28 @@ impl IsmpHost for Host { Ok(()) } - fn delete_request_commitment(&self, req: &Request) -> Result<(), Error> { + fn delete_request_commitment(&self, req: &Request) -> Result, Error> { let hash = hash_request::(req); - self.requests.borrow_mut().remove(&hash); - Ok(()) + let val = self.requests.borrow_mut().remove(&hash); + Ok(val.encode()) } - fn delete_response_commitment(&self, res: &PostResponse) -> Result<(), Error> { + fn delete_response_commitment(&self, res: &PostResponse) -> Result, Error> { let hash = hash_post_response::(res); - self.responses.borrow_mut().remove(&hash); - Ok(()) + let val = self.responses.borrow_mut().remove(&hash); + Ok(val.encode()) } - fn delete_request_receipt(&self, req: &Request) -> Result<(), Error> { + fn delete_request_receipt(&self, req: &Request) -> Result, Error> { let hash = hash_request::(req); - self.receipts.borrow_mut().remove(&hash); - Ok(()) + let val = self.receipts.borrow_mut().remove(&hash); + Ok(val.encode()) } - fn delete_response_receipt(&self, res: &PostResponse) -> Result<(), Error> { - let hash = hash_post_response::(res); - self.receipts.borrow_mut().remove(&hash); - Ok(()) + fn delete_response_receipt(&self, res: &Response) -> Result, Error> { + let hash = hash_request::(&res.request()); + let val = self.receipts.borrow_mut().remove(&hash); + Ok(val.encode()) } fn store_request_receipt(&self, req: &Request, _signer: &Vec) -> Result<(), Error> { @@ -391,6 +392,18 @@ impl IsmpHost for Host { self.frozen_state_machines.borrow_mut().insert(state_machine, true); Ok(()) } + + fn store_request_commitment(&self, req: &Request, _meta: Vec) -> Result<(), Error> { + let hash = hash_request::(req); + self.requests.borrow_mut().insert(hash); + Ok(()) + } + + fn store_response_commitment(&self, res: &PostResponse, _meta: Vec) -> Result<(), Error> { + let hash = hash_request::(&Request::Post(res.post.clone())); + self.responses.borrow_mut().insert(hash); + Ok(()) + } } impl Keccak256 for Host { diff --git a/modules/subxt/subxt-utils/Cargo.toml b/modules/subxt/subxt-utils/Cargo.toml new file mode 100644 index 000000000..ce9ed69dd --- /dev/null +++ b/modules/subxt/subxt-utils/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "subxt-utils" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +subxt = { workspace = true } +ismp = { workspace = true } +sp-core-hashing = { workspace = true } +codec = { workspace = true } + +[features] +default = ["std"] +wasm = ["subxt/web", "subxt/jsonrpsee"] +std = ["subxt/native", "subxt/jsonrpsee", "ismp/std", "sp-core-hashing/std", "codec/std"] + diff --git a/modules/client/src/runtime.rs b/modules/subxt/subxt-utils/src/gargantua.rs similarity index 82% rename from modules/client/src/runtime.rs rename to modules/subxt/subxt-utils/src/gargantua.rs index 780ca50ad..63a02b352 100644 --- a/modules/client/src/runtime.rs +++ b/modules/subxt/subxt-utils/src/gargantua.rs @@ -1,4 +1,4 @@ -#[allow(dead_code, unused_imports, non_camel_case_types)] +#[allow(dead_code, missing_docs, unused_imports, non_camel_case_types)] #[allow(clippy::all)] #[allow(rustdoc::broken_intra_doc_links)] pub mod api { @@ -6,7 +6,7 @@ pub mod api { mod root_mod { pub use super::*; } - pub static PALLETS: [&str; 21usize] = [ + pub static PALLETS: [&str; 25usize] = [ "System", "Timestamp", "ParachainSystem", @@ -22,14 +22,18 @@ pub mod api { "XcmpQueue", "PolkadotXcm", "CumulusXcm", - "MessageQueue", + "Mmr", "Ismp", + "MessageQueue", "IsmpSyncCommittee", "IsmpDemo", "Relayer", - "StateMachineManager", + "HostExecutive", + "CallDecompressor", + "Gateway", + "Assets", ]; - pub static RUNTIME_APIS: [&str; 14usize] = [ + pub static RUNTIME_APIS: [&str; 15usize] = [ "AuraApi", "AuraUnincludedSegmentApi", "Core", @@ -41,6 +45,7 @@ pub mod api { "AccountNonceApi", "TransactionPaymentApi", "TransactionPaymentCallApi", + "MmrRuntimeApi", "IsmpRuntimeApi", "CollectCollationInfo", "GenesisBuilder", @@ -111,6 +116,9 @@ pub mod api { ) -> transaction_payment_call_api::TransactionPaymentCallApi { transaction_payment_call_api::TransactionPaymentCallApi } + pub fn mmr_runtime_api(&self) -> mmr_runtime_api::MmrRuntimeApi { + mmr_runtime_api::MmrRuntimeApi + } pub fn ismp_runtime_api(&self) -> ismp_runtime_api::IsmpRuntimeApi { ismp_runtime_api::IsmpRuntimeApi } @@ -971,10 +979,10 @@ pub mod api { "query_call_info", types::QueryCallInfo { call, len }, [ - 178u8, 110u8, 234u8, 69u8, 237u8, 93u8, 242u8, 209u8, 159u8, 80u8, - 248u8, 9u8, 42u8, 91u8, 67u8, 73u8, 254u8, 91u8, 225u8, 124u8, 198u8, - 38u8, 74u8, 28u8, 252u8, 203u8, 69u8, 214u8, 127u8, 138u8, 250u8, - 120u8, + 106u8, 159u8, 247u8, 33u8, 50u8, 230u8, 133u8, 231u8, 168u8, 213u8, + 35u8, 53u8, 52u8, 153u8, 128u8, 186u8, 200u8, 212u8, 153u8, 252u8, + 62u8, 18u8, 181u8, 246u8, 245u8, 251u8, 155u8, 68u8, 33u8, 132u8, + 232u8, 97u8, ], ) } @@ -994,10 +1002,9 @@ pub mod api { "query_call_fee_details", types::QueryCallFeeDetails { call, len }, [ - 221u8, 41u8, 14u8, 211u8, 141u8, 147u8, 219u8, 216u8, 49u8, 53u8, - 101u8, 31u8, 71u8, 235u8, 103u8, 116u8, 94u8, 170u8, 202u8, 239u8, - 228u8, 115u8, 127u8, 129u8, 138u8, 65u8, 196u8, 172u8, 251u8, 41u8, - 156u8, 59u8, + 92u8, 2u8, 42u8, 165u8, 132u8, 80u8, 219u8, 246u8, 173u8, 253u8, 132u8, + 84u8, 139u8, 172u8, 40u8, 64u8, 75u8, 34u8, 156u8, 186u8, 87u8, 192u8, + 47u8, 236u8, 64u8, 241u8, 37u8, 158u8, 28u8, 50u8, 184u8, 4u8, ], ) } @@ -1094,11 +1101,33 @@ pub mod api { } } } - pub mod ismp_runtime_api { + pub mod mmr_runtime_api { use super::{root_mod, runtime_types}; - #[doc = " ISMP Runtime Apis"] - pub struct IsmpRuntimeApi; - impl IsmpRuntimeApi { + #[doc = " MmrRuntimeApi"] + pub struct MmrRuntimeApi; + impl MmrRuntimeApi { + #[doc = " Return Block number where pallet-mmr was added to the runtime"] + pub fn pallet_genesis( + &self, + ) -> ::subxt::runtime_api::Payload< + types::PalletGenesis, + ::core::result::Result< + ::core::option::Option<::core::primitive::u32>, + runtime_types::sp_mmr_primitives::Error, + >, + > { + ::subxt::runtime_api::Payload::new_static( + "MmrRuntimeApi", + "pallet_genesis", + types::PalletGenesis {}, + [ + 221u8, 97u8, 190u8, 29u8, 109u8, 247u8, 150u8, 7u8, 215u8, 120u8, + 147u8, 9u8, 156u8, 229u8, 221u8, 233u8, 232u8, 182u8, 22u8, 245u8, + 84u8, 220u8, 83u8, 183u8, 166u8, 161u8, 170u8, 129u8, 232u8, 96u8, + 250u8, 109u8, + ], + ) + } #[doc = " Return the number of MMR leaves."] pub fn mmr_leaf_count( &self, @@ -1106,18 +1135,17 @@ pub mod api { types::MmrLeafCount, ::core::result::Result< ::core::primitive::u64, - runtime_types::pallet_ismp::primitives::Error, + runtime_types::sp_mmr_primitives::Error, >, > { ::subxt::runtime_api::Payload::new_static( - "IsmpRuntimeApi", + "MmrRuntimeApi", "mmr_leaf_count", types::MmrLeafCount {}, [ - 165u8, 88u8, 179u8, 215u8, 28u8, 105u8, 59u8, 223u8, 45u8, 57u8, 74u8, - 139u8, 96u8, 248u8, 255u8, 250u8, 87u8, 174u8, 11u8, 35u8, 245u8, - 237u8, 32u8, 197u8, 245u8, 25u8, 171u8, 244u8, 89u8, 56u8, 245u8, - 102u8, + 37u8, 82u8, 195u8, 123u8, 240u8, 88u8, 235u8, 246u8, 28u8, 199u8, 48u8, + 42u8, 8u8, 36u8, 187u8, 77u8, 115u8, 0u8, 254u8, 139u8, 171u8, 90u8, + 64u8, 196u8, 131u8, 252u8, 116u8, 176u8, 25u8, 179u8, 44u8, 152u8, ], ) } @@ -1128,32 +1156,75 @@ pub mod api { types::MmrRoot, ::core::result::Result< ::subxt::utils::H256, - runtime_types::pallet_ismp::primitives::Error, + runtime_types::sp_mmr_primitives::Error, >, > { ::subxt::runtime_api::Payload::new_static( - "IsmpRuntimeApi", + "MmrRuntimeApi", "mmr_root", types::MmrRoot {}, [ - 17u8, 86u8, 8u8, 236u8, 21u8, 48u8, 115u8, 42u8, 67u8, 178u8, 25u8, - 107u8, 178u8, 228u8, 24u8, 163u8, 121u8, 137u8, 162u8, 254u8, 28u8, - 124u8, 186u8, 158u8, 94u8, 43u8, 144u8, 51u8, 227u8, 8u8, 245u8, 168u8, + 50u8, 174u8, 21u8, 228u8, 17u8, 52u8, 134u8, 55u8, 249u8, 78u8, 197u8, + 117u8, 185u8, 16u8, 209u8, 206u8, 121u8, 39u8, 149u8, 216u8, 53u8, + 212u8, 120u8, 156u8, 27u8, 77u8, 193u8, 46u8, 228u8, 21u8, 42u8, 240u8, ], ) } + } + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct PalletGenesis {} + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct MmrLeafCount {} + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct MmrRoot {} + } + } + pub mod ismp_runtime_api { + use super::{root_mod, runtime_types}; + #[doc = " ISMP Runtime Apis"] + pub struct IsmpRuntimeApi; + impl IsmpRuntimeApi { #[doc = " Generate a proof for the provided leaf indices"] pub fn generate_proof( &self, - commitments: runtime_types::pallet_ismp::mmr::mmr::ProofKeys, + commitments: runtime_types::pallet_ismp::mmr::ProofKeys, ) -> ::subxt::runtime_api::Payload< types::GenerateProof, ::core::result::Result< ( - ::std::vec::Vec, + ::std::vec::Vec, runtime_types::pallet_ismp::primitives::Proof<::subxt::utils::H256>, ), - runtime_types::pallet_ismp::primitives::Error, + runtime_types::sp_mmr_primitives::Error, >, > { ::subxt::runtime_api::Payload::new_static( @@ -1161,10 +1232,10 @@ pub mod api { "generate_proof", types::GenerateProof { commitments }, [ - 9u8, 213u8, 48u8, 150u8, 145u8, 155u8, 98u8, 90u8, 42u8, 22u8, 203u8, - 190u8, 155u8, 29u8, 203u8, 181u8, 41u8, 142u8, 245u8, 20u8, 229u8, - 249u8, 196u8, 70u8, 167u8, 193u8, 212u8, 31u8, 193u8, 252u8, 213u8, - 170u8, + 195u8, 163u8, 200u8, 21u8, 175u8, 11u8, 89u8, 42u8, 128u8, 156u8, + 243u8, 55u8, 228u8, 143u8, 52u8, 129u8, 198u8, 54u8, 171u8, 99u8, 72u8, + 37u8, 124u8, 19u8, 102u8, 149u8, 229u8, 117u8, 56u8, 241u8, 224u8, + 51u8, ], ) } @@ -1180,9 +1251,9 @@ pub mod api { "block_events", types::BlockEvents {}, [ - 249u8, 188u8, 201u8, 1u8, 86u8, 188u8, 234u8, 221u8, 50u8, 157u8, - 109u8, 59u8, 173u8, 37u8, 144u8, 38u8, 58u8, 133u8, 52u8, 203u8, 172u8, - 151u8, 187u8, 146u8, 38u8, 14u8, 239u8, 92u8, 30u8, 61u8, 143u8, 4u8, + 37u8, 99u8, 198u8, 226u8, 175u8, 135u8, 50u8, 228u8, 87u8, 64u8, 9u8, + 164u8, 13u8, 49u8, 13u8, 202u8, 221u8, 160u8, 194u8, 179u8, 142u8, + 171u8, 65u8, 237u8, 214u8, 77u8, 216u8, 161u8, 98u8, 131u8, 8u8, 18u8, ], ) } @@ -1201,9 +1272,10 @@ pub mod api { "block_events_with_metadata", types::BlockEventsWithMetadata {}, [ - 184u8, 38u8, 1u8, 33u8, 104u8, 234u8, 182u8, 34u8, 225u8, 16u8, 28u8, - 64u8, 110u8, 242u8, 9u8, 154u8, 217u8, 90u8, 36u8, 19u8, 178u8, 125u8, - 189u8, 103u8, 184u8, 247u8, 146u8, 29u8, 188u8, 26u8, 192u8, 69u8, + 226u8, 50u8, 123u8, 173u8, 231u8, 170u8, 107u8, 138u8, 246u8, 126u8, + 219u8, 154u8, 145u8, 64u8, 29u8, 70u8, 194u8, 241u8, 10u8, 250u8, + 134u8, 40u8, 86u8, 7u8, 141u8, 219u8, 29u8, 179u8, 136u8, 140u8, 152u8, + 153u8, ], ) } @@ -1296,9 +1368,10 @@ pub mod api { "get_requests", types::GetRequests { leaf_positions }, [ - 191u8, 252u8, 214u8, 26u8, 63u8, 13u8, 74u8, 196u8, 148u8, 39u8, 204u8, - 57u8, 105u8, 128u8, 254u8, 169u8, 220u8, 202u8, 218u8, 197u8, 16u8, - 8u8, 137u8, 90u8, 4u8, 96u8, 57u8, 102u8, 228u8, 118u8, 7u8, 54u8, + 238u8, 30u8, 150u8, 130u8, 3u8, 191u8, 231u8, 174u8, 122u8, 216u8, + 197u8, 93u8, 96u8, 216u8, 166u8, 222u8, 37u8, 154u8, 197u8, 114u8, + 142u8, 226u8, 145u8, 26u8, 91u8, 170u8, 109u8, 241u8, 3u8, 13u8, 165u8, + 153u8, ], ) } @@ -1315,10 +1388,10 @@ pub mod api { "get_responses", types::GetResponses { leaf_positions }, [ - 129u8, 166u8, 137u8, 66u8, 101u8, 194u8, 197u8, 5u8, 55u8, 24u8, 17u8, - 215u8, 125u8, 156u8, 229u8, 185u8, 72u8, 251u8, 216u8, 159u8, 156u8, - 209u8, 111u8, 56u8, 129u8, 212u8, 150u8, 179u8, 97u8, 180u8, 212u8, - 233u8, + 185u8, 192u8, 229u8, 103u8, 67u8, 203u8, 207u8, 25u8, 193u8, 177u8, + 234u8, 228u8, 203u8, 228u8, 181u8, 87u8, 36u8, 200u8, 37u8, 132u8, + 166u8, 97u8, 112u8, 242u8, 246u8, 61u8, 165u8, 4u8, 224u8, 36u8, 118u8, + 42u8, ], ) } @@ -1335,30 +1408,8 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MmrLeafCount {} - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MmrRoot {} - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] pub struct GenerateProof { - pub commitments: runtime_types::pallet_ismp::mmr::mmr::ProofKeys, + pub commitments: runtime_types::pallet_ismp::mmr::ProofKeys, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -1612,6 +1663,12 @@ pub mod api { pub fn message_queue(&self) -> message_queue::constants::ConstantsApi { message_queue::constants::ConstantsApi } + pub fn gateway(&self) -> gateway::constants::ConstantsApi { + gateway::constants::ConstantsApi + } + pub fn assets(&self) -> assets::constants::ConstantsApi { + assets::constants::ConstantsApi + } } pub struct StorageApi; impl StorageApi { @@ -1657,17 +1714,26 @@ pub mod api { pub fn polkadot_xcm(&self) -> polkadot_xcm::storage::StorageApi { polkadot_xcm::storage::StorageApi } - pub fn message_queue(&self) -> message_queue::storage::StorageApi { - message_queue::storage::StorageApi + pub fn mmr(&self) -> mmr::storage::StorageApi { + mmr::storage::StorageApi } pub fn ismp(&self) -> ismp::storage::StorageApi { ismp::storage::StorageApi } + pub fn message_queue(&self) -> message_queue::storage::StorageApi { + message_queue::storage::StorageApi + } pub fn relayer(&self) -> relayer::storage::StorageApi { relayer::storage::StorageApi } - pub fn state_machine_manager(&self) -> state_machine_manager::storage::StorageApi { - state_machine_manager::storage::StorageApi + pub fn host_executive(&self) -> host_executive::storage::StorageApi { + host_executive::storage::StorageApi + } + pub fn gateway(&self) -> gateway::storage::StorageApi { + gateway::storage::StorageApi + } + pub fn assets(&self) -> assets::storage::StorageApi { + assets::storage::StorageApi } } pub struct TransactionApi; @@ -1702,12 +1768,12 @@ pub mod api { pub fn polkadot_xcm(&self) -> polkadot_xcm::calls::TransactionApi { polkadot_xcm::calls::TransactionApi } - pub fn message_queue(&self) -> message_queue::calls::TransactionApi { - message_queue::calls::TransactionApi - } pub fn ismp(&self) -> ismp::calls::TransactionApi { ismp::calls::TransactionApi } + pub fn message_queue(&self) -> message_queue::calls::TransactionApi { + message_queue::calls::TransactionApi + } pub fn ismp_sync_committee(&self) -> ismp_sync_committee::calls::TransactionApi { ismp_sync_committee::calls::TransactionApi } @@ -1717,8 +1783,17 @@ pub mod api { pub fn relayer(&self) -> relayer::calls::TransactionApi { relayer::calls::TransactionApi } - pub fn state_machine_manager(&self) -> state_machine_manager::calls::TransactionApi { - state_machine_manager::calls::TransactionApi + pub fn host_executive(&self) -> host_executive::calls::TransactionApi { + host_executive::calls::TransactionApi + } + pub fn call_decompressor(&self) -> call_decompressor::calls::TransactionApi { + call_decompressor::calls::TransactionApi + } + pub fn gateway(&self) -> gateway::calls::TransactionApi { + gateway::calls::TransactionApi + } + pub fn assets(&self) -> assets::calls::TransactionApi { + assets::calls::TransactionApi } } #[doc = r" check whether the metadata provided is aligned with this statically generated code."] @@ -1730,9 +1805,9 @@ pub mod api { .hash(); runtime_metadata_hash == [ - 155u8, 242u8, 159u8, 99u8, 207u8, 129u8, 237u8, 190u8, 76u8, 60u8, 63u8, 213u8, - 101u8, 141u8, 152u8, 128u8, 121u8, 75u8, 237u8, 169u8, 80u8, 41u8, 244u8, 25u8, - 121u8, 121u8, 8u8, 191u8, 123u8, 179u8, 142u8, 189u8, + 170u8, 171u8, 126u8, 165u8, 59u8, 45u8, 85u8, 235u8, 10u8, 169u8, 176u8, 184u8, + 172u8, 23u8, 227u8, 44u8, 201u8, 107u8, 147u8, 21u8, 135u8, 143u8, 165u8, 69u8, + 62u8, 220u8, 117u8, 220u8, 38u8, 223u8, 241u8, 174u8, ] } pub mod system { @@ -2560,10 +2635,9 @@ pub mod api { "Events", vec![], [ - 82u8, 190u8, 2u8, 206u8, 254u8, 87u8, 149u8, 220u8, 201u8, 12u8, 158u8, - 86u8, 197u8, 213u8, 165u8, 139u8, 108u8, 157u8, 204u8, 189u8, 180u8, - 21u8, 94u8, 102u8, 240u8, 111u8, 125u8, 124u8, 155u8, 180u8, 101u8, - 5u8, + 230u8, 75u8, 76u8, 40u8, 46u8, 117u8, 162u8, 81u8, 219u8, 21u8, 244u8, + 255u8, 2u8, 75u8, 55u8, 37u8, 246u8, 167u8, 25u8, 225u8, 202u8, 253u8, + 22u8, 84u8, 143u8, 232u8, 66u8, 254u8, 212u8, 243u8, 229u8, 55u8, ], ) } @@ -6314,10 +6388,9 @@ pub mod api { "sudo", types::Sudo { call: ::std::boxed::Box::new(call) }, [ - 45u8, 153u8, 121u8, 219u8, 52u8, 22u8, 168u8, 242u8, 197u8, 122u8, - 177u8, 72u8, 233u8, 213u8, 11u8, 82u8, 225u8, 169u8, 192u8, 91u8, - 135u8, 199u8, 118u8, 158u8, 151u8, 243u8, 131u8, 92u8, 120u8, 189u8, - 144u8, 150u8, + 149u8, 6u8, 58u8, 189u8, 108u8, 251u8, 51u8, 214u8, 14u8, 165u8, 188u8, + 202u8, 78u8, 82u8, 158u8, 13u8, 234u8, 67u8, 108u8, 236u8, 112u8, + 189u8, 110u8, 72u8, 16u8, 20u8, 254u8, 240u8, 78u8, 206u8, 13u8, 52u8, ], ) } @@ -6332,9 +6405,10 @@ pub mod api { "sudo_unchecked_weight", types::SudoUncheckedWeight { call: ::std::boxed::Box::new(call), weight }, [ - 218u8, 202u8, 109u8, 103u8, 202u8, 40u8, 249u8, 151u8, 196u8, 167u8, - 97u8, 156u8, 215u8, 55u8, 155u8, 191u8, 29u8, 77u8, 72u8, 212u8, 116u8, - 81u8, 87u8, 234u8, 57u8, 110u8, 205u8, 89u8, 158u8, 216u8, 196u8, 69u8, + 120u8, 200u8, 111u8, 75u8, 21u8, 183u8, 165u8, 58u8, 168u8, 210u8, + 96u8, 105u8, 246u8, 182u8, 130u8, 108u8, 58u8, 61u8, 21u8, 58u8, 152u8, + 105u8, 230u8, 245u8, 4u8, 93u8, 236u8, 189u8, 65u8, 128u8, 132u8, + 108u8, ], ) } @@ -6365,10 +6439,10 @@ pub mod api { "sudo_as", types::SudoAs { who, call: ::std::boxed::Box::new(call) }, [ - 181u8, 104u8, 0u8, 75u8, 184u8, 223u8, 186u8, 149u8, 143u8, 127u8, - 131u8, 248u8, 5u8, 159u8, 114u8, 207u8, 11u8, 141u8, 154u8, 13u8, - 149u8, 81u8, 47u8, 71u8, 100u8, 129u8, 10u8, 243u8, 152u8, 170u8, 1u8, - 80u8, + 38u8, 113u8, 42u8, 201u8, 79u8, 60u8, 221u8, 105u8, 93u8, 146u8, 170u8, + 229u8, 158u8, 13u8, 109u8, 66u8, 224u8, 127u8, 21u8, 235u8, 198u8, + 101u8, 176u8, 201u8, 144u8, 171u8, 78u8, 160u8, 42u8, 251u8, 227u8, + 24u8, ], ) } @@ -8493,366 +8567,208 @@ pub mod api { } } } - pub mod message_queue { + pub mod mmr { use super::{root_mod, runtime_types}; - #[doc = "The `Error` enum of this pallet."] - pub type Error = runtime_types::pallet_message_queue::pallet::Error; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::pallet_message_queue::pallet::Call; - pub mod calls { - use super::{root_mod, runtime_types}; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ReapPage { - pub message_origin: - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - pub page_index: ::core::primitive::u32, - } - impl ::subxt::blocks::StaticExtrinsic for ReapPage { - const PALLET: &'static str = "MessageQueue"; - const CALL: &'static str = "reap_page"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ExecuteOverweight { - pub message_origin: - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - pub page: ::core::primitive::u32, - pub index: ::core::primitive::u32, - pub weight_limit: runtime_types::sp_weights::weight_v2::Weight, + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Latest MMR Root hash."] + pub fn root_hash( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + ::subxt::utils::H256, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::Address::new_static( + "Mmr", + "RootHash", + vec![], + [ + 111u8, 206u8, 173u8, 92u8, 67u8, 49u8, 150u8, 113u8, 90u8, 245u8, 38u8, + 254u8, 76u8, 250u8, 167u8, 66u8, 130u8, 129u8, 251u8, 220u8, 172u8, + 229u8, 162u8, 251u8, 36u8, 227u8, 43u8, 189u8, 7u8, 106u8, 23u8, 13u8, + ], + ) } - impl ::subxt::blocks::StaticExtrinsic for ExecuteOverweight { - const PALLET: &'static str = "MessageQueue"; - const CALL: &'static str = "execute_overweight"; + #[doc = " Current size of the MMR (number of leaves)."] + pub fn number_of_leaves( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + ::core::primitive::u64, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), + > { + ::subxt::storage::address::Address::new_static( + "Mmr", + "NumberOfLeaves", + vec![], + [ + 123u8, 58u8, 149u8, 174u8, 85u8, 45u8, 20u8, 115u8, 241u8, 0u8, 51u8, + 174u8, 234u8, 60u8, 230u8, 59u8, 237u8, 144u8, 170u8, 32u8, 4u8, 0u8, + 34u8, 163u8, 238u8, 205u8, 93u8, 208u8, 53u8, 38u8, 141u8, 195u8, + ], + ) } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::reap_page`]."] - pub fn reap_page( + #[doc = " Height at which the pallet started inserting leaves into offchain storage."] + pub fn initial_height( &self, - message_origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - page_index: ::core::primitive::u32, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "MessageQueue", - "reap_page", - types::ReapPage { message_origin, page_index }, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + ::core::primitive::u32, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::Address::new_static( + "Mmr", + "InitialHeight", + vec![], [ - 116u8, 17u8, 120u8, 238u8, 117u8, 222u8, 10u8, 166u8, 132u8, 181u8, - 114u8, 150u8, 242u8, 202u8, 31u8, 143u8, 212u8, 65u8, 145u8, 249u8, - 27u8, 204u8, 137u8, 133u8, 220u8, 187u8, 137u8, 90u8, 112u8, 55u8, - 104u8, 163u8, + 67u8, 88u8, 206u8, 192u8, 83u8, 144u8, 233u8, 210u8, 232u8, 59u8, + 203u8, 131u8, 215u8, 66u8, 14u8, 157u8, 152u8, 58u8, 100u8, 175u8, + 140u8, 211u8, 14u8, 72u8, 164u8, 116u8, 68u8, 19u8, 182u8, 39u8, 6u8, + 172u8, ], ) } - #[doc = "See [`Pallet::execute_overweight`]."] - pub fn execute_overweight( + #[doc = " Temporary leaf storage for while the block is still executing."] + pub fn intermediate_leaves( &self, - message_origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - page: ::core::primitive::u32, - index: ::core::primitive::u32, - weight_limit: runtime_types::sp_weights::weight_v2::Weight, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "MessageQueue", - "execute_overweight", - types::ExecuteOverweight { message_origin, page, index, weight_limit }, + _0: impl ::std::borrow::Borrow<::core::primitive::u64>, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_ismp::mmr::Leaf, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Mmr", + "IntermediateLeaves", + vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], [ - 177u8, 54u8, 82u8, 58u8, 94u8, 125u8, 241u8, 172u8, 52u8, 7u8, 236u8, - 80u8, 66u8, 99u8, 42u8, 199u8, 38u8, 195u8, 65u8, 118u8, 166u8, 246u8, - 239u8, 195u8, 144u8, 153u8, 155u8, 8u8, 224u8, 56u8, 106u8, 135u8, + 172u8, 2u8, 97u8, 32u8, 237u8, 83u8, 77u8, 54u8, 22u8, 14u8, 158u8, + 94u8, 207u8, 41u8, 231u8, 213u8, 14u8, 54u8, 32u8, 152u8, 62u8, 100u8, + 23u8, 16u8, 224u8, 228u8, 122u8, 23u8, 35u8, 220u8, 82u8, 54u8, ], ) } - } - } - #[doc = "The `Event` enum of this pallet"] - pub type Event = runtime_types::pallet_message_queue::pallet::Event; - pub mod events { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Message discarded due to an error in the `MessageProcessor` (usually a format error)."] - pub struct ProcessingFailed { - pub id: ::subxt::utils::H256, - pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - pub error: runtime_types::frame_support::traits::messages::ProcessMessageError, - } - impl ::subxt::events::StaticEvent for ProcessingFailed { - const PALLET: &'static str = "MessageQueue"; - const EVENT: &'static str = "ProcessingFailed"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Message is processed."] - pub struct Processed { - pub id: ::subxt::utils::H256, - pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - pub weight_used: runtime_types::sp_weights::weight_v2::Weight, - pub success: ::core::primitive::bool, - } - impl ::subxt::events::StaticEvent for Processed { - const PALLET: &'static str = "MessageQueue"; - const EVENT: &'static str = "Processed"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Message placed in overweight queue."] - pub struct OverweightEnqueued { - pub id: [::core::primitive::u8; 32usize], - pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - pub page_index: ::core::primitive::u32, - pub message_index: ::core::primitive::u32, - } - impl ::subxt::events::StaticEvent for OverweightEnqueued { - const PALLET: &'static str = "MessageQueue"; - const EVENT: &'static str = "OverweightEnqueued"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "This page was reaped."] - pub struct PageReaped { - pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - pub index: ::core::primitive::u32, - } - impl ::subxt::events::StaticEvent for PageReaped { - const PALLET: &'static str = "MessageQueue"; - const EVENT: &'static str = "PageReaped"; - } - } - pub mod storage { - use super::runtime_types; - pub struct StorageApi; - impl StorageApi { - #[doc = " The index of the first and last (non-empty) pages."] - pub fn book_state_for( - &self, - _0: impl ::std::borrow::Borrow< - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - >, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_message_queue::BookState< - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - >, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "MessageQueue", - "BookStateFor", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 33u8, 240u8, 235u8, 59u8, 150u8, 42u8, 91u8, 248u8, 235u8, 52u8, 170u8, - 52u8, 195u8, 129u8, 6u8, 174u8, 57u8, 242u8, 30u8, 220u8, 232u8, 4u8, - 246u8, 218u8, 162u8, 174u8, 102u8, 95u8, 210u8, 92u8, 133u8, 143u8, - ], - ) - } - #[doc = " The index of the first and last (non-empty) pages."] - pub fn book_state_for_root( + #[doc = " Temporary leaf storage for while the block is still executing."] + pub fn intermediate_leaves_root( &self, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_message_queue::BookState< - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - >, + runtime_types::pallet_ismp::mmr::Leaf, + (), (), - ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "MessageQueue", - "BookStateFor", + "Mmr", + "IntermediateLeaves", Vec::new(), [ - 33u8, 240u8, 235u8, 59u8, 150u8, 42u8, 91u8, 248u8, 235u8, 52u8, 170u8, - 52u8, 195u8, 129u8, 6u8, 174u8, 57u8, 242u8, 30u8, 220u8, 232u8, 4u8, - 246u8, 218u8, 162u8, 174u8, 102u8, 95u8, 210u8, 92u8, 133u8, 143u8, + 172u8, 2u8, 97u8, 32u8, 237u8, 83u8, 77u8, 54u8, 22u8, 14u8, 158u8, + 94u8, 207u8, 41u8, 231u8, 213u8, 14u8, 54u8, 32u8, 152u8, 62u8, 100u8, + 23u8, 16u8, 224u8, 228u8, 122u8, 23u8, 35u8, 220u8, 82u8, 54u8, ], ) } - #[doc = " The origin at which we should begin servicing."] - pub fn service_head( + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_intermediate_leaves( &self, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + ::core::primitive::u32, + ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, - (), (), > { ::subxt::storage::address::Address::new_static( - "MessageQueue", - "ServiceHead", + "Mmr", + "CounterForIntermediateLeaves", vec![], [ - 104u8, 146u8, 240u8, 41u8, 171u8, 68u8, 20u8, 147u8, 212u8, 155u8, - 59u8, 39u8, 174u8, 186u8, 97u8, 250u8, 41u8, 247u8, 67u8, 190u8, 252u8, - 167u8, 234u8, 36u8, 124u8, 239u8, 163u8, 72u8, 223u8, 82u8, 82u8, - 171u8, + 5u8, 41u8, 150u8, 31u8, 198u8, 235u8, 232u8, 184u8, 57u8, 45u8, 107u8, + 139u8, 204u8, 104u8, 99u8, 171u8, 148u8, 230u8, 234u8, 104u8, 61u8, + 159u8, 87u8, 200u8, 138u8, 40u8, 123u8, 108u8, 248u8, 226u8, 14u8, + 185u8, ], ) } - #[doc = " The map of page indices to pages."] - pub fn pages( + #[doc = " Hashes of the nodes in the MMR."] + #[doc = ""] + #[doc = " Note this collection only contains MMR peaks, the inner nodes (and leaves)"] + #[doc = " are pruned and only stored in the Offchain DB."] + pub fn nodes( &self, - _0: impl ::std::borrow::Borrow< - runtime_types::cumulus_primitives_core::AggregateMessageOrigin, - >, - _1: impl ::std::borrow::Borrow<::core::primitive::u32>, + _0: impl ::std::borrow::Borrow<::core::primitive::u64>, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_message_queue::Page<::core::primitive::u32>, + ::subxt::utils::H256, ::subxt::storage::address::Yes, (), ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "MessageQueue", - "Pages", - vec![ - ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), - ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), - ], + "Mmr", + "Nodes", + vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], [ - 45u8, 202u8, 18u8, 128u8, 31u8, 194u8, 175u8, 173u8, 99u8, 81u8, 161u8, - 44u8, 32u8, 183u8, 238u8, 181u8, 110u8, 240u8, 203u8, 12u8, 152u8, - 58u8, 239u8, 190u8, 144u8, 168u8, 210u8, 33u8, 121u8, 250u8, 137u8, - 142u8, + 27u8, 84u8, 41u8, 195u8, 146u8, 81u8, 211u8, 189u8, 63u8, 125u8, 173u8, + 206u8, 69u8, 198u8, 202u8, 213u8, 89u8, 31u8, 89u8, 177u8, 76u8, 154u8, + 249u8, 197u8, 133u8, 78u8, 142u8, 71u8, 183u8, 3u8, 132u8, 25u8, ], ) } - #[doc = " The map of page indices to pages."] - pub fn pages_root( + #[doc = " Hashes of the nodes in the MMR."] + #[doc = ""] + #[doc = " Note this collection only contains MMR peaks, the inner nodes (and leaves)"] + #[doc = " are pruned and only stored in the Offchain DB."] + pub fn nodes_root( &self, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_message_queue::Page<::core::primitive::u32>, + ::subxt::utils::H256, (), (), ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "MessageQueue", - "Pages", + "Mmr", + "Nodes", Vec::new(), [ - 45u8, 202u8, 18u8, 128u8, 31u8, 194u8, 175u8, 173u8, 99u8, 81u8, 161u8, - 44u8, 32u8, 183u8, 238u8, 181u8, 110u8, 240u8, 203u8, 12u8, 152u8, - 58u8, 239u8, 190u8, 144u8, 168u8, 210u8, 33u8, 121u8, 250u8, 137u8, - 142u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " The size of the page; this implies the maximum message size which can be sent."] - #[doc = ""] - #[doc = " A good value depends on the expected message sizes, their weights, the weight that is"] - #[doc = " available for processing them and the maximal needed message size. The maximal message"] - #[doc = " size is slightly lower than this as defined by [`MaxMessageLenOf`]."] - pub fn heap_size(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "MessageQueue", - "HeapSize", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, - 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, - 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, - 145u8, - ], - ) - } - #[doc = " The maximum number of stale pages (i.e. of overweight messages) allowed before culling"] - #[doc = " can happen. Once there are more stale pages than this, then historical pages may be"] - #[doc = " dropped, even if they contain unprocessed overweight messages."] - pub fn max_stale(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "MessageQueue", - "MaxStale", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, - 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, - 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, - 145u8, + 27u8, 84u8, 41u8, 195u8, 146u8, 81u8, 211u8, 189u8, 63u8, 125u8, 173u8, + 206u8, 69u8, 198u8, 202u8, 213u8, 89u8, 31u8, 89u8, 177u8, 76u8, 154u8, + 249u8, 197u8, 133u8, 78u8, 142u8, 71u8, 183u8, 3u8, 132u8, 25u8, ], ) } - #[doc = " The amount of weight (if any) which should be provided to the message queue for"] - #[doc = " servicing enqueued items."] - #[doc = ""] - #[doc = " This may be legitimately `None` in the case that you will call"] - #[doc = " `ServiceQueues::service_queues` manually."] - pub fn service_weight( + #[doc = "Counter for the related counted storage map"] + pub fn counter_for_nodes( &self, - ) -> ::subxt::constants::Address< - ::core::option::Option, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + ::core::primitive::u32, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + (), > { - ::subxt::constants::Address::new_static( - "MessageQueue", - "ServiceWeight", + ::subxt::storage::address::Address::new_static( + "Mmr", + "CounterForNodes", + vec![], [ - 204u8, 140u8, 63u8, 167u8, 49u8, 8u8, 148u8, 163u8, 190u8, 224u8, 15u8, - 103u8, 86u8, 153u8, 248u8, 117u8, 223u8, 117u8, 210u8, 80u8, 205u8, - 155u8, 40u8, 11u8, 59u8, 63u8, 129u8, 156u8, 17u8, 83u8, 177u8, 250u8, + 43u8, 207u8, 89u8, 208u8, 61u8, 32u8, 136u8, 156u8, 10u8, 31u8, 25u8, + 125u8, 208u8, 48u8, 145u8, 54u8, 155u8, 28u8, 243u8, 159u8, 214u8, + 195u8, 13u8, 219u8, 158u8, 46u8, 174u8, 61u8, 85u8, 48u8, 182u8, 35u8, ], ) } @@ -8951,9 +8867,10 @@ pub mod api { "handle", types::Handle { messages }, [ - 192u8, 44u8, 254u8, 172u8, 24u8, 53u8, 58u8, 86u8, 6u8, 180u8, 130u8, - 117u8, 120u8, 97u8, 88u8, 34u8, 156u8, 107u8, 146u8, 147u8, 34u8, 96u8, - 82u8, 128u8, 89u8, 46u8, 66u8, 145u8, 235u8, 196u8, 225u8, 209u8, + 35u8, 201u8, 248u8, 163u8, 33u8, 231u8, 183u8, 60u8, 164u8, 53u8, + 179u8, 60u8, 105u8, 69u8, 251u8, 153u8, 139u8, 141u8, 44u8, 197u8, + 124u8, 189u8, 55u8, 30u8, 67u8, 248u8, 129u8, 78u8, 121u8, 202u8, 47u8, + 227u8, ], ) } @@ -9001,10 +8918,10 @@ pub mod api { "validate_messages", types::ValidateMessages { messages }, [ - 237u8, 199u8, 118u8, 107u8, 240u8, 108u8, 176u8, 194u8, 116u8, 19u8, - 246u8, 24u8, 178u8, 209u8, 45u8, 172u8, 225u8, 145u8, 134u8, 194u8, - 222u8, 158u8, 86u8, 175u8, 186u8, 223u8, 216u8, 80u8, 87u8, 122u8, - 251u8, 231u8, + 144u8, 222u8, 18u8, 46u8, 111u8, 117u8, 19u8, 9u8, 192u8, 33u8, 224u8, + 197u8, 195u8, 157u8, 125u8, 72u8, 243u8, 41u8, 78u8, 82u8, 206u8, + 112u8, 143u8, 43u8, 92u8, 146u8, 105u8, 123u8, 175u8, 132u8, 95u8, + 14u8, ], ) } @@ -9043,13 +8960,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Indicates that a consensus client has been created"] - pub struct ConsensusClientCreated { - pub consensus_client_id: [::core::primitive::u8; 4usize], + #[doc = "Emitted when a state commitment is vetoed by a fisherman"] + pub struct StateCommitmentVetoed { + pub height: runtime_types::ismp::consensus::StateMachineHeight, + pub fisherman: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, } - impl ::subxt::events::StaticEvent for ConsensusClientCreated { + impl ::subxt::events::StaticEvent for StateCommitmentVetoed { const PALLET: &'static str = "Ismp"; - const EVENT: &'static str = "ConsensusClientCreated"; + const EVENT: &'static str = "StateCommitmentVetoed"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -9062,10 +8982,28 @@ pub mod api { #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] #[doc = "Indicates that a consensus client has been created"] - pub struct ConsensusClientFrozen { + pub struct ConsensusClientCreated { pub consensus_client_id: [::core::primitive::u8; 4usize], } - impl ::subxt::events::StaticEvent for ConsensusClientFrozen { + impl ::subxt::events::StaticEvent for ConsensusClientCreated { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "ConsensusClientCreated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Indicates that a consensus client has been created"] + pub struct ConsensusClientFrozen { + pub consensus_client_id: [::core::primitive::u8; 4usize], + } + impl ::subxt::events::StaticEvent for ConsensusClientFrozen { const PALLET: &'static str = "Ismp"; const EVENT: &'static str = "ConsensusClientFrozen"; } @@ -9129,102 +9067,107 @@ pub mod api { const PALLET: &'static str = "Ismp"; const EVENT: &'static str = "Errors"; } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Post Request Handled"] + pub struct PostRequestHandled(pub runtime_types::ismp::events::RequestResponseHandled); + impl ::subxt::events::StaticEvent for PostRequestHandled { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "PostRequestHandled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Post Response Handled"] + pub struct PostResponseHandled(pub runtime_types::ismp::events::RequestResponseHandled); + impl ::subxt::events::StaticEvent for PostResponseHandled { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "PostResponseHandled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Get Response Handled"] + pub struct GetRequestHandled(pub runtime_types::ismp::events::RequestResponseHandled); + impl ::subxt::events::StaticEvent for GetRequestHandled { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "GetRequestHandled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Post request timeout handled"] + pub struct PostRequestTimeoutHandled(pub runtime_types::ismp::events::TimeoutHandled); + impl ::subxt::events::StaticEvent for PostRequestTimeoutHandled { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "PostRequestTimeoutHandled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Post response timeout handled"] + pub struct PostResponseTimeoutHandled(pub runtime_types::ismp::events::TimeoutHandled); + impl ::subxt::events::StaticEvent for PostResponseTimeoutHandled { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "PostResponseTimeoutHandled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Get request timeout handled"] + pub struct GetRequestTimeoutHandled(pub runtime_types::ismp::events::TimeoutHandled); + impl ::subxt::events::StaticEvent for GetRequestTimeoutHandled { + const PALLET: &'static str = "Ismp"; + const EVENT: &'static str = "GetRequestTimeoutHandled"; + } } pub mod storage { use super::runtime_types; pub struct StorageApi; impl StorageApi { - #[doc = " Latest MMR Root hash"] - pub fn root_hash( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::subxt::utils::H256, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "RootHash", - vec![], - [ - 111u8, 206u8, 173u8, 92u8, 67u8, 49u8, 150u8, 113u8, 90u8, 245u8, 38u8, - 254u8, 76u8, 250u8, 167u8, 66u8, 130u8, 129u8, 251u8, 220u8, 172u8, - 229u8, 162u8, 251u8, 36u8, 227u8, 43u8, 189u8, 7u8, 106u8, 23u8, 13u8, - ], - ) - } - #[doc = " Current size of the MMR (number of leaves) for requests."] - pub fn number_of_leaves( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::u64, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "NumberOfLeaves", - vec![], - [ - 123u8, 58u8, 149u8, 174u8, 85u8, 45u8, 20u8, 115u8, 241u8, 0u8, 51u8, - 174u8, 234u8, 60u8, 230u8, 59u8, 237u8, 144u8, 170u8, 32u8, 4u8, 0u8, - 34u8, 163u8, 238u8, 205u8, 93u8, 208u8, 53u8, 38u8, 141u8, 195u8, - ], - ) - } - #[doc = " Hashes of the nodes in the MMR for requests."] - #[doc = ""] - #[doc = " Note this collection only contains MMR peaks, the inner nodes (and leaves)"] - #[doc = " are pruned and only stored in the Offchain DB."] - pub fn nodes( - &self, - _0: impl ::std::borrow::Borrow<::core::primitive::u64>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::subxt::utils::H256, - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "Nodes", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 27u8, 84u8, 41u8, 195u8, 146u8, 81u8, 211u8, 189u8, 63u8, 125u8, 173u8, - 206u8, 69u8, 198u8, 202u8, 213u8, 89u8, 31u8, 89u8, 177u8, 76u8, 154u8, - 249u8, 197u8, 133u8, 78u8, 142u8, 71u8, 183u8, 3u8, 132u8, 25u8, - ], - ) - } - #[doc = " Hashes of the nodes in the MMR for requests."] - #[doc = ""] - #[doc = " Note this collection only contains MMR peaks, the inner nodes (and leaves)"] - #[doc = " are pruned and only stored in the Offchain DB."] - pub fn nodes_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::subxt::utils::H256, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "Nodes", - Vec::new(), - [ - 27u8, 84u8, 41u8, 195u8, 146u8, 81u8, 211u8, 189u8, 63u8, 125u8, 173u8, - 206u8, 69u8, 198u8, 202u8, 213u8, 89u8, 31u8, 89u8, 177u8, 76u8, 154u8, - 249u8, 197u8, 133u8, 78u8, 142u8, 71u8, 183u8, 3u8, 132u8, 25u8, - ], - ) - } #[doc = " Holds a map of state machine heights to their verified state commitments"] pub fn state_commitments( &self, @@ -9671,51 +9614,6 @@ pub mod api { ], ) } - #[doc = " Commitments for outgoing requests"] - #[doc = " The key is the request commitment"] - pub fn request_commitments( - &self, - _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::dispatcher::LeafMetadata, - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "RequestCommitments", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 195u8, 10u8, 108u8, 96u8, 190u8, 160u8, 85u8, 17u8, 45u8, 1u8, 87u8, - 10u8, 234u8, 233u8, 33u8, 146u8, 72u8, 66u8, 177u8, 108u8, 113u8, - 210u8, 47u8, 97u8, 71u8, 9u8, 35u8, 107u8, 38u8, 154u8, 143u8, 172u8, - ], - ) - } - #[doc = " Commitments for outgoing requests"] - #[doc = " The key is the request commitment"] - pub fn request_commitments_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::dispatcher::LeafMetadata, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "RequestCommitments", - Vec::new(), - [ - 195u8, 10u8, 108u8, 96u8, 190u8, 160u8, 85u8, 17u8, 45u8, 1u8, 87u8, - 10u8, 234u8, 233u8, 33u8, 146u8, 72u8, 66u8, 177u8, 108u8, 113u8, - 210u8, 47u8, 97u8, 71u8, 9u8, 35u8, 107u8, 38u8, 154u8, 143u8, 172u8, - ], - ) - } #[doc = " Tracks requests that have been responded to"] #[doc = " The key is the request commitment"] pub fn responded( @@ -9761,327 +9659,58 @@ pub mod api { ], ) } - #[doc = " Commitments for outgoing responses"] - #[doc = " The key is the response commitment"] - pub fn response_commitments( + #[doc = " Latest nonce for messages sent from this chain"] + pub fn nonce( &self, - _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::dispatcher::LeafMetadata, + ::core::primitive::u64, ::subxt::storage::address::Yes, - (), ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "ResponseCommitments", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 198u8, 67u8, 35u8, 28u8, 68u8, 37u8, 106u8, 235u8, 189u8, 109u8, 250u8, - 65u8, 19u8, 120u8, 154u8, 179u8, 105u8, 54u8, 181u8, 236u8, 168u8, - 195u8, 81u8, 156u8, 29u8, 43u8, 86u8, 173u8, 43u8, 244u8, 23u8, 43u8, - ], - ) - } - #[doc = " Commitments for outgoing responses"] - #[doc = " The key is the response commitment"] - pub fn response_commitments_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::dispatcher::LeafMetadata, - (), (), - ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( "Ismp", - "ResponseCommitments", - Vec::new(), + "Nonce", + vec![], [ - 198u8, 67u8, 35u8, 28u8, 68u8, 37u8, 106u8, 235u8, 189u8, 109u8, 250u8, - 65u8, 19u8, 120u8, 154u8, 179u8, 105u8, 54u8, 181u8, 236u8, 168u8, - 195u8, 81u8, 156u8, 29u8, 43u8, 86u8, 173u8, 43u8, 244u8, 23u8, 43u8, + 47u8, 101u8, 89u8, 252u8, 98u8, 25u8, 178u8, 154u8, 17u8, 57u8, 185u8, + 10u8, 133u8, 94u8, 73u8, 160u8, 137u8, 150u8, 97u8, 119u8, 8u8, 146u8, + 149u8, 146u8, 212u8, 60u8, 141u8, 24u8, 124u8, 28u8, 57u8, 19u8, ], ) } - #[doc = " Receipts for incoming requests"] - #[doc = " The key is the request commitment"] - pub fn request_receipts( + #[doc = " Contains a tuple of the weight consumed and weight limit in executing contract callbacks in"] + #[doc = " a transaction"] + pub fn weight_consumed( &self, - _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - ::std::vec::Vec<::core::primitive::u8>, + runtime_types::pallet_ismp::primitives::WeightUsed, ::subxt::storage::address::Yes, - (), ::subxt::storage::address::Yes, + (), > { ::subxt::storage::address::Address::new_static( "Ismp", - "RequestReceipts", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], + "WeightConsumed", + vec![], [ - 240u8, 204u8, 132u8, 131u8, 113u8, 55u8, 3u8, 98u8, 255u8, 245u8, - 185u8, 99u8, 253u8, 239u8, 75u8, 219u8, 19u8, 114u8, 234u8, 194u8, - 117u8, 17u8, 224u8, 11u8, 206u8, 178u8, 135u8, 229u8, 17u8, 163u8, - 101u8, 246u8, - ], - ) - } - #[doc = " Receipts for incoming requests"] - #[doc = " The key is the request commitment"] - pub fn request_receipts_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::std::vec::Vec<::core::primitive::u8>, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "RequestReceipts", - Vec::new(), - [ - 240u8, 204u8, 132u8, 131u8, 113u8, 55u8, 3u8, 98u8, 255u8, 245u8, - 185u8, 99u8, 253u8, 239u8, 75u8, 219u8, 19u8, 114u8, 234u8, 194u8, - 117u8, 17u8, 224u8, 11u8, 206u8, 178u8, 135u8, 229u8, 17u8, 163u8, - 101u8, 246u8, - ], - ) - } - #[doc = " Receipts for incoming responses"] - #[doc = " The key is the request commitment"] - pub fn response_receipts( - &self, - _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::ResponseReceipt, - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "ResponseReceipts", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 151u8, 13u8, 116u8, 90u8, 182u8, 167u8, 219u8, 13u8, 37u8, 53u8, 130u8, - 238u8, 254u8, 117u8, 36u8, 199u8, 68u8, 0u8, 175u8, 157u8, 225u8, - 174u8, 13u8, 155u8, 187u8, 248u8, 174u8, 139u8, 65u8, 195u8, 1u8, 84u8, - ], - ) - } - #[doc = " Receipts for incoming responses"] - #[doc = " The key is the request commitment"] - pub fn response_receipts_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::ResponseReceipt, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "ResponseReceipts", - Vec::new(), - [ - 151u8, 13u8, 116u8, 90u8, 182u8, 167u8, 219u8, 13u8, 37u8, 53u8, 130u8, - 238u8, 254u8, 117u8, 36u8, 199u8, 68u8, 0u8, 175u8, 157u8, 225u8, - 174u8, 13u8, 155u8, 187u8, 248u8, 174u8, 139u8, 65u8, 195u8, 1u8, 84u8, - ], - ) - } - #[doc = " Latest nonce for messages sent from this chain"] - pub fn nonce( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::u64, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "Nonce", - vec![], - [ - 47u8, 101u8, 89u8, 252u8, 98u8, 25u8, 178u8, 154u8, 17u8, 57u8, 185u8, - 10u8, 133u8, 94u8, 73u8, 160u8, 137u8, 150u8, 97u8, 119u8, 8u8, 146u8, - 149u8, 146u8, 212u8, 60u8, 141u8, 24u8, 124u8, 28u8, 57u8, 19u8, - ], - ) - } - #[doc = " Contains a tuple of the weight consumed and weight limit in executing contract callbacks in"] - #[doc = " a transaction"] - pub fn weight_consumed( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::primitives::WeightUsed, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "WeightConsumed", - vec![], - [ - 220u8, 190u8, 35u8, 208u8, 219u8, 235u8, 179u8, 113u8, 54u8, 170u8, - 151u8, 88u8, 121u8, 112u8, 50u8, 44u8, 164u8, 150u8, 180u8, 61u8, 18u8, - 65u8, 59u8, 75u8, 123u8, 181u8, 181u8, 174u8, 97u8, 252u8, 49u8, 163u8, - ], - ) - } - #[doc = " Mmr positions to commitments"] - pub fn mmr_positions( - &self, - _0: impl ::std::borrow::Borrow<::core::primitive::u64>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::subxt::utils::H256, - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "MmrPositions", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 251u8, 16u8, 69u8, 175u8, 154u8, 157u8, 135u8, 124u8, 1u8, 248u8, - 147u8, 211u8, 25u8, 88u8, 223u8, 52u8, 55u8, 119u8, 58u8, 112u8, 183u8, - 172u8, 143u8, 124u8, 244u8, 45u8, 122u8, 111u8, 59u8, 73u8, 2u8, 107u8, - ], - ) - } - #[doc = " Mmr positions to commitments"] - pub fn mmr_positions_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::subxt::utils::H256, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "MmrPositions", - Vec::new(), - [ - 251u8, 16u8, 69u8, 175u8, 154u8, 157u8, 135u8, 124u8, 1u8, 248u8, - 147u8, 211u8, 25u8, 88u8, 223u8, 52u8, 55u8, 119u8, 58u8, 112u8, 183u8, - 172u8, 143u8, 124u8, 244u8, 45u8, 122u8, 111u8, 59u8, 73u8, 2u8, 107u8, - ], - ) - } - #[doc = " Temporary leaf storage for when the block is still executing"] - pub fn intermediate_leaves( - &self, - _0: impl ::std::borrow::Borrow<::core::primitive::u64>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::mmr_primitives::Leaf, - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "IntermediateLeaves", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 241u8, 90u8, 155u8, 244u8, 174u8, 15u8, 201u8, 25u8, 210u8, 117u8, - 43u8, 195u8, 65u8, 246u8, 227u8, 164u8, 239u8, 191u8, 122u8, 42u8, - 14u8, 220u8, 0u8, 248u8, 17u8, 170u8, 220u8, 182u8, 58u8, 241u8, 135u8, - 51u8, - ], - ) - } - #[doc = " Temporary leaf storage for when the block is still executing"] - pub fn intermediate_leaves_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - runtime_types::pallet_ismp::mmr_primitives::Leaf, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "IntermediateLeaves", - Vec::new(), - [ - 241u8, 90u8, 155u8, 244u8, 174u8, 15u8, 201u8, 25u8, 210u8, 117u8, - 43u8, 195u8, 65u8, 246u8, 227u8, 164u8, 239u8, 191u8, 122u8, 42u8, - 14u8, 220u8, 0u8, 248u8, 17u8, 170u8, 220u8, 182u8, 58u8, 241u8, 135u8, - 51u8, - ], - ) - } - #[doc = "Counter for the related counted storage map"] - pub fn counter_for_intermediate_leaves( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::u32, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "CounterForIntermediateLeaves", - vec![], - [ - 5u8, 41u8, 150u8, 31u8, 198u8, 235u8, 232u8, 184u8, 57u8, 45u8, 107u8, - 139u8, 204u8, 104u8, 99u8, 171u8, 148u8, 230u8, 234u8, 104u8, 61u8, - 159u8, 87u8, 200u8, 138u8, 40u8, 123u8, 108u8, 248u8, 226u8, 14u8, - 185u8, - ], - ) - } - #[doc = " Temporary store to increment the leaf index as the block is executed"] - pub fn intermediate_number_of_leaves( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::u64, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Ismp", - "IntermediateNumberOfLeaves", - vec![], - [ - 130u8, 92u8, 197u8, 212u8, 241u8, 73u8, 108u8, 191u8, 243u8, 217u8, - 159u8, 131u8, 11u8, 42u8, 179u8, 202u8, 254u8, 171u8, 179u8, 182u8, - 207u8, 182u8, 194u8, 67u8, 15u8, 189u8, 81u8, 5u8, 122u8, 224u8, 13u8, - 26u8, + 220u8, 190u8, 35u8, 208u8, 219u8, 235u8, 179u8, 113u8, 54u8, 170u8, + 151u8, 88u8, 121u8, 112u8, 50u8, 44u8, 164u8, 150u8, 180u8, 61u8, 18u8, + 65u8, 59u8, 75u8, 123u8, 181u8, 181u8, 174u8, 97u8, 252u8, 49u8, 163u8, ], ) } } } } - pub mod ismp_sync_committee { + pub mod message_queue { use super::{root_mod, runtime_types}; #[doc = "The `Error` enum of this pallet."] - pub type Error = runtime_types::ismp_sync_committee::pallet::pallet::Error; + pub type Error = runtime_types::pallet_message_queue::pallet::Error; #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::ismp_sync_committee::pallet::pallet::Call; + pub type Call = runtime_types::pallet_message_queue::pallet::Call; pub mod calls { use super::{root_mod, runtime_types}; type DispatchError = runtime_types::sp_runtime::DispatchError; @@ -10097,13 +9726,14 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AddIsmpAddress { - pub contract_address: ::subxt::utils::H160, - pub state_machine_id: runtime_types::ismp::consensus::StateMachineId, + pub struct ReapPage { + pub message_origin: + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + pub page_index: ::core::primitive::u32, } - impl ::subxt::blocks::StaticExtrinsic for AddIsmpAddress { - const PALLET: &'static str = "IsmpSyncCommittee"; - const CALL: &'static str = "add_ismp_address"; + impl ::subxt::blocks::StaticExtrinsic for ReapPage { + const PALLET: &'static str = "MessageQueue"; + const CALL: &'static str = "reap_page"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10115,181 +9745,61 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AddL2Oracle { - pub state_machine_id: runtime_types::ismp::consensus::StateMachineId, - pub l2_oracle: ::subxt::utils::H160, + pub struct ExecuteOverweight { + pub message_origin: + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + pub page: ::core::primitive::u32, + pub index: ::core::primitive::u32, + pub weight_limit: runtime_types::sp_weights::weight_v2::Weight, } - impl ::subxt::blocks::StaticExtrinsic for AddL2Oracle { - const PALLET: &'static str = "IsmpSyncCommittee"; - const CALL: &'static str = "add_l2_oracle"; + impl ::subxt::blocks::StaticExtrinsic for ExecuteOverweight { + const PALLET: &'static str = "MessageQueue"; + const CALL: &'static str = "execute_overweight"; } } pub struct TransactionApi; impl TransactionApi { - #[doc = "See [`Pallet::add_ismp_address`]."] - pub fn add_ismp_address( + #[doc = "See [`Pallet::reap_page`]."] + pub fn reap_page( &self, - contract_address: ::subxt::utils::H160, - state_machine_id: runtime_types::ismp::consensus::StateMachineId, - ) -> ::subxt::tx::Payload { + message_origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + page_index: ::core::primitive::u32, + ) -> ::subxt::tx::Payload { ::subxt::tx::Payload::new_static( - "IsmpSyncCommittee", - "add_ismp_address", - types::AddIsmpAddress { contract_address, state_machine_id }, + "MessageQueue", + "reap_page", + types::ReapPage { message_origin, page_index }, [ - 120u8, 224u8, 122u8, 215u8, 112u8, 46u8, 132u8, 237u8, 188u8, 109u8, - 145u8, 199u8, 145u8, 230u8, 235u8, 214u8, 224u8, 240u8, 237u8, 136u8, - 158u8, 127u8, 9u8, 225u8, 149u8, 121u8, 54u8, 100u8, 165u8, 226u8, - 251u8, 148u8, + 116u8, 17u8, 120u8, 238u8, 117u8, 222u8, 10u8, 166u8, 132u8, 181u8, + 114u8, 150u8, 242u8, 202u8, 31u8, 143u8, 212u8, 65u8, 145u8, 249u8, + 27u8, 204u8, 137u8, 133u8, 220u8, 187u8, 137u8, 90u8, 112u8, 55u8, + 104u8, 163u8, ], ) } - #[doc = "See [`Pallet::add_l2_oracle`]."] - pub fn add_l2_oracle( + #[doc = "See [`Pallet::execute_overweight`]."] + pub fn execute_overweight( &self, - state_machine_id: runtime_types::ismp::consensus::StateMachineId, - l2_oracle: ::subxt::utils::H160, - ) -> ::subxt::tx::Payload { + message_origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + page: ::core::primitive::u32, + index: ::core::primitive::u32, + weight_limit: runtime_types::sp_weights::weight_v2::Weight, + ) -> ::subxt::tx::Payload { ::subxt::tx::Payload::new_static( - "IsmpSyncCommittee", - "add_l2_oracle", - types::AddL2Oracle { state_machine_id, l2_oracle }, + "MessageQueue", + "execute_overweight", + types::ExecuteOverweight { message_origin, page, index, weight_limit }, [ - 97u8, 39u8, 161u8, 7u8, 206u8, 44u8, 66u8, 63u8, 58u8, 71u8, 181u8, - 220u8, 195u8, 84u8, 121u8, 5u8, 140u8, 103u8, 103u8, 202u8, 15u8, - 198u8, 191u8, 211u8, 25u8, 50u8, 29u8, 139u8, 119u8, 46u8, 179u8, - 224u8, + 177u8, 54u8, 82u8, 58u8, 94u8, 125u8, 241u8, 172u8, 52u8, 7u8, 236u8, + 80u8, 66u8, 99u8, 42u8, 199u8, 38u8, 195u8, 65u8, 118u8, 166u8, 246u8, + 239u8, 195u8, 144u8, 153u8, 155u8, 8u8, 224u8, 56u8, 106u8, 135u8, ], ) } } } - } - pub mod ismp_demo { - use super::{root_mod, runtime_types}; - #[doc = "Pallet Errors"] - pub type Error = runtime_types::ismp_demo::pallet::Error; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::ismp_demo::pallet::Call; - pub mod calls { - use super::{root_mod, runtime_types}; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Transfer { - pub params: runtime_types::ismp_demo::pallet::TransferParams< - ::subxt::utils::AccountId32, - ::core::primitive::u128, - >, - } - impl ::subxt::blocks::StaticExtrinsic for Transfer { - const PALLET: &'static str = "IsmpDemo"; - const CALL: &'static str = "transfer"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetRequest { - pub params: runtime_types::ismp_demo::pallet::GetRequest, - } - impl ::subxt::blocks::StaticExtrinsic for GetRequest { - const PALLET: &'static str = "IsmpDemo"; - const CALL: &'static str = "get_request"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DispatchToEvm { - pub params: runtime_types::ismp_demo::pallet::EvmParams, - } - impl ::subxt::blocks::StaticExtrinsic for DispatchToEvm { - const PALLET: &'static str = "IsmpDemo"; - const CALL: &'static str = "dispatch_to_evm"; - } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::transfer`]."] - pub fn transfer( - &self, - params: runtime_types::ismp_demo::pallet::TransferParams< - ::subxt::utils::AccountId32, - ::core::primitive::u128, - >, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "IsmpDemo", - "transfer", - types::Transfer { params }, - [ - 218u8, 118u8, 134u8, 170u8, 56u8, 171u8, 160u8, 214u8, 245u8, 140u8, - 250u8, 11u8, 180u8, 224u8, 180u8, 59u8, 221u8, 47u8, 77u8, 145u8, - 131u8, 108u8, 165u8, 247u8, 46u8, 70u8, 206u8, 191u8, 175u8, 31u8, - 167u8, 16u8, - ], - ) - } - #[doc = "See [`Pallet::get_request`]."] - pub fn get_request( - &self, - params: runtime_types::ismp_demo::pallet::GetRequest, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "IsmpDemo", - "get_request", - types::GetRequest { params }, - [ - 245u8, 61u8, 107u8, 34u8, 240u8, 238u8, 158u8, 125u8, 148u8, 86u8, - 226u8, 142u8, 95u8, 4u8, 36u8, 84u8, 192u8, 186u8, 198u8, 181u8, 196u8, - 139u8, 185u8, 68u8, 218u8, 144u8, 86u8, 234u8, 206u8, 12u8, 140u8, - 160u8, - ], - ) - } - #[doc = "See [`Pallet::dispatch_to_evm`]."] - pub fn dispatch_to_evm( - &self, - params: runtime_types::ismp_demo::pallet::EvmParams, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "IsmpDemo", - "dispatch_to_evm", - types::DispatchToEvm { params }, - [ - 90u8, 46u8, 209u8, 62u8, 74u8, 11u8, 164u8, 147u8, 77u8, 155u8, 7u8, - 28u8, 219u8, 99u8, 25u8, 55u8, 122u8, 64u8, 32u8, 36u8, 39u8, 0u8, - 10u8, 81u8, 123u8, 12u8, 77u8, 112u8, 235u8, 211u8, 26u8, 253u8, - ], - ) - } - } - } - #[doc = "Pallet events"] - pub type Event = runtime_types::ismp_demo::pallet::Event; + #[doc = "The `Event` enum of this pallet"] + pub type Event = runtime_types::pallet_message_queue::pallet::Event; pub mod events { use super::runtime_types; #[derive( @@ -10302,16 +9812,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Some balance has been transferred"] - pub struct BalanceTransferred { - pub from: ::subxt::utils::AccountId32, - pub to: ::subxt::utils::AccountId32, - pub amount: ::core::primitive::u128, - pub dest_chain: runtime_types::ismp::host::StateMachine, + #[doc = "Message discarded due to an error in the `MessageProcessor` (usually a format error)."] + pub struct ProcessingFailed { + pub id: ::subxt::utils::H256, + pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + pub error: runtime_types::frame_support::traits::messages::ProcessMessageError, } - impl ::subxt::events::StaticEvent for BalanceTransferred { - const PALLET: &'static str = "IsmpDemo"; - const EVENT: &'static str = "BalanceTransferred"; + impl ::subxt::events::StaticEvent for ProcessingFailed { + const PALLET: &'static str = "MessageQueue"; + const EVENT: &'static str = "ProcessingFailed"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10323,16 +9832,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Some balance has been received"] - pub struct BalanceReceived { - pub from: ::subxt::utils::AccountId32, - pub to: ::subxt::utils::AccountId32, - pub amount: ::core::primitive::u128, - pub source_chain: runtime_types::ismp::host::StateMachine, + #[doc = "Message is processed."] + pub struct Processed { + pub id: ::subxt::utils::H256, + pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + pub weight_used: runtime_types::sp_weights::weight_v2::Weight, + pub success: ::core::primitive::bool, } - impl ::subxt::events::StaticEvent for BalanceReceived { - const PALLET: &'static str = "IsmpDemo"; - const EVENT: &'static str = "BalanceReceived"; + impl ::subxt::events::StaticEvent for Processed { + const PALLET: &'static str = "MessageQueue"; + const EVENT: &'static str = "Processed"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10344,14 +9853,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Request data receieved"] - pub struct Request { - pub source: runtime_types::ismp::host::StateMachine, - pub data: ::std::string::String, + #[doc = "Message placed in overweight queue."] + pub struct OverweightEnqueued { + pub id: [::core::primitive::u8; 32usize], + pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + pub page_index: ::core::primitive::u32, + pub message_index: ::core::primitive::u32, } - impl ::subxt::events::StaticEvent for Request { - const PALLET: &'static str = "IsmpDemo"; - const EVENT: &'static str = "Request"; + impl ::subxt::events::StaticEvent for OverweightEnqueued { + const PALLET: &'static str = "MessageQueue"; + const EVENT: &'static str = "OverweightEnqueued"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10363,304 +9874,209 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Get response recieved"] - pub struct GetResponse( - pub ::std::vec::Vec<::core::option::Option<::std::vec::Vec<::core::primitive::u8>>>, - ); - impl ::subxt::events::StaticEvent for GetResponse { - const PALLET: &'static str = "IsmpDemo"; - const EVENT: &'static str = "GetResponse"; + #[doc = "This page was reaped."] + pub struct PageReaped { + pub origin: runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + pub index: ::core::primitive::u32, } - } - } - pub mod relayer { - use super::{root_mod, runtime_types}; - #[doc = "The `Error` enum of this pallet."] - pub type Error = runtime_types::pallet_ismp_relayer::pallet::Error; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::pallet_ismp_relayer::pallet::Call; - pub mod calls { - use super::{root_mod, runtime_types}; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AccumulateFees { - pub withdrawal_proof: - runtime_types::pallet_ismp_relayer::withdrawal::WithdrawalProof, - } - impl ::subxt::blocks::StaticExtrinsic for AccumulateFees { - const PALLET: &'static str = "Relayer"; - const CALL: &'static str = "accumulate_fees"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct WithdrawFees { - pub withdrawal_data: - runtime_types::pallet_ismp_relayer::withdrawal::WithdrawalInputData, - } - impl ::subxt::blocks::StaticExtrinsic for WithdrawFees { - const PALLET: &'static str = "Relayer"; - const CALL: &'static str = "withdraw_fees"; - } + impl ::subxt::events::StaticEvent for PageReaped { + const PALLET: &'static str = "MessageQueue"; + const EVENT: &'static str = "PageReaped"; } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::accumulate_fees`]."] - pub fn accumulate_fees( + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " The index of the first and last (non-empty) pages."] + pub fn book_state_for( &self, - withdrawal_proof : runtime_types :: pallet_ismp_relayer :: withdrawal :: WithdrawalProof, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Relayer", - "accumulate_fees", - types::AccumulateFees { withdrawal_proof }, - [ - 158u8, 133u8, 3u8, 17u8, 100u8, 167u8, 94u8, 251u8, 15u8, 182u8, 175u8, - 183u8, 7u8, 50u8, 120u8, 82u8, 145u8, 239u8, 121u8, 139u8, 32u8, 132u8, - 44u8, 101u8, 243u8, 9u8, 81u8, 87u8, 66u8, 70u8, 102u8, 142u8, - ], - ) - } - #[doc = "See [`Pallet::withdraw_fees`]."] - pub fn withdraw_fees( - &self, - withdrawal_data : runtime_types :: pallet_ismp_relayer :: withdrawal :: WithdrawalInputData, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Relayer", - "withdraw_fees", - types::WithdrawFees { withdrawal_data }, - [ - 214u8, 208u8, 77u8, 176u8, 102u8, 217u8, 52u8, 182u8, 207u8, 67u8, - 79u8, 149u8, 176u8, 52u8, 110u8, 240u8, 169u8, 48u8, 235u8, 54u8, - 162u8, 111u8, 253u8, 36u8, 27u8, 197u8, 125u8, 10u8, 169u8, 241u8, - 246u8, 112u8, - ], - ) - } - } - } - #[doc = "Events emiited by the relayer pallet"] - pub type Event = runtime_types::pallet_ismp_relayer::pallet::Event; - pub mod events { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "A relayer with the `address` has accumulated some fees on the `state_machine`"] - pub struct AccumulateFees { - pub address: runtime_types::bounded_collections::bounded_vec::BoundedVec< - ::core::primitive::u8, - >, - pub state_machine: runtime_types::ismp::host::StateMachine, - pub amount: runtime_types::primitive_types::U256, - } - impl ::subxt::events::StaticEvent for AccumulateFees { - const PALLET: &'static str = "Relayer"; - const EVENT: &'static str = "AccumulateFees"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "A relayer with the the `address` has initiated a withdrawal on the `state_machine`"] - pub struct Withdraw { - pub address: runtime_types::bounded_collections::bounded_vec::BoundedVec< - ::core::primitive::u8, - >, - pub state_machine: runtime_types::ismp::host::StateMachine, - pub amount: runtime_types::primitive_types::U256, - } - impl ::subxt::events::StaticEvent for Withdraw { - const PALLET: &'static str = "Relayer"; - const EVENT: &'static str = "Withdraw"; - } - } - pub mod storage { - use super::runtime_types; - pub struct StorageApi; - impl StorageApi { - #[doc = " double map of address to source chain, which holds the amount of the relayer address"] - pub fn fees( - &self, - _0: impl ::std::borrow::Borrow, - _1: impl ::std::borrow::Borrow<[::core::primitive::u8]>, + _0: impl ::std::borrow::Borrow< + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + >, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::primitive_types::U256, + runtime_types::pallet_message_queue::BookState< + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + >, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "Relayer", - "Fees", - vec![ - ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), - ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), - ], + "MessageQueue", + "BookStateFor", + vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], [ - 101u8, 173u8, 207u8, 100u8, 23u8, 157u8, 168u8, 60u8, 218u8, 251u8, - 154u8, 121u8, 118u8, 108u8, 126u8, 251u8, 128u8, 77u8, 161u8, 227u8, - 201u8, 112u8, 76u8, 108u8, 14u8, 159u8, 67u8, 54u8, 59u8, 84u8, 47u8, - 9u8, + 33u8, 240u8, 235u8, 59u8, 150u8, 42u8, 91u8, 248u8, 235u8, 52u8, 170u8, + 52u8, 195u8, 129u8, 6u8, 174u8, 57u8, 242u8, 30u8, 220u8, 232u8, 4u8, + 246u8, 218u8, 162u8, 174u8, 102u8, 95u8, 210u8, 92u8, 133u8, 143u8, ], ) } - #[doc = " double map of address to source chain, which holds the amount of the relayer address"] - pub fn fees_root( + #[doc = " The index of the first and last (non-empty) pages."] + pub fn book_state_for_root( &self, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - runtime_types::primitive_types::U256, + runtime_types::pallet_message_queue::BookState< + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + >, (), ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "Relayer", - "Fees", + "MessageQueue", + "BookStateFor", Vec::new(), [ - 101u8, 173u8, 207u8, 100u8, 23u8, 157u8, 168u8, 60u8, 218u8, 251u8, - 154u8, 121u8, 118u8, 108u8, 126u8, 251u8, 128u8, 77u8, 161u8, 227u8, - 201u8, 112u8, 76u8, 108u8, 14u8, 159u8, 67u8, 54u8, 59u8, 84u8, 47u8, - 9u8, + 33u8, 240u8, 235u8, 59u8, 150u8, 42u8, 91u8, 248u8, 235u8, 52u8, 170u8, + 52u8, 195u8, 129u8, 6u8, 174u8, 57u8, 242u8, 30u8, 220u8, 232u8, 4u8, + 246u8, 218u8, 162u8, 174u8, 102u8, 95u8, 210u8, 92u8, 133u8, 143u8, ], ) } - #[doc = " Latest nonce for each address and the state machine they want to withdraw from"] - pub fn nonce( + #[doc = " The origin at which we should begin servicing."] + pub fn service_head( &self, - _0: impl ::std::borrow::Borrow<[::core::primitive::u8]>, - _1: impl ::std::borrow::Borrow, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::u64, + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::Address::new_static( + "MessageQueue", + "ServiceHead", + vec![], + [ + 104u8, 146u8, 240u8, 41u8, 171u8, 68u8, 20u8, 147u8, 212u8, 155u8, + 59u8, 39u8, 174u8, 186u8, 97u8, 250u8, 41u8, 247u8, 67u8, 190u8, 252u8, + 167u8, 234u8, 36u8, 124u8, 239u8, 163u8, 72u8, 223u8, 82u8, 82u8, + 171u8, + ], + ) + } + #[doc = " The map of page indices to pages."] + pub fn pages( + &self, + _0: impl ::std::borrow::Borrow< + runtime_types::cumulus_primitives_core::AggregateMessageOrigin, + >, + _1: impl ::std::borrow::Borrow<::core::primitive::u32>, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_message_queue::Page<::core::primitive::u32>, ::subxt::storage::address::Yes, + (), ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "Relayer", - "Nonce", + "MessageQueue", + "Pages", vec![ ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), ], [ - 198u8, 35u8, 9u8, 55u8, 199u8, 245u8, 28u8, 184u8, 253u8, 16u8, 58u8, - 174u8, 28u8, 28u8, 40u8, 185u8, 145u8, 16u8, 58u8, 80u8, 153u8, 151u8, - 83u8, 232u8, 20u8, 219u8, 39u8, 88u8, 28u8, 152u8, 114u8, 204u8, + 45u8, 202u8, 18u8, 128u8, 31u8, 194u8, 175u8, 173u8, 99u8, 81u8, 161u8, + 44u8, 32u8, 183u8, 238u8, 181u8, 110u8, 240u8, 203u8, 12u8, 152u8, + 58u8, 239u8, 190u8, 144u8, 168u8, 210u8, 33u8, 121u8, 250u8, 137u8, + 142u8, ], ) } - #[doc = " Latest nonce for each address and the state machine they want to withdraw from"] - pub fn nonce_root( + #[doc = " The map of page indices to pages."] + pub fn pages_root( &self, ) -> ::subxt::storage::address::Address< ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::u64, + runtime_types::pallet_message_queue::Page<::core::primitive::u32>, + (), (), - ::subxt::storage::address::Yes, ::subxt::storage::address::Yes, > { ::subxt::storage::address::Address::new_static( - "Relayer", - "Nonce", + "MessageQueue", + "Pages", Vec::new(), [ - 198u8, 35u8, 9u8, 55u8, 199u8, 245u8, 28u8, 184u8, 253u8, 16u8, 58u8, - 174u8, 28u8, 28u8, 40u8, 185u8, 145u8, 16u8, 58u8, 80u8, 153u8, 151u8, - 83u8, 232u8, 20u8, 219u8, 39u8, 88u8, 28u8, 152u8, 114u8, 204u8, + 45u8, 202u8, 18u8, 128u8, 31u8, 194u8, 175u8, 173u8, 99u8, 81u8, 161u8, + 44u8, 32u8, 183u8, 238u8, 181u8, 110u8, 240u8, 203u8, 12u8, 152u8, + 58u8, 239u8, 190u8, 144u8, 168u8, 210u8, 33u8, 121u8, 250u8, 137u8, + 142u8, ], ) } - #[doc = " Request and response commitments that have been claimed"] - pub fn claimed( - &self, - _0: impl ::std::borrow::Borrow<::subxt::utils::H256>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::bool, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Relayer", - "Claimed", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The size of the page; this implies the maximum message size which can be sent."] + #[doc = ""] + #[doc = " A good value depends on the expected message sizes, their weights, the weight that is"] + #[doc = " available for processing them and the maximal needed message size. The maximal message"] + #[doc = " size is slightly lower than this as defined by [`MaxMessageLenOf`]."] + pub fn heap_size(&self) -> ::subxt::constants::Address<::core::primitive::u32> { + ::subxt::constants::Address::new_static( + "MessageQueue", + "HeapSize", [ - 172u8, 193u8, 164u8, 35u8, 40u8, 35u8, 217u8, 209u8, 141u8, 218u8, - 195u8, 160u8, 124u8, 100u8, 81u8, 223u8, 247u8, 129u8, 55u8, 117u8, - 143u8, 196u8, 243u8, 5u8, 41u8, 139u8, 201u8, 226u8, 75u8, 133u8, 74u8, - 233u8, + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The maximum number of stale pages (i.e. of overweight messages) allowed before culling"] + #[doc = " can happen. Once there are more stale pages than this, then historical pages may be"] + #[doc = " dropped, even if they contain unprocessed overweight messages."] + pub fn max_stale(&self) -> ::subxt::constants::Address<::core::primitive::u32> { + ::subxt::constants::Address::new_static( + "MessageQueue", + "MaxStale", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, ], ) } - #[doc = " Request and response commitments that have been claimed"] - pub fn claimed_root( + #[doc = " The amount of weight (if any) which should be provided to the message queue for"] + #[doc = " servicing enqueued items."] + #[doc = ""] + #[doc = " This may be legitimately `None` in the case that you will call"] + #[doc = " `ServiceQueues::service_queues` manually."] + pub fn service_weight( &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::core::primitive::bool, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, + ) -> ::subxt::constants::Address< + ::core::option::Option, > { - ::subxt::storage::address::Address::new_static( - "Relayer", - "Claimed", - Vec::new(), + ::subxt::constants::Address::new_static( + "MessageQueue", + "ServiceWeight", [ - 172u8, 193u8, 164u8, 35u8, 40u8, 35u8, 217u8, 209u8, 141u8, 218u8, - 195u8, 160u8, 124u8, 100u8, 81u8, 223u8, 247u8, 129u8, 55u8, 117u8, - 143u8, 196u8, 243u8, 5u8, 41u8, 139u8, 201u8, 226u8, 75u8, 133u8, 74u8, - 233u8, + 204u8, 140u8, 63u8, 167u8, 49u8, 8u8, 148u8, 163u8, 190u8, 224u8, 15u8, + 103u8, 86u8, 153u8, 248u8, 117u8, 223u8, 117u8, 210u8, 80u8, 205u8, + 155u8, 40u8, 11u8, 59u8, 63u8, 129u8, 156u8, 17u8, 83u8, 177u8, 250u8, ], ) } } } } - pub mod state_machine_manager { + pub mod ismp_sync_committee { use super::{root_mod, runtime_types}; #[doc = "The `Error` enum of this pallet."] - pub type Error = runtime_types::state_machine_manager::pallet::Error; + pub type Error = runtime_types::ismp_sync_committee::pallet::pallet::Error; #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::state_machine_manager::pallet::Call; + pub type Call = runtime_types::ismp_sync_committee::pallet::pallet::Call; pub mod calls { use super::{root_mod, runtime_types}; type DispatchError = runtime_types::sp_runtime::DispatchError; @@ -10676,12 +10092,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AddWhitelistAccount { - pub account: ::subxt::utils::AccountId32, + pub struct AddIsmpAddress { + pub contract_address: ::subxt::utils::H160, + pub state_machine_id: runtime_types::ismp::consensus::StateMachineId, } - impl ::subxt::blocks::StaticExtrinsic for AddWhitelistAccount { - const PALLET: &'static str = "StateMachineManager"; - const CALL: &'static str = "add_whitelist_account"; + impl ::subxt::blocks::StaticExtrinsic for AddIsmpAddress { + const PALLET: &'static str = "IsmpSyncCommittee"; + const CALL: &'static str = "add_ismp_address"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10693,13 +10110,66 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct RemoveWhitelistAccount { - pub account: ::subxt::utils::AccountId32, + pub struct AddL2Consensus { + pub state_machine_id: runtime_types::ismp::consensus::StateMachineId, + pub l2_consensus: runtime_types::ismp_sync_committee::types::L2Consensus, + } + impl ::subxt::blocks::StaticExtrinsic for AddL2Consensus { + const PALLET: &'static str = "IsmpSyncCommittee"; + const CALL: &'static str = "add_l2_consensus"; + } + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "See [`Pallet::add_ismp_address`]."] + pub fn add_ismp_address( + &self, + contract_address: ::subxt::utils::H160, + state_machine_id: runtime_types::ismp::consensus::StateMachineId, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "IsmpSyncCommittee", + "add_ismp_address", + types::AddIsmpAddress { contract_address, state_machine_id }, + [ + 120u8, 224u8, 122u8, 215u8, 112u8, 46u8, 132u8, 237u8, 188u8, 109u8, + 145u8, 199u8, 145u8, 230u8, 235u8, 214u8, 224u8, 240u8, 237u8, 136u8, + 158u8, 127u8, 9u8, 225u8, 149u8, 121u8, 54u8, 100u8, 165u8, 226u8, + 251u8, 148u8, + ], + ) } - impl ::subxt::blocks::StaticExtrinsic for RemoveWhitelistAccount { - const PALLET: &'static str = "StateMachineManager"; - const CALL: &'static str = "remove_whitelist_account"; + #[doc = "See [`Pallet::add_l2_consensus`]."] + pub fn add_l2_consensus( + &self, + state_machine_id: runtime_types::ismp::consensus::StateMachineId, + l2_consensus: runtime_types::ismp_sync_committee::types::L2Consensus, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "IsmpSyncCommittee", + "add_l2_consensus", + types::AddL2Consensus { state_machine_id, l2_consensus }, + [ + 96u8, 245u8, 146u8, 201u8, 65u8, 109u8, 54u8, 137u8, 86u8, 55u8, 40u8, + 88u8, 210u8, 123u8, 86u8, 141u8, 98u8, 250u8, 43u8, 129u8, 121u8, 11u8, + 100u8, 255u8, 253u8, 87u8, 105u8, 61u8, 251u8, 178u8, 9u8, 174u8, + ], + ) } + } + } + } + pub mod ismp_demo { + use super::{root_mod, runtime_types}; + #[doc = "Pallet Errors"] + pub type Error = runtime_types::pallet_ismp_demo::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_ismp_demo::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { + use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -10710,12 +10180,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct FreezeStateMachine { - pub state_machine: runtime_types::ismp::consensus::StateMachineId, + pub struct Transfer { + pub params: runtime_types::pallet_ismp_demo::pallet::TransferParams< + ::subxt::utils::AccountId32, + ::core::primitive::u128, + >, } - impl ::subxt::blocks::StaticExtrinsic for FreezeStateMachine { - const PALLET: &'static str = "StateMachineManager"; - const CALL: &'static str = "freeze_state_machine"; + impl ::subxt::blocks::StaticExtrinsic for Transfer { + const PALLET: &'static str = "IsmpDemo"; + const CALL: &'static str = "transfer"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10727,12 +10200,12 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct UnfreezeStateMachine { - pub state_machine: runtime_types::ismp::consensus::StateMachineId, + pub struct GetRequest { + pub params: runtime_types::pallet_ismp_demo::pallet::GetRequest, } - impl ::subxt::blocks::StaticExtrinsic for UnfreezeStateMachine { - const PALLET: &'static str = "StateMachineManager"; - const CALL: &'static str = "unfreeze_state_machine"; + impl ::subxt::blocks::StaticExtrinsic for GetRequest { + const PALLET: &'static str = "IsmpDemo"; + const CALL: &'static str = "get_request"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10744,107 +10217,73 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SetHostMangerAddresses { - pub addresses: ::subxt::utils::KeyedVec< - runtime_types::ismp::host::StateMachine, - ::std::vec::Vec<::core::primitive::u8>, - >, + pub struct DispatchToEvm { + pub params: runtime_types::pallet_ismp_demo::pallet::EvmParams, } - impl ::subxt::blocks::StaticExtrinsic for SetHostMangerAddresses { - const PALLET: &'static str = "StateMachineManager"; - const CALL: &'static str = "set_host_manger_addresses"; + impl ::subxt::blocks::StaticExtrinsic for DispatchToEvm { + const PALLET: &'static str = "IsmpDemo"; + const CALL: &'static str = "dispatch_to_evm"; } } pub struct TransactionApi; impl TransactionApi { - #[doc = "See [`Pallet::add_whitelist_account`]."] - pub fn add_whitelist_account( - &self, - account: ::subxt::utils::AccountId32, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "StateMachineManager", - "add_whitelist_account", - types::AddWhitelistAccount { account }, - [ - 183u8, 95u8, 124u8, 1u8, 148u8, 38u8, 234u8, 101u8, 144u8, 152u8, 71u8, - 10u8, 119u8, 238u8, 2u8, 34u8, 9u8, 199u8, 205u8, 142u8, 106u8, 204u8, - 176u8, 118u8, 49u8, 143u8, 204u8, 3u8, 202u8, 159u8, 214u8, 205u8, - ], - ) - } - #[doc = "See [`Pallet::remove_whitelist_account`]."] - pub fn remove_whitelist_account( - &self, - account: ::subxt::utils::AccountId32, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "StateMachineManager", - "remove_whitelist_account", - types::RemoveWhitelistAccount { account }, - [ - 252u8, 77u8, 238u8, 83u8, 67u8, 234u8, 155u8, 207u8, 109u8, 91u8, 36u8, - 60u8, 203u8, 16u8, 110u8, 152u8, 67u8, 117u8, 110u8, 78u8, 215u8, 50u8, - 163u8, 46u8, 142u8, 40u8, 2u8, 176u8, 128u8, 193u8, 88u8, 218u8, - ], - ) - } - #[doc = "See [`Pallet::freeze_state_machine`]."] - pub fn freeze_state_machine( + #[doc = "See [`Pallet::transfer`]."] + pub fn transfer( &self, - state_machine: runtime_types::ismp::consensus::StateMachineId, - ) -> ::subxt::tx::Payload { + params: runtime_types::pallet_ismp_demo::pallet::TransferParams< + ::subxt::utils::AccountId32, + ::core::primitive::u128, + >, + ) -> ::subxt::tx::Payload { ::subxt::tx::Payload::new_static( - "StateMachineManager", - "freeze_state_machine", - types::FreezeStateMachine { state_machine }, + "IsmpDemo", + "transfer", + types::Transfer { params }, [ - 156u8, 7u8, 233u8, 50u8, 7u8, 167u8, 250u8, 135u8, 236u8, 27u8, 219u8, - 251u8, 167u8, 43u8, 154u8, 99u8, 36u8, 195u8, 136u8, 91u8, 29u8, 210u8, - 99u8, 187u8, 212u8, 242u8, 239u8, 163u8, 20u8, 151u8, 170u8, 100u8, + 218u8, 118u8, 134u8, 170u8, 56u8, 171u8, 160u8, 214u8, 245u8, 140u8, + 250u8, 11u8, 180u8, 224u8, 180u8, 59u8, 221u8, 47u8, 77u8, 145u8, + 131u8, 108u8, 165u8, 247u8, 46u8, 70u8, 206u8, 191u8, 175u8, 31u8, + 167u8, 16u8, ], ) } - #[doc = "See [`Pallet::unfreeze_state_machine`]."] - pub fn unfreeze_state_machine( + #[doc = "See [`Pallet::get_request`]."] + pub fn get_request( &self, - state_machine: runtime_types::ismp::consensus::StateMachineId, - ) -> ::subxt::tx::Payload { + params: runtime_types::pallet_ismp_demo::pallet::GetRequest, + ) -> ::subxt::tx::Payload { ::subxt::tx::Payload::new_static( - "StateMachineManager", - "unfreeze_state_machine", - types::UnfreezeStateMachine { state_machine }, + "IsmpDemo", + "get_request", + types::GetRequest { params }, [ - 163u8, 134u8, 165u8, 94u8, 216u8, 17u8, 104u8, 88u8, 162u8, 213u8, - 233u8, 147u8, 126u8, 70u8, 5u8, 189u8, 94u8, 6u8, 81u8, 96u8, 105u8, - 1u8, 203u8, 132u8, 194u8, 174u8, 121u8, 64u8, 185u8, 236u8, 200u8, - 182u8, + 245u8, 61u8, 107u8, 34u8, 240u8, 238u8, 158u8, 125u8, 148u8, 86u8, + 226u8, 142u8, 95u8, 4u8, 36u8, 84u8, 192u8, 186u8, 198u8, 181u8, 196u8, + 139u8, 185u8, 68u8, 218u8, 144u8, 86u8, 234u8, 206u8, 12u8, 140u8, + 160u8, ], ) } - #[doc = "See [`Pallet::set_host_manger_addresses`]."] - pub fn set_host_manger_addresses( + #[doc = "See [`Pallet::dispatch_to_evm`]."] + pub fn dispatch_to_evm( &self, - addresses: ::subxt::utils::KeyedVec< - runtime_types::ismp::host::StateMachine, - ::std::vec::Vec<::core::primitive::u8>, - >, - ) -> ::subxt::tx::Payload { + params: runtime_types::pallet_ismp_demo::pallet::EvmParams, + ) -> ::subxt::tx::Payload { ::subxt::tx::Payload::new_static( - "StateMachineManager", - "set_host_manger_addresses", - types::SetHostMangerAddresses { addresses }, + "IsmpDemo", + "dispatch_to_evm", + types::DispatchToEvm { params }, [ - 171u8, 208u8, 188u8, 233u8, 194u8, 242u8, 80u8, 93u8, 187u8, 185u8, - 16u8, 1u8, 67u8, 174u8, 20u8, 197u8, 224u8, 114u8, 71u8, 121u8, 3u8, - 3u8, 58u8, 201u8, 30u8, 51u8, 128u8, 232u8, 184u8, 136u8, 120u8, 143u8, + 90u8, 46u8, 209u8, 62u8, 74u8, 11u8, 164u8, 147u8, 77u8, 155u8, 7u8, + 28u8, 219u8, 99u8, 25u8, 55u8, 122u8, 64u8, 32u8, 36u8, 39u8, 0u8, + 10u8, 81u8, 123u8, 12u8, 77u8, 112u8, 235u8, 211u8, 26u8, 253u8, ], ) } } } - #[doc = "The `Event` enum of this pallet"] - pub type Event = runtime_types::state_machine_manager::pallet::Event; + #[doc = "Pallet events"] + pub type Event = runtime_types::pallet_ismp_demo::pallet::Event; pub mod events { use super::runtime_types; #[derive( @@ -10857,13 +10296,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "An account `account` has been whitelisted"] - pub struct AccountWhitelisted { - pub account: ::subxt::utils::AccountId32, + #[doc = "Some balance has been transferred"] + pub struct BalanceTransferred { + pub from: ::subxt::utils::AccountId32, + pub to: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + pub dest_chain: runtime_types::ismp::host::StateMachine, } - impl ::subxt::events::StaticEvent for AccountWhitelisted { - const PALLET: &'static str = "StateMachineManager"; - const EVENT: &'static str = "AccountWhitelisted"; + impl ::subxt::events::StaticEvent for BalanceTransferred { + const PALLET: &'static str = "IsmpDemo"; + const EVENT: &'static str = "BalanceTransferred"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10875,13 +10317,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "An account `account` has been removed from whitelisted accounts"] - pub struct AccountRemovedFromWhitelistedAccount { - pub account: ::subxt::utils::AccountId32, + #[doc = "Some balance has been received"] + pub struct BalanceReceived { + pub from: ::subxt::utils::AccountId32, + pub to: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + pub source_chain: runtime_types::ismp::host::StateMachine, } - impl ::subxt::events::StaticEvent for AccountRemovedFromWhitelistedAccount { - const PALLET: &'static str = "StateMachineManager"; - const EVENT: &'static str = "AccountRemovedFromWhitelistedAccount"; + impl ::subxt::events::StaticEvent for BalanceReceived { + const PALLET: &'static str = "IsmpDemo"; + const EVENT: &'static str = "BalanceReceived"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10893,13 +10338,14 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "`state_machine` is frozen"] - pub struct StateMachineFrozen { - pub state_machine: runtime_types::ismp::consensus::StateMachineId, + #[doc = "Request data receieved"] + pub struct Request { + pub source: runtime_types::ismp::host::StateMachine, + pub data: ::std::string::String, } - impl ::subxt::events::StaticEvent for StateMachineFrozen { - const PALLET: &'static str = "StateMachineManager"; - const EVENT: &'static str = "StateMachineFrozen"; + impl ::subxt::events::StaticEvent for Request { + const PALLET: &'static str = "IsmpDemo"; + const EVENT: &'static str = "Request"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -10911,117 +10357,26 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = " `state_machine` is unfrozen"] - pub struct StateMachineUnFrozen { - pub state_machine: runtime_types::ismp::consensus::StateMachineId, - } - impl ::subxt::events::StaticEvent for StateMachineUnFrozen { - const PALLET: &'static str = "StateMachineManager"; - const EVENT: &'static str = "StateMachineUnFrozen"; - } - } - pub mod storage { - use super::runtime_types; - pub struct StorageApi; - impl StorageApi { - #[doc = " Whitelisted Account allowed for freezing state machine"] - pub fn whitelisted_account( - &self, - _0: impl ::std::borrow::Borrow<::subxt::utils::AccountId32>, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - (), - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "StateMachineManager", - "WhitelistedAccount", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 152u8, 123u8, 9u8, 98u8, 218u8, 159u8, 248u8, 72u8, 20u8, 107u8, 230u8, - 163u8, 214u8, 252u8, 169u8, 15u8, 210u8, 141u8, 173u8, 26u8, 41u8, - 107u8, 123u8, 159u8, 145u8, 233u8, 83u8, 178u8, 28u8, 64u8, 69u8, - 240u8, - ], - ) - } - #[doc = " Whitelisted Account allowed for freezing state machine"] - pub fn whitelisted_account_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - (), - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "StateMachineManager", - "WhitelistedAccount", - Vec::new(), - [ - 152u8, 123u8, 9u8, 98u8, 218u8, 159u8, 248u8, 72u8, 20u8, 107u8, 230u8, - 163u8, 214u8, 252u8, 169u8, 15u8, 210u8, 141u8, 173u8, 26u8, 41u8, - 107u8, 123u8, 159u8, 145u8, 233u8, 83u8, 178u8, 28u8, 64u8, 69u8, - 240u8, - ], - ) - } - #[doc = " Host Manager Address on different chains"] - pub fn host_manager( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::std::vec::Vec<::core::primitive::u8>, - ::subxt::storage::address::Yes, - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "StateMachineManager", - "HostManager", - vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], - [ - 90u8, 254u8, 93u8, 76u8, 209u8, 193u8, 105u8, 170u8, 102u8, 131u8, - 191u8, 234u8, 91u8, 233u8, 10u8, 160u8, 123u8, 2u8, 235u8, 192u8, - 199u8, 224u8, 241u8, 205u8, 87u8, 65u8, 107u8, 173u8, 190u8, 15u8, - 72u8, 69u8, - ], - ) - } - #[doc = " Host Manager Address on different chains"] - pub fn host_manager_root( - &self, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageMapKey, - ::std::vec::Vec<::core::primitive::u8>, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "StateMachineManager", - "HostManager", - Vec::new(), - [ - 90u8, 254u8, 93u8, 76u8, 209u8, 193u8, 105u8, 170u8, 102u8, 131u8, - 191u8, 234u8, 91u8, 233u8, 10u8, 160u8, 123u8, 2u8, 235u8, 192u8, - 199u8, 224u8, 241u8, 205u8, 87u8, 65u8, 107u8, 173u8, 190u8, 15u8, - 72u8, 69u8, - ], - ) - } + #[doc = "Get response recieved"] + pub struct GetResponse( + pub ::std::vec::Vec<::core::option::Option<::std::vec::Vec<::core::primitive::u8>>>, + ); + impl ::subxt::events::StaticEvent for GetResponse { + const PALLET: &'static str = "IsmpDemo"; + const EVENT: &'static str = "GetResponse"; } } } - pub mod runtime_types { - use super::runtime_types; - pub mod bounded_collections { - use super::runtime_types; - pub mod bounded_btree_set { + pub mod relayer { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_ismp_relayer::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_ismp_relayer::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -11033,10 +10388,14 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BoundedBTreeSet<_0>(pub ::std::vec::Vec<_0>); - } - pub mod bounded_vec { - use super::runtime_types; + pub struct AccumulateFees { + pub withdrawal_proof: + runtime_types::pallet_ismp_relayer::withdrawal::WithdrawalProof, + } + impl ::subxt::blocks::StaticExtrinsic for AccumulateFees { + const PALLET: &'static str = "Relayer"; + const CALL: &'static str = "accumulate_fees"; + } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11047,26 +10406,213 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BoundedVec<_0>(pub ::std::vec::Vec<_0>); + pub struct WithdrawFees { + pub withdrawal_data: + runtime_types::pallet_ismp_relayer::withdrawal::WithdrawalInputData, + } + impl ::subxt::blocks::StaticExtrinsic for WithdrawFees { + const PALLET: &'static str = "Relayer"; + const CALL: &'static str = "withdraw_fees"; + } } - pub mod weak_bounded_vec { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct WeakBoundedVec<_0>(pub ::std::vec::Vec<_0>); + pub struct TransactionApi; + impl TransactionApi { + #[doc = "See [`Pallet::accumulate_fees`]."] + pub fn accumulate_fees( + &self, + withdrawal_proof : runtime_types :: pallet_ismp_relayer :: withdrawal :: WithdrawalProof, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Relayer", + "accumulate_fees", + types::AccumulateFees { withdrawal_proof }, + [ + 158u8, 133u8, 3u8, 17u8, 100u8, 167u8, 94u8, 251u8, 15u8, 182u8, 175u8, + 183u8, 7u8, 50u8, 120u8, 82u8, 145u8, 239u8, 121u8, 139u8, 32u8, 132u8, + 44u8, 101u8, 243u8, 9u8, 81u8, 87u8, 66u8, 70u8, 102u8, 142u8, + ], + ) + } + #[doc = "See [`Pallet::withdraw_fees`]."] + pub fn withdraw_fees( + &self, + withdrawal_data : runtime_types :: pallet_ismp_relayer :: withdrawal :: WithdrawalInputData, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Relayer", + "withdraw_fees", + types::WithdrawFees { withdrawal_data }, + [ + 98u8, 131u8, 101u8, 93u8, 164u8, 62u8, 174u8, 104u8, 226u8, 212u8, 7u8, + 109u8, 98u8, 190u8, 52u8, 35u8, 205u8, 187u8, 203u8, 9u8, 88u8, 31u8, + 187u8, 37u8, 194u8, 86u8, 139u8, 226u8, 65u8, 199u8, 235u8, 159u8, + ], + ) + } } } - pub mod cumulus_pallet_parachain_system { + #[doc = "Events emiited by the relayer pallet"] + pub type Event = runtime_types::pallet_ismp_relayer::pallet::Event; + pub mod events { use super::runtime_types; - pub mod pallet { + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "A relayer with the `address` has accumulated some fees on the `state_machine`"] + pub struct AccumulateFees { + pub address: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + pub state_machine: runtime_types::ismp::host::StateMachine, + pub amount: runtime_types::primitive_types::U256, + } + impl ::subxt::events::StaticEvent for AccumulateFees { + const PALLET: &'static str = "Relayer"; + const EVENT: &'static str = "AccumulateFees"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "A relayer with the the `address` has initiated a withdrawal on the `state_machine`"] + pub struct Withdraw { + pub address: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + pub state_machine: runtime_types::ismp::host::StateMachine, + pub amount: runtime_types::primitive_types::U256, + } + impl ::subxt::events::StaticEvent for Withdraw { + const PALLET: &'static str = "Relayer"; + const EVENT: &'static str = "Withdraw"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " double map of address to source chain, which holds the amount of the relayer address"] + pub fn fees( + &self, + _0: impl ::std::borrow::Borrow, + _1: impl ::std::borrow::Borrow<[::core::primitive::u8]>, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::primitive_types::U256, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Relayer", + "Fees", + vec![ + ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), + ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), + ], + [ + 101u8, 173u8, 207u8, 100u8, 23u8, 157u8, 168u8, 60u8, 218u8, 251u8, + 154u8, 121u8, 118u8, 108u8, 126u8, 251u8, 128u8, 77u8, 161u8, 227u8, + 201u8, 112u8, 76u8, 108u8, 14u8, 159u8, 67u8, 54u8, 59u8, 84u8, 47u8, + 9u8, + ], + ) + } + #[doc = " double map of address to source chain, which holds the amount of the relayer address"] + pub fn fees_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::primitive_types::U256, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Relayer", + "Fees", + Vec::new(), + [ + 101u8, 173u8, 207u8, 100u8, 23u8, 157u8, 168u8, 60u8, 218u8, 251u8, + 154u8, 121u8, 118u8, 108u8, 126u8, 251u8, 128u8, 77u8, 161u8, 227u8, + 201u8, 112u8, 76u8, 108u8, 14u8, 159u8, 67u8, 54u8, 59u8, 84u8, 47u8, + 9u8, + ], + ) + } + #[doc = " Latest nonce for each address and the state machine they want to withdraw from"] + pub fn nonce( + &self, + _0: impl ::std::borrow::Borrow<[::core::primitive::u8]>, + _1: impl ::std::borrow::Borrow, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + ::core::primitive::u64, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Relayer", + "Nonce", + vec![ + ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), + ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), + ], + [ + 198u8, 35u8, 9u8, 55u8, 199u8, 245u8, 28u8, 184u8, 253u8, 16u8, 58u8, + 174u8, 28u8, 28u8, 40u8, 185u8, 145u8, 16u8, 58u8, 80u8, 153u8, 151u8, + 83u8, 232u8, 20u8, 219u8, 39u8, 88u8, 28u8, 152u8, 114u8, 204u8, + ], + ) + } + #[doc = " Latest nonce for each address and the state machine they want to withdraw from"] + pub fn nonce_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + ::core::primitive::u64, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Relayer", + "Nonce", + Vec::new(), + [ + 198u8, 35u8, 9u8, 55u8, 199u8, 245u8, 28u8, 184u8, 253u8, 16u8, 58u8, + 174u8, 28u8, 28u8, 40u8, 185u8, 145u8, 16u8, 58u8, 80u8, 153u8, 151u8, + 83u8, 232u8, 20u8, 219u8, 39u8, 88u8, 28u8, 152u8, 114u8, 204u8, + ], + ) + } + } + } + } + pub mod host_executive { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_ismp_host_executive::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_ismp_host_executive::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -11078,46 +10624,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - # [codec (index = 0)] # [doc = "See [`Pallet::set_validation_data`]."] set_validation_data { data : runtime_types :: cumulus_primitives_parachain_inherent :: ParachainInherentData , } , # [codec (index = 1)] # [doc = "See [`Pallet::sudo_send_upward_message`]."] sudo_send_upward_message { message : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , # [codec (index = 2)] # [doc = "See [`Pallet::authorize_upgrade`]."] authorize_upgrade { code_hash : :: subxt :: utils :: H256 , check_version : :: core :: primitive :: bool , } , # [codec (index = 3)] # [doc = "See [`Pallet::enact_authorized_upgrade`]."] enact_authorized_upgrade { code : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Error` enum of this pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Attempt to upgrade validation function while existing upgrade pending."] - OverlappingUpgrades, - #[codec(index = 1)] - #[doc = "Polkadot currently prohibits this parachain from upgrading its validation function."] - ProhibitedByPolkadot, - #[codec(index = 2)] - #[doc = "The supplied validation function has compiled into a blob larger than Polkadot is"] - #[doc = "willing to run."] - TooBig, - #[codec(index = 3)] - #[doc = "The inherent which supplies the validation data did not run this block."] - ValidationDataNotAvailable, - #[codec(index = 4)] - #[doc = "The inherent which supplies the host configuration did not run this block."] - HostConfigurationNotAvailable, - #[codec(index = 5)] - #[doc = "No validation function upgrade is currently scheduled."] - NotScheduled, - #[codec(index = 6)] - #[doc = "No code upgrade has been authorized."] - NothingAuthorized, - #[codec(index = 7)] - #[doc = "The given code upgrade has not been authorized."] - Unauthorized, + pub struct SetHostParams { + pub params: ::subxt::utils::KeyedVec< + runtime_types::ismp::host::StateMachine, + runtime_types::pallet_ismp_host_executive::params::HostParam, + >, + } + impl ::subxt::blocks::StaticExtrinsic for SetHostParams { + const PALLET: &'static str = "HostExecutive"; + const CALL: &'static str = "set_host_params"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11129,34 +10644,115 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - #[codec(index = 0)] - #[doc = "The validation function has been scheduled to apply."] - ValidationFunctionStored, - #[codec(index = 1)] - #[doc = "The validation function was applied as of the contained relay chain block number."] - ValidationFunctionApplied { relay_chain_block_num: ::core::primitive::u32 }, - #[codec(index = 2)] - #[doc = "The relay-chain aborted the upgrade process."] - ValidationFunctionDiscarded, - #[codec(index = 3)] - #[doc = "Some downward messages have been received and will be processed."] - DownwardMessagesReceived { count: ::core::primitive::u32 }, - #[codec(index = 4)] - #[doc = "Downward messages were processed using the given weight."] - DownwardMessagesProcessed { - weight_used: runtime_types::sp_weights::weight_v2::Weight, - dmq_head: ::subxt::utils::H256, - }, - #[codec(index = 5)] - #[doc = "An upward message was sent to the relay chain."] - UpwardMessageSent { - message_hash: ::core::option::Option<[::core::primitive::u8; 32usize]>, - }, + pub struct UpdateHostParams { + pub state_machine: runtime_types::ismp::host::StateMachine, + pub update: runtime_types::pallet_ismp_host_executive::params::HostParamUpdate, + } + impl ::subxt::blocks::StaticExtrinsic for UpdateHostParams { + const PALLET: &'static str = "HostExecutive"; + const CALL: &'static str = "update_host_params"; } } - pub mod relay_state_snapshot { + pub struct TransactionApi; + impl TransactionApi { + #[doc = "See [`Pallet::set_host_params`]."] + pub fn set_host_params( + &self, + params: ::subxt::utils::KeyedVec< + runtime_types::ismp::host::StateMachine, + runtime_types::pallet_ismp_host_executive::params::HostParam, + >, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "HostExecutive", + "set_host_params", + types::SetHostParams { params }, + [ + 135u8, 167u8, 163u8, 92u8, 139u8, 43u8, 43u8, 217u8, 70u8, 49u8, 12u8, + 100u8, 186u8, 110u8, 34u8, 44u8, 7u8, 177u8, 36u8, 22u8, 97u8, 129u8, + 229u8, 4u8, 16u8, 199u8, 162u8, 214u8, 240u8, 62u8, 59u8, 139u8, + ], + ) + } + #[doc = "See [`Pallet::update_host_params`]."] + pub fn update_host_params( + &self, + state_machine: runtime_types::ismp::host::StateMachine, + update: runtime_types::pallet_ismp_host_executive::params::HostParamUpdate, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "HostExecutive", + "update_host_params", + types::UpdateHostParams { state_machine, update }, + [ + 11u8, 217u8, 156u8, 198u8, 0u8, 127u8, 94u8, 70u8, 250u8, 168u8, 60u8, + 148u8, 33u8, 98u8, 85u8, 90u8, 93u8, 66u8, 165u8, 114u8, 179u8, 58u8, + 214u8, 183u8, 208u8, 174u8, 80u8, 229u8, 149u8, 84u8, 59u8, 75u8, + ], + ) + } + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Host Manager Addresses on different chains"] + pub fn host_params( + &self, + _0: impl ::std::borrow::Borrow, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_ismp_host_executive::params::HostParam, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "HostExecutive", + "HostParams", + vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], + [ + 200u8, 68u8, 48u8, 161u8, 211u8, 196u8, 236u8, 187u8, 248u8, 218u8, + 5u8, 57u8, 143u8, 251u8, 193u8, 69u8, 163u8, 149u8, 21u8, 28u8, 120u8, + 156u8, 28u8, 112u8, 162u8, 95u8, 34u8, 0u8, 100u8, 137u8, 152u8, 72u8, + ], + ) + } + #[doc = " Host Manager Addresses on different chains"] + pub fn host_params_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_ismp_host_executive::params::HostParam, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "HostExecutive", + "HostParams", + Vec::new(), + [ + 200u8, 68u8, 48u8, 161u8, 211u8, 196u8, 236u8, 187u8, 248u8, 218u8, + 5u8, 57u8, 143u8, 251u8, 193u8, 69u8, 163u8, 149u8, 21u8, 28u8, 120u8, + 156u8, 28u8, 112u8, 162u8, 95u8, 34u8, 0u8, 100u8, 137u8, 152u8, 72u8, + ], + ) + } + } + } + } + pub mod call_decompressor { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_call_decompressor::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_call_decompressor::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -11168,7 +10764,48 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MessagingStateSnapshot { pub dmq_mqc_head : :: subxt :: utils :: H256 , pub relay_dispatch_queue_remaining_capacity : runtime_types :: cumulus_pallet_parachain_system :: relay_state_snapshot :: RelayDispatchQueueRemainingCapacity , pub ingress_channels : :: std :: vec :: Vec < (runtime_types :: polkadot_parachain_primitives :: primitives :: Id , runtime_types :: polkadot_primitives :: v6 :: AbridgedHrmpChannel ,) > , pub egress_channels : :: std :: vec :: Vec < (runtime_types :: polkadot_parachain_primitives :: primitives :: Id , runtime_types :: polkadot_primitives :: v6 :: AbridgedHrmpChannel ,) > , } + pub struct DecompressCall { + pub compressed: ::std::vec::Vec<::core::primitive::u8>, + pub encoded_call_size: ::core::primitive::u32, + } + impl ::subxt::blocks::StaticExtrinsic for DecompressCall { + const PALLET: &'static str = "CallDecompressor"; + const CALL: &'static str = "decompress_call"; + } + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "See [`Pallet::decompress_call`]."] + pub fn decompress_call( + &self, + compressed: ::std::vec::Vec<::core::primitive::u8>, + encoded_call_size: ::core::primitive::u32, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "CallDecompressor", + "decompress_call", + types::DecompressCall { compressed, encoded_call_size }, + [ + 100u8, 30u8, 167u8, 61u8, 94u8, 92u8, 222u8, 182u8, 88u8, 56u8, 109u8, + 253u8, 127u8, 136u8, 170u8, 157u8, 91u8, 200u8, 60u8, 117u8, 86u8, + 184u8, 215u8, 97u8, 179u8, 67u8, 207u8, 96u8, 168u8, 36u8, 8u8, 238u8, + ], + ) + } + } + } + } + pub mod gateway { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_asset_gateway::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_asset_gateway::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { + use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11179,12 +10816,194 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct RelayDispatchQueueRemainingCapacity { - pub remaining_count: ::core::primitive::u32, - pub remaining_size: ::core::primitive::u32, + pub struct SetParams { + pub update: + runtime_types::pallet_asset_gateway::pallet::TokenGatewayParamsUpdate, + } + impl ::subxt::blocks::StaticExtrinsic for SetParams { + const PALLET: &'static str = "Gateway"; + const CALL: &'static str = "set_params"; } } - pub mod unincluded_segment { + pub struct TransactionApi; + impl TransactionApi { + #[doc = "See [`Pallet::set_params`]."] + pub fn set_params( + &self, + update: runtime_types::pallet_asset_gateway::pallet::TokenGatewayParamsUpdate, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Gateway", + "set_params", + types::SetParams { update }, + [ + 3u8, 67u8, 132u8, 178u8, 5u8, 101u8, 23u8, 26u8, 97u8, 54u8, 202u8, + 236u8, 119u8, 182u8, 34u8, 122u8, 225u8, 174u8, 136u8, 35u8, 154u8, + 148u8, 177u8, 26u8, 17u8, 147u8, 50u8, 130u8, 168u8, 92u8, 175u8, + 218u8, + ], + ) + } + } + } + #[doc = "Events emiited by the relayer pallet"] + pub type Event = runtime_types::pallet_asset_gateway::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An XCM transfer from the relay chain has been transformed into a crosschain message"] + pub struct AssetTeleported { + pub from: ::subxt::utils::AccountId32, + pub to: ::subxt::utils::H160, + pub amount: ::core::primitive::u128, + pub dest: runtime_types::ismp::host::StateMachine, + } + impl ::subxt::events::StaticEvent for AssetTeleported { + const PALLET: &'static str = "Gateway"; + const EVENT: &'static str = "AssetTeleported"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An asset has been received and transferred to the beneficiary's account on the"] + #[doc = "relaychain"] + pub struct AssetReceived { + pub beneficiary: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + pub source: runtime_types::ismp::host::StateMachine, + } + impl ::subxt::events::StaticEvent for AssetReceived { + const PALLET: &'static str = "Gateway"; + const EVENT: &'static str = "AssetReceived"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An asset has been refunded and transferred to the beneficiary's account on the"] + #[doc = "relaychain"] + pub struct AssetRefunded { + pub beneficiary: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + pub source: runtime_types::ismp::host::StateMachine, + } + impl ::subxt::events::StaticEvent for AssetRefunded { + const PALLET: &'static str = "Gateway"; + const EVENT: &'static str = "AssetRefunded"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + pub fn params( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_asset_gateway::pallet::TokenGatewayParams, + ::subxt::storage::address::Yes, + (), + (), + > { + ::subxt::storage::address::Address::new_static( + "Gateway", + "Params", + vec![], + [ + 197u8, 23u8, 230u8, 66u8, 19u8, 114u8, 105u8, 38u8, 135u8, 219u8, + 105u8, 221u8, 62u8, 56u8, 73u8, 45u8, 121u8, 70u8, 224u8, 192u8, 149u8, + 72u8, 135u8, 78u8, 204u8, 45u8, 74u8, 194u8, 111u8, 70u8, 45u8, 180u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " The asset tranfer's pallet id, used for deriving its sovereign account ID."] + #[doc = " All escrowed funds will be custodied by this account"] + pub fn pallet_id( + &self, + ) -> ::subxt::constants::Address + { + ::subxt::constants::Address::new_static( + "Gateway", + "PalletId", + [ + 56u8, 243u8, 53u8, 83u8, 154u8, 179u8, 170u8, 80u8, 133u8, 173u8, 61u8, + 161u8, 47u8, 225u8, 146u8, 21u8, 50u8, 229u8, 248u8, 27u8, 104u8, 58u8, + 129u8, 197u8, 102u8, 160u8, 168u8, 205u8, 154u8, 42u8, 217u8, 53u8, + ], + ) + } + #[doc = " Protocol fees will be custodied by this account"] + pub fn protocol_account( + &self, + ) -> ::subxt::constants::Address + { + ::subxt::constants::Address::new_static( + "Gateway", + "ProtocolAccount", + [ + 56u8, 243u8, 53u8, 83u8, 154u8, 179u8, 170u8, 80u8, 133u8, 173u8, 61u8, + 161u8, 47u8, 225u8, 146u8, 21u8, 50u8, 229u8, 248u8, 27u8, 104u8, 58u8, + 129u8, 197u8, 102u8, 160u8, 168u8, 205u8, 154u8, 42u8, 217u8, 53u8, + ], + ) + } + #[doc = " Pallet parameters"] + pub fn params( + &self, + ) -> ::subxt::constants::Address< + runtime_types::pallet_asset_gateway::pallet::TokenGatewayParams, + > { + ::subxt::constants::Address::new_static( + "Gateway", + "Params", + [ + 88u8, 71u8, 165u8, 114u8, 29u8, 116u8, 227u8, 69u8, 68u8, 214u8, 121u8, + 178u8, 5u8, 206u8, 130u8, 25u8, 196u8, 191u8, 25u8, 146u8, 239u8, 23u8, + 204u8, 237u8, 150u8, 71u8, 35u8, 99u8, 95u8, 227u8, 26u8, 44u8, + ], + ) + } + } + } + } + pub mod assets { + use super::{root_mod, runtime_types}; + #[doc = "The `Error` enum of this pallet."] + pub type Error = runtime_types::pallet_assets::pallet::Error; + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub type Call = runtime_types::pallet_assets::pallet::Call; + pub mod calls { + use super::{root_mod, runtime_types}; + type DispatchError = runtime_types::sp_runtime::DispatchError; + pub mod types { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -11196,7 +11015,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Ancestor < _0 > { pub used_bandwidth : runtime_types :: cumulus_pallet_parachain_system :: unincluded_segment :: UsedBandwidth , pub para_head_hash : :: core :: option :: Option < _0 > , pub consumed_go_ahead_signal : :: core :: option :: Option < runtime_types :: polkadot_primitives :: v6 :: UpgradeGoAhead > , } + pub struct Create { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub min_balance: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for Create { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "create"; + } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11207,9 +11034,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct HrmpChannelUpdate { - pub msg_count: ::core::primitive::u32, - pub total_bytes: ::core::primitive::u32, + pub struct ForceCreate { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub is_sufficient: ::core::primitive::bool, + #[codec(compact)] + pub min_balance: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for ForceCreate { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "force_create"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11221,7 +11055,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SegmentTracker < _0 > { pub used_bandwidth : runtime_types :: cumulus_pallet_parachain_system :: unincluded_segment :: UsedBandwidth , pub hrmp_watermark : :: core :: option :: Option < :: core :: primitive :: u32 > , pub consumed_go_ahead_signal : :: core :: option :: Option < runtime_types :: polkadot_primitives :: v6 :: UpgradeGoAhead > , # [codec (skip)] pub __subxt_unused_type_params : :: core :: marker :: PhantomData < _0 > } + pub struct StartDestroy { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for StartDestroy { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "start_destroy"; + } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11232,13 +11072,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct UsedBandwidth { pub ump_msg_count : :: core :: primitive :: u32 , pub ump_total_bytes : :: core :: primitive :: u32 , pub hrmp_outgoing : :: subxt :: utils :: KeyedVec < runtime_types :: polkadot_parachain_primitives :: primitives :: Id , runtime_types :: cumulus_pallet_parachain_system :: unincluded_segment :: HrmpChannelUpdate > , } - } - } - pub mod cumulus_pallet_xcm { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; + pub struct DestroyAccounts { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for DestroyAccounts { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "destroy_accounts"; + } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11249,30 +11089,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - #[codec(index = 0)] - #[doc = "Downward message is invalid XCM."] - #[doc = "\\[ id \\]"] - InvalidFormat([::core::primitive::u8; 32usize]), - #[codec(index = 1)] - #[doc = "Downward message is unsupported version of XCM."] - #[doc = "\\[ id \\]"] - UnsupportedVersion([::core::primitive::u8; 32usize]), - #[codec(index = 2)] - #[doc = "Downward message executed with the given outcome."] - #[doc = "\\[ id, outcome \\]"] - ExecutedDownward( - [::core::primitive::u8; 32usize], - runtime_types::xcm::v3::traits::Outcome, - ), + pub struct DestroyApprovals { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for DestroyApprovals { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "destroy_approvals"; } - } - } - pub mod cumulus_pallet_xcmp_queue { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11283,23 +11106,12 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 1)] - #[doc = "See [`Pallet::suspend_xcm_execution`]."] - suspend_xcm_execution, - #[codec(index = 2)] - #[doc = "See [`Pallet::resume_xcm_execution`]."] - resume_xcm_execution, - #[codec(index = 3)] - #[doc = "See [`Pallet::update_suspend_threshold`]."] - update_suspend_threshold { new: ::core::primitive::u32 }, - #[codec(index = 4)] - #[doc = "See [`Pallet::update_drop_threshold`]."] - update_drop_threshold { new: ::core::primitive::u32 }, - #[codec(index = 5)] - #[doc = "See [`Pallet::update_resume_threshold`]."] - update_resume_threshold { new: ::core::primitive::u32 }, + pub struct FinishDestroy { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for FinishDestroy { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "finish_destroy"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11311,17 +11123,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Error` enum of this pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Setting the queue config failed since one of its values was invalid."] - BadQueueConfig, - #[codec(index = 1)] - #[doc = "The execution is already suspended."] - AlreadySuspended, - #[codec(index = 2)] - #[doc = "The execution is already resumed."] - AlreadyResumed, + pub struct Mint { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub beneficiary: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for Mint { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "mint"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11333,156 +11143,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - #[codec(index = 0)] - #[doc = "An HRMP message was sent to a sibling parachain."] - XcmpMessageSent { message_hash: [::core::primitive::u8; 32usize] }, + pub struct Burn { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for Burn { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "burn"; } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct OutboundChannelDetails { - pub recipient: runtime_types::polkadot_parachain_primitives::primitives::Id, - pub state: runtime_types::cumulus_pallet_xcmp_queue::OutboundState, - pub signals_exist: ::core::primitive::bool, - pub first_index: ::core::primitive::u16, - pub last_index: ::core::primitive::u16, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum OutboundState { - #[codec(index = 0)] - Ok, - #[codec(index = 1)] - Suspended, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct QueueConfigData { - pub suspend_threshold: ::core::primitive::u32, - pub drop_threshold: ::core::primitive::u32, - pub resume_threshold: ::core::primitive::u32, - } - } - pub mod cumulus_primitives_core { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum AggregateMessageOrigin { - #[codec(index = 0)] - Here, - #[codec(index = 1)] - Parent, - #[codec(index = 2)] - Sibling(runtime_types::polkadot_parachain_primitives::primitives::Id), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CollationInfo { - pub upward_messages: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, - pub horizontal_messages: ::std::vec::Vec< - runtime_types::polkadot_core_primitives::OutboundHrmpMessage< - runtime_types::polkadot_parachain_primitives::primitives::Id, - >, - >, - pub new_validation_code: ::core::option::Option< - runtime_types::polkadot_parachain_primitives::primitives::ValidationCode, - >, - pub processed_downward_messages: ::core::primitive::u32, - pub hrmp_watermark: ::core::primitive::u32, - pub head_data: runtime_types::polkadot_parachain_primitives::primitives::HeadData, - } - } - pub mod cumulus_primitives_parachain_inherent { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MessageQueueChain(pub ::subxt::utils::H256); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ParachainInherentData { - pub validation_data: - runtime_types::polkadot_primitives::v6::PersistedValidationData< - ::subxt::utils::H256, - ::core::primitive::u32, - >, - pub relay_chain_state: runtime_types::sp_trie::storage_proof::StorageProof, - pub downward_messages: ::std::vec::Vec< - runtime_types::polkadot_core_primitives::InboundDownwardMessage< - ::core::primitive::u32, - >, - >, - pub horizontal_messages: ::subxt::utils::KeyedVec< - runtime_types::polkadot_parachain_primitives::primitives::Id, - ::std::vec::Vec< - runtime_types::polkadot_core_primitives::InboundHrmpMessage< - ::core::primitive::u32, - >, - >, - >, - } - } - pub mod frame_support { - use super::runtime_types; - pub mod dispatch { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11493,13 +11163,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum DispatchClass { - #[codec(index = 0)] - Normal, - #[codec(index = 1)] - Operational, - #[codec(index = 2)] - Mandatory, + pub struct Transfer { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for Transfer { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "transfer"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11511,10 +11183,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DispatchInfo { - pub weight: runtime_types::sp_weights::weight_v2::Weight, - pub class: runtime_types::frame_support::dispatch::DispatchClass, - pub pays_fee: runtime_types::frame_support::dispatch::Pays, + pub struct TransferKeepAlive { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for TransferKeepAlive { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "transfer_keep_alive"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11526,11 +11203,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Pays { - #[codec(index = 0)] - Yes, - #[codec(index = 1)] - No, + pub struct ForceTransfer { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub source: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for ForceTransfer { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "force_transfer"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11542,168 +11224,66 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct PerDispatchClass<_0> { - pub normal: _0, - pub operational: _0, - pub mandatory: _0, + pub struct Freeze { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, } - } - pub mod traits { - use super::runtime_types; - pub mod messages { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum ProcessMessageError { - #[codec(index = 0)] - BadFormat, - #[codec(index = 1)] - Corrupt, - #[codec(index = 2)] - Unsupported, - #[codec(index = 3)] - Overweight(runtime_types::sp_weights::weight_v2::Weight), - #[codec(index = 4)] - Yield, - } + impl ::subxt::blocks::StaticExtrinsic for Freeze { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "freeze"; } - pub mod tokens { - use super::runtime_types; - pub mod misc { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum BalanceStatus { - #[codec(index = 0)] - Free, - #[codec(index = 1)] - Reserved, - } - } - } - } - } - pub mod frame_system { - use super::runtime_types; - pub mod extensions { - use super::runtime_types; - pub mod check_genesis { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckGenesis; - } - pub mod check_mortality { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckMortality(pub runtime_types::sp_runtime::generic::era::Era); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Thaw { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, } - pub mod check_non_zero_sender { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckNonZeroSender; + impl ::subxt::blocks::StaticExtrinsic for Thaw { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "thaw"; } - pub mod check_nonce { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckNonce(#[codec(compact)] pub ::core::primitive::u32); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct FreezeAsset { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, } - pub mod check_spec_version { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckSpecVersion; + impl ::subxt::blocks::StaticExtrinsic for FreezeAsset { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "freeze_asset"; } - pub mod check_tx_version { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckTxVersion; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ThawAsset { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, } - pub mod check_weight { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckWeight; + impl ::subxt::blocks::StaticExtrinsic for ThawAsset { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "thaw_asset"; } - } - pub mod limits { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11714,10 +11294,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BlockLength { - pub max: runtime_types::frame_support::dispatch::PerDispatchClass< - ::core::primitive::u32, - >, + pub struct TransferOwnership { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for TransferOwnership { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "transfer_ownership"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11729,12 +11312,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BlockWeights { - pub base_block: runtime_types::sp_weights::weight_v2::Weight, - pub max_block: runtime_types::sp_weights::weight_v2::Weight, - pub per_class: runtime_types::frame_support::dispatch::PerDispatchClass< - runtime_types::frame_system::limits::WeightsPerClass, - >, + pub struct SetTeam { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub issuer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub freezer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for SetTeam { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "set_team"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11746,18 +11332,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct WeightsPerClass { - pub base_extrinsic: runtime_types::sp_weights::weight_v2::Weight, - pub max_extrinsic: - ::core::option::Option, - pub max_total: - ::core::option::Option, - pub reserved: - ::core::option::Option, + pub struct SetMetadata { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub name: ::std::vec::Vec<::core::primitive::u8>, + pub symbol: ::std::vec::Vec<::core::primitive::u8>, + pub decimals: ::core::primitive::u8, + } + impl ::subxt::blocks::StaticExtrinsic for SetMetadata { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "set_metadata"; } - } - pub mod pallet { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -11768,49 +11352,12 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::remark`]."] - remark { remark: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 1)] - #[doc = "See [`Pallet::set_heap_pages`]."] - set_heap_pages { pages: ::core::primitive::u64 }, - #[codec(index = 2)] - #[doc = "See [`Pallet::set_code`]."] - set_code { code: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 3)] - #[doc = "See [`Pallet::set_code_without_checks`]."] - set_code_without_checks { code: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 4)] - #[doc = "See [`Pallet::set_storage`]."] - set_storage { - items: ::std::vec::Vec<( - ::std::vec::Vec<::core::primitive::u8>, - ::std::vec::Vec<::core::primitive::u8>, - )>, - }, - #[codec(index = 5)] - #[doc = "See [`Pallet::kill_storage`]."] - kill_storage { keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>> }, - #[codec(index = 6)] - #[doc = "See [`Pallet::kill_prefix`]."] - kill_prefix { - prefix: ::std::vec::Vec<::core::primitive::u8>, - subkeys: ::core::primitive::u32, - }, - #[codec(index = 7)] - #[doc = "See [`Pallet::remark_with_event`]."] - remark_with_event { remark: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 9)] - #[doc = "See [`Pallet::authorize_upgrade`]."] - authorize_upgrade { code_hash: ::subxt::utils::H256 }, - #[codec(index = 10)] - #[doc = "See [`Pallet::authorize_upgrade_without_checks`]."] - authorize_upgrade_without_checks { code_hash: ::subxt::utils::H256 }, - #[codec(index = 11)] - #[doc = "See [`Pallet::apply_authorized_upgrade`]."] - apply_authorized_upgrade { code: ::std::vec::Vec<::core::primitive::u8> }, + pub struct ClearMetadata { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for ClearMetadata { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "clear_metadata"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11822,36 +11369,16 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Error for the System pallet"] - pub enum Error { - #[codec(index = 0)] - #[doc = "The name of specification does not match between the current runtime"] - #[doc = "and the new runtime."] - InvalidSpecName, - #[codec(index = 1)] - #[doc = "The specification version is not allowed to decrease between the current runtime"] - #[doc = "and the new runtime."] - SpecVersionNeedsToIncrease, - #[codec(index = 2)] - #[doc = "Failed to extract the runtime version from the new runtime."] - #[doc = ""] - #[doc = "Either calling `Core_version` or decoding `RuntimeVersion` failed."] - FailedToExtractRuntimeVersion, - #[codec(index = 3)] - #[doc = "Suicide called when the account has non-default composite data."] - NonDefaultComposite, - #[codec(index = 4)] - #[doc = "There is a non-zero reference count preventing the account from being purged."] - NonZeroRefCount, - #[codec(index = 5)] - #[doc = "The origin filter prevent the call to be dispatched."] - CallFiltered, - #[codec(index = 6)] - #[doc = "No upgrade authorized."] - NothingAuthorized, - #[codec(index = 7)] - #[doc = "The submitted code is not authorized."] - Unauthorized, + pub struct ForceSetMetadata { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub name: ::std::vec::Vec<::core::primitive::u8>, + pub symbol: ::std::vec::Vec<::core::primitive::u8>, + pub decimals: ::core::primitive::u8, + pub is_frozen: ::core::primitive::bool, + } + impl ::subxt::blocks::StaticExtrinsic for ForceSetMetadata { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "force_set_metadata"; } #[derive( :: subxt :: ext :: codec :: Decode, @@ -11863,286 +11390,3396 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Event for the System pallet."] - pub enum Event { - #[codec(index = 0)] - #[doc = "An extrinsic completed successfully."] - ExtrinsicSuccess { - dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + pub struct ForceClearMetadata { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for ForceClearMetadata { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "force_clear_metadata"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ForceAssetStatus { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub issuer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub freezer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub min_balance: ::core::primitive::u128, + pub is_sufficient: ::core::primitive::bool, + pub is_frozen: ::core::primitive::bool, + } + impl ::subxt::blocks::StaticExtrinsic for ForceAssetStatus { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "force_asset_status"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ApproveTransfer { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for ApproveTransfer { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "approve_transfer"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CancelApproval { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for CancelApproval { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "cancel_approval"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ForceCancelApproval { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for ForceCancelApproval { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "force_cancel_approval"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct TransferApproved { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pub destination: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + pub amount: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for TransferApproved { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "transfer_approved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Touch { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::blocks::StaticExtrinsic for Touch { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "touch"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Refund { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub allow_burn: ::core::primitive::bool, + } + impl ::subxt::blocks::StaticExtrinsic for Refund { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "refund"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct SetMinBalance { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub min_balance: ::core::primitive::u128, + } + impl ::subxt::blocks::StaticExtrinsic for SetMinBalance { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "set_min_balance"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct TouchOther { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for TouchOther { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "touch_other"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct RefundOther { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for RefundOther { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "refund_other"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Block { + pub id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + } + impl ::subxt::blocks::StaticExtrinsic for Block { + const PALLET: &'static str = "Assets"; + const CALL: &'static str = "block"; + } + } + pub struct TransactionApi; + impl TransactionApi { + #[doc = "See [`Pallet::create`]."] + pub fn create( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + min_balance: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "create", + types::Create { id, admin, min_balance }, + [ + 164u8, 148u8, 246u8, 221u8, 212u8, 31u8, 7u8, 209u8, 153u8, 128u8, + 170u8, 21u8, 202u8, 246u8, 180u8, 124u8, 187u8, 137u8, 19u8, 29u8, + 199u8, 126u8, 137u8, 153u8, 122u8, 57u8, 70u8, 214u8, 202u8, 152u8, + 11u8, 15u8, + ], + ) + } + #[doc = "See [`Pallet::force_create`]."] + pub fn force_create( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + is_sufficient: ::core::primitive::bool, + min_balance: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "force_create", + types::ForceCreate { id, owner, is_sufficient, min_balance }, + [ + 54u8, 163u8, 60u8, 192u8, 118u8, 181u8, 233u8, 43u8, 82u8, 230u8, 71u8, + 159u8, 232u8, 68u8, 205u8, 18u8, 200u8, 117u8, 220u8, 200u8, 6u8, + 203u8, 239u8, 201u8, 18u8, 106u8, 106u8, 200u8, 94u8, 27u8, 120u8, + 197u8, + ], + ) + } + #[doc = "See [`Pallet::start_destroy`]."] + pub fn start_destroy( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "start_destroy", + types::StartDestroy { id }, + [ + 206u8, 209u8, 96u8, 116u8, 63u8, 254u8, 29u8, 162u8, 35u8, 11u8, 115u8, + 82u8, 144u8, 45u8, 82u8, 5u8, 229u8, 177u8, 145u8, 112u8, 252u8, 118u8, + 142u8, 237u8, 198u8, 6u8, 193u8, 66u8, 95u8, 214u8, 114u8, 206u8, + ], + ) + } + #[doc = "See [`Pallet::destroy_accounts`]."] + pub fn destroy_accounts( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "destroy_accounts", + types::DestroyAccounts { id }, + [ + 252u8, 18u8, 12u8, 126u8, 214u8, 14u8, 28u8, 24u8, 53u8, 233u8, 172u8, + 57u8, 46u8, 204u8, 174u8, 224u8, 42u8, 120u8, 103u8, 236u8, 23u8, + 235u8, 183u8, 135u8, 36u8, 156u8, 167u8, 29u8, 144u8, 69u8, 11u8, + 215u8, + ], + ) + } + #[doc = "See [`Pallet::destroy_approvals`]."] + pub fn destroy_approvals( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "destroy_approvals", + types::DestroyApprovals { id }, + [ + 233u8, 160u8, 197u8, 89u8, 231u8, 234u8, 78u8, 50u8, 7u8, 74u8, 69u8, + 131u8, 146u8, 201u8, 67u8, 252u8, 22u8, 228u8, 93u8, 77u8, 217u8, 92u8, + 119u8, 145u8, 84u8, 194u8, 248u8, 160u8, 25u8, 144u8, 28u8, 98u8, + ], + ) + } + #[doc = "See [`Pallet::finish_destroy`]."] + pub fn finish_destroy( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "finish_destroy", + types::FinishDestroy { id }, + [ + 48u8, 136u8, 163u8, 47u8, 202u8, 253u8, 7u8, 5u8, 38u8, 233u8, 136u8, + 24u8, 125u8, 230u8, 199u8, 1u8, 192u8, 179u8, 2u8, 190u8, 60u8, 118u8, + 97u8, 187u8, 219u8, 16u8, 238u8, 181u8, 62u8, 183u8, 174u8, 79u8, + ], + ) + } + #[doc = "See [`Pallet::mint`]."] + pub fn mint( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + beneficiary: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "mint", + types::Mint { id, beneficiary, amount }, + [ + 215u8, 42u8, 109u8, 162u8, 94u8, 207u8, 140u8, 105u8, 0u8, 82u8, 73u8, + 84u8, 4u8, 136u8, 44u8, 155u8, 30u8, 77u8, 201u8, 110u8, 114u8, 215u8, + 147u8, 133u8, 240u8, 235u8, 81u8, 240u8, 116u8, 52u8, 122u8, 94u8, + ], + ) + } + #[doc = "See [`Pallet::burn`]."] + pub fn burn( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "burn", + types::Burn { id, who, amount }, + [ + 229u8, 211u8, 246u8, 225u8, 53u8, 177u8, 244u8, 107u8, 143u8, 190u8, + 24u8, 229u8, 181u8, 198u8, 48u8, 96u8, 203u8, 171u8, 178u8, 186u8, + 169u8, 7u8, 251u8, 146u8, 139u8, 95u8, 178u8, 67u8, 192u8, 136u8, + 151u8, 224u8, + ], + ) + } + #[doc = "See [`Pallet::transfer`]."] + pub fn transfer( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "transfer", + types::Transfer { id, target, amount }, + [ + 217u8, 93u8, 1u8, 20u8, 190u8, 12u8, 153u8, 43u8, 159u8, 95u8, 41u8, + 135u8, 5u8, 191u8, 157u8, 187u8, 173u8, 32u8, 44u8, 123u8, 55u8, 88u8, + 8u8, 184u8, 160u8, 208u8, 96u8, 164u8, 34u8, 29u8, 208u8, 150u8, + ], + ) + } + #[doc = "See [`Pallet::transfer_keep_alive`]."] + pub fn transfer_keep_alive( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "transfer_keep_alive", + types::TransferKeepAlive { id, target, amount }, + [ + 30u8, 113u8, 41u8, 253u8, 39u8, 184u8, 86u8, 201u8, 65u8, 222u8, 162u8, + 24u8, 73u8, 129u8, 242u8, 40u8, 41u8, 169u8, 241u8, 137u8, 13u8, 174u8, + 175u8, 15u8, 85u8, 172u8, 156u8, 32u8, 111u8, 106u8, 33u8, 5u8, + ], + ) + } + #[doc = "See [`Pallet::force_transfer`]."] + pub fn force_transfer( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + source: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "force_transfer", + types::ForceTransfer { id, source, dest, amount }, + [ + 22u8, 160u8, 197u8, 220u8, 138u8, 148u8, 247u8, 50u8, 2u8, 236u8, + 189u8, 176u8, 227u8, 62u8, 69u8, 113u8, 34u8, 190u8, 91u8, 211u8, + 120u8, 100u8, 86u8, 81u8, 108u8, 174u8, 131u8, 93u8, 70u8, 21u8, 8u8, + 73u8, + ], + ) + } + #[doc = "See [`Pallet::freeze`]."] + pub fn freeze( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "freeze", + types::Freeze { id, who }, + [ + 95u8, 31u8, 200u8, 187u8, 138u8, 164u8, 10u8, 55u8, 143u8, 190u8, + 248u8, 147u8, 67u8, 99u8, 4u8, 213u8, 248u8, 150u8, 97u8, 42u8, 154u8, + 106u8, 1u8, 194u8, 229u8, 214u8, 119u8, 101u8, 50u8, 135u8, 184u8, + 125u8, + ], + ) + } + #[doc = "See [`Pallet::thaw`]."] + pub fn thaw( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "thaw", + types::Thaw { id, who }, + [ + 45u8, 219u8, 36u8, 117u8, 64u8, 89u8, 113u8, 159u8, 228u8, 3u8, 250u8, + 210u8, 40u8, 144u8, 11u8, 155u8, 11u8, 181u8, 113u8, 91u8, 130u8, + 230u8, 62u8, 190u8, 180u8, 191u8, 218u8, 171u8, 137u8, 76u8, 109u8, + 249u8, + ], + ) + } + #[doc = "See [`Pallet::freeze_asset`]."] + pub fn freeze_asset( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "freeze_asset", + types::FreezeAsset { id }, + [ + 146u8, 248u8, 184u8, 9u8, 247u8, 29u8, 250u8, 16u8, 160u8, 55u8, 152u8, + 6u8, 177u8, 75u8, 89u8, 55u8, 234u8, 247u8, 32u8, 153u8, 187u8, 27u8, + 205u8, 166u8, 233u8, 64u8, 212u8, 187u8, 172u8, 250u8, 191u8, 51u8, + ], + ) + } + #[doc = "See [`Pallet::thaw_asset`]."] + pub fn thaw_asset( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "thaw_asset", + types::ThawAsset { id }, + [ + 71u8, 107u8, 116u8, 11u8, 163u8, 95u8, 70u8, 244u8, 160u8, 92u8, 48u8, + 39u8, 43u8, 15u8, 93u8, 31u8, 83u8, 106u8, 248u8, 135u8, 219u8, 159u8, + 231u8, 94u8, 247u8, 107u8, 184u8, 195u8, 124u8, 238u8, 152u8, 4u8, + ], + ) + } + #[doc = "See [`Pallet::transfer_ownership`]."] + pub fn transfer_ownership( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "transfer_ownership", + types::TransferOwnership { id, owner }, + [ + 100u8, 47u8, 5u8, 118u8, 162u8, 68u8, 248u8, 108u8, 160u8, 27u8, 158u8, + 135u8, 233u8, 56u8, 69u8, 215u8, 121u8, 112u8, 167u8, 109u8, 234u8, + 230u8, 14u8, 161u8, 72u8, 5u8, 181u8, 187u8, 156u8, 41u8, 206u8, 214u8, + ], + ) + } + #[doc = "See [`Pallet::set_team`]."] + pub fn set_team( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + issuer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + freezer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "set_team", + types::SetTeam { id, issuer, admin, freezer }, + [ + 87u8, 196u8, 115u8, 44u8, 208u8, 80u8, 46u8, 221u8, 184u8, 190u8, + 194u8, 191u8, 181u8, 243u8, 68u8, 250u8, 122u8, 192u8, 69u8, 23u8, + 70u8, 7u8, 48u8, 137u8, 29u8, 57u8, 201u8, 252u8, 112u8, 210u8, 212u8, + 165u8, + ], + ) + } + #[doc = "See [`Pallet::set_metadata`]."] + pub fn set_metadata( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + name: ::std::vec::Vec<::core::primitive::u8>, + symbol: ::std::vec::Vec<::core::primitive::u8>, + decimals: ::core::primitive::u8, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "set_metadata", + types::SetMetadata { id, name, symbol, decimals }, + [ + 211u8, 156u8, 93u8, 165u8, 146u8, 65u8, 178u8, 206u8, 137u8, 139u8, + 247u8, 172u8, 160u8, 158u8, 58u8, 66u8, 9u8, 187u8, 190u8, 57u8, 244u8, + 39u8, 223u8, 203u8, 4u8, 15u8, 203u8, 40u8, 73u8, 183u8, 32u8, 2u8, + ], + ) + } + #[doc = "See [`Pallet::clear_metadata`]."] + pub fn clear_metadata( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "clear_metadata", + types::ClearMetadata { id }, + [ + 216u8, 174u8, 37u8, 121u8, 74u8, 223u8, 116u8, 152u8, 59u8, 143u8, + 173u8, 129u8, 84u8, 46u8, 106u8, 172u8, 242u8, 181u8, 144u8, 198u8, + 184u8, 251u8, 75u8, 139u8, 242u8, 169u8, 52u8, 67u8, 239u8, 131u8, + 214u8, 6u8, + ], + ) + } + #[doc = "See [`Pallet::force_set_metadata`]."] + pub fn force_set_metadata( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + name: ::std::vec::Vec<::core::primitive::u8>, + symbol: ::std::vec::Vec<::core::primitive::u8>, + decimals: ::core::primitive::u8, + is_frozen: ::core::primitive::bool, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "force_set_metadata", + types::ForceSetMetadata { id, name, symbol, decimals, is_frozen }, + [ + 82u8, 65u8, 114u8, 208u8, 93u8, 64u8, 7u8, 33u8, 104u8, 221u8, 70u8, + 90u8, 83u8, 53u8, 40u8, 242u8, 208u8, 186u8, 169u8, 49u8, 233u8, 27u8, + 65u8, 194u8, 27u8, 13u8, 157u8, 211u8, 69u8, 167u8, 167u8, 45u8, + ], + ) + } + #[doc = "See [`Pallet::force_clear_metadata`]."] + pub fn force_clear_metadata( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "force_clear_metadata", + types::ForceClearMetadata { id }, + [ + 202u8, 54u8, 234u8, 190u8, 164u8, 128u8, 229u8, 135u8, 206u8, 150u8, + 64u8, 187u8, 37u8, 198u8, 244u8, 203u8, 25u8, 208u8, 95u8, 216u8, 67u8, + 64u8, 7u8, 96u8, 231u8, 9u8, 10u8, 202u8, 110u8, 173u8, 30u8, 194u8, + ], + ) + } + #[doc = "See [`Pallet::force_asset_status`]."] + pub fn force_asset_status( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + issuer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + freezer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + min_balance: ::core::primitive::u128, + is_sufficient: ::core::primitive::bool, + is_frozen: ::core::primitive::bool, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "force_asset_status", + types::ForceAssetStatus { + id, + owner, + issuer, + admin, + freezer, + min_balance, + is_sufficient, + is_frozen, + }, + [ + 117u8, 86u8, 248u8, 120u8, 210u8, 204u8, 127u8, 187u8, 136u8, 144u8, + 138u8, 177u8, 43u8, 195u8, 185u8, 46u8, 85u8, 116u8, 37u8, 59u8, 131u8, + 244u8, 174u8, 15u8, 56u8, 145u8, 223u8, 123u8, 36u8, 161u8, 242u8, + 42u8, + ], + ) + } + #[doc = "See [`Pallet::approve_transfer`]."] + pub fn approve_transfer( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "approve_transfer", + types::ApproveTransfer { id, delegate, amount }, + [ + 71u8, 8u8, 186u8, 118u8, 182u8, 19u8, 140u8, 190u8, 28u8, 8u8, 239u8, + 105u8, 181u8, 241u8, 86u8, 177u8, 39u8, 26u8, 65u8, 90u8, 13u8, 81u8, + 220u8, 44u8, 247u8, 179u8, 141u8, 136u8, 204u8, 160u8, 5u8, 209u8, + ], + ) + } + #[doc = "See [`Pallet::cancel_approval`]."] + pub fn cancel_approval( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "cancel_approval", + types::CancelApproval { id, delegate }, + [ + 153u8, 114u8, 130u8, 154u8, 51u8, 255u8, 27u8, 91u8, 36u8, 23u8, 128u8, + 22u8, 58u8, 8u8, 188u8, 60u8, 171u8, 131u8, 99u8, 35u8, 155u8, 238u8, + 52u8, 231u8, 192u8, 131u8, 17u8, 97u8, 227u8, 16u8, 254u8, 249u8, + ], + ) + } + #[doc = "See [`Pallet::force_cancel_approval`]."] + pub fn force_cancel_approval( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "force_cancel_approval", + types::ForceCancelApproval { id, owner, delegate }, + [ + 47u8, 204u8, 7u8, 144u8, 234u8, 135u8, 62u8, 47u8, 162u8, 8u8, 35u8, + 43u8, 238u8, 242u8, 181u8, 112u8, 229u8, 243u8, 44u8, 126u8, 69u8, + 53u8, 238u8, 234u8, 215u8, 81u8, 117u8, 235u8, 136u8, 179u8, 194u8, + 137u8, + ], + ) + } + #[doc = "See [`Pallet::transfer_approved`]."] + pub fn transfer_approved( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + destination: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "transfer_approved", + types::TransferApproved { id, owner, destination, amount }, + [ + 54u8, 164u8, 26u8, 42u8, 226u8, 154u8, 102u8, 156u8, 216u8, 24u8, 11u8, + 34u8, 93u8, 126u8, 58u8, 139u8, 194u8, 43u8, 208u8, 203u8, 166u8, + 177u8, 99u8, 86u8, 111u8, 58u8, 200u8, 105u8, 49u8, 41u8, 143u8, 121u8, + ], + ) + } + #[doc = "See [`Pallet::touch`]."] + pub fn touch( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "touch", + types::Touch { id }, + [ + 42u8, 151u8, 196u8, 52u8, 233u8, 90u8, 70u8, 15u8, 191u8, 203u8, 173u8, + 225u8, 251u8, 200u8, 209u8, 187u8, 180u8, 238u8, 73u8, 136u8, 232u8, + 89u8, 32u8, 121u8, 192u8, 115u8, 248u8, 240u8, 44u8, 24u8, 61u8, 15u8, + ], + ) + } + #[doc = "See [`Pallet::refund`]."] + pub fn refund( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + allow_burn: ::core::primitive::bool, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "refund", + types::Refund { id, allow_burn }, + [ + 146u8, 138u8, 19u8, 215u8, 33u8, 157u8, 99u8, 109u8, 30u8, 206u8, + 140u8, 34u8, 232u8, 222u8, 40u8, 202u8, 225u8, 145u8, 52u8, 78u8, 85u8, + 82u8, 227u8, 170u8, 186u8, 211u8, 50u8, 178u8, 153u8, 220u8, 18u8, + 92u8, + ], + ) + } + #[doc = "See [`Pallet::set_min_balance`]."] + pub fn set_min_balance( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + min_balance: ::core::primitive::u128, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "set_min_balance", + types::SetMinBalance { id, min_balance }, + [ + 84u8, 1u8, 220u8, 65u8, 248u8, 40u8, 231u8, 57u8, 81u8, 181u8, 184u8, + 100u8, 107u8, 150u8, 231u8, 252u8, 108u8, 66u8, 214u8, 213u8, 75u8, + 102u8, 48u8, 76u8, 93u8, 127u8, 210u8, 111u8, 93u8, 219u8, 252u8, + 173u8, + ], + ) + } + #[doc = "See [`Pallet::touch_other`]."] + pub fn touch_other( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "touch_other", + types::TouchOther { id, who }, + [ + 137u8, 73u8, 220u8, 107u8, 20u8, 207u8, 2u8, 189u8, 79u8, 114u8, 37u8, + 126u8, 147u8, 195u8, 169u8, 193u8, 21u8, 78u8, 209u8, 73u8, 121u8, + 43u8, 102u8, 196u8, 231u8, 98u8, 128u8, 188u8, 194u8, 104u8, 20u8, + 175u8, + ], + ) + } + #[doc = "See [`Pallet::refund_other`]."] + pub fn refund_other( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "refund_other", + types::RefundOther { id, who }, + [ + 41u8, 235u8, 20u8, 27u8, 26u8, 242u8, 236u8, 245u8, 125u8, 98u8, 2u8, + 162u8, 20u8, 86u8, 74u8, 25u8, 138u8, 209u8, 205u8, 54u8, 145u8, 48u8, + 152u8, 96u8, 154u8, 108u8, 5u8, 51u8, 113u8, 188u8, 166u8, 51u8, + ], + ) + } + #[doc = "See [`Pallet::block`]."] + pub fn block( + &self, + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + ) -> ::subxt::tx::Payload { + ::subxt::tx::Payload::new_static( + "Assets", + "block", + types::Block { id, who }, + [ + 66u8, 192u8, 226u8, 215u8, 140u8, 35u8, 214u8, 45u8, 86u8, 247u8, 43u8, + 247u8, 99u8, 154u8, 17u8, 224u8, 124u8, 75u8, 69u8, 15u8, 137u8, 85u8, + 196u8, 8u8, 116u8, 226u8, 203u8, 25u8, 125u8, 251u8, 16u8, 79u8, + ], + ) + } + } + } + #[doc = "The `Event` enum of this pallet"] + pub type Event = runtime_types::pallet_assets::pallet::Event; + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some asset class was created."] + pub struct Created { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub creator: ::subxt::utils::AccountId32, + pub owner: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for Created { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Created"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some assets were issued."] + pub struct Issued { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Issued { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Issued"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some assets were transferred."] + pub struct Transferred { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub from: ::subxt::utils::AccountId32, + pub to: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Transferred { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Transferred"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some assets were destroyed."] + pub struct Burned { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::AccountId32, + pub balance: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for Burned { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Burned"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The management team changed."] + pub struct TeamChanged { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub issuer: ::subxt::utils::AccountId32, + pub admin: ::subxt::utils::AccountId32, + pub freezer: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for TeamChanged { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "TeamChanged"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The owner changed."] + pub struct OwnerChanged { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for OwnerChanged { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "OwnerChanged"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some account `who` was frozen."] + pub struct Frozen { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for Frozen { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Frozen"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some account `who` was thawed."] + pub struct Thawed { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for Thawed { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Thawed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some asset `asset_id` was frozen."] + pub struct AssetFrozen { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::events::StaticEvent for AssetFrozen { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "AssetFrozen"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some asset `asset_id` was thawed."] + pub struct AssetThawed { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::events::StaticEvent for AssetThawed { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "AssetThawed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Accounts were destroyed for given asset."] + pub struct AccountsDestroyed { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub accounts_destroyed: ::core::primitive::u32, + pub accounts_remaining: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for AccountsDestroyed { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "AccountsDestroyed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Approvals were destroyed for given asset."] + pub struct ApprovalsDestroyed { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub approvals_destroyed: ::core::primitive::u32, + pub approvals_remaining: ::core::primitive::u32, + } + impl ::subxt::events::StaticEvent for ApprovalsDestroyed { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "ApprovalsDestroyed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An asset class is in the process of being destroyed."] + pub struct DestructionStarted { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::events::StaticEvent for DestructionStarted { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "DestructionStarted"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An asset class was destroyed."] + pub struct Destroyed { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::events::StaticEvent for Destroyed { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Destroyed"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some asset class was force-created."] + pub struct ForceCreated { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for ForceCreated { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "ForceCreated"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "New metadata has been set for an asset."] + pub struct MetadataSet { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub name: ::std::vec::Vec<::core::primitive::u8>, + pub symbol: ::std::vec::Vec<::core::primitive::u8>, + pub decimals: ::core::primitive::u8, + pub is_frozen: ::core::primitive::bool, + } + impl ::subxt::events::StaticEvent for MetadataSet { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "MetadataSet"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Metadata has been cleared for an asset."] + pub struct MetadataCleared { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::events::StaticEvent for MetadataCleared { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "MetadataCleared"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "(Additional) funds have been approved for transfer to a destination account."] + pub struct ApprovedTransfer { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub source: ::subxt::utils::AccountId32, + pub delegate: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for ApprovedTransfer { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "ApprovedTransfer"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An approval for account `delegate` was cancelled by `owner`."] + pub struct ApprovalCancelled { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::AccountId32, + pub delegate: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for ApprovalCancelled { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "ApprovalCancelled"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An `amount` was transferred in its entirety from `owner` to `destination` by"] + #[doc = "the approved `delegate`."] + pub struct TransferredApproved { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub owner: ::subxt::utils::AccountId32, + pub delegate: ::subxt::utils::AccountId32, + pub destination: ::subxt::utils::AccountId32, + pub amount: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for TransferredApproved { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "TransferredApproved"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "An asset has had its attributes changed by the `Force` origin."] + pub struct AssetStatusChanged { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + } + impl ::subxt::events::StaticEvent for AssetStatusChanged { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "AssetStatusChanged"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The min_balance of an asset has been updated by the asset owner."] + pub struct AssetMinBalanceChanged { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub new_min_balance: ::core::primitive::u128, + } + impl ::subxt::events::StaticEvent for AssetMinBalanceChanged { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "AssetMinBalanceChanged"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some account `who` was created with a deposit from `depositor`."] + pub struct Touched { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::AccountId32, + pub depositor: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for Touched { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Touched"; + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Some account `who` was blocked."] + pub struct Blocked { + pub asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + pub who: ::subxt::utils::AccountId32, + } + impl ::subxt::events::StaticEvent for Blocked { + const PALLET: &'static str = "Assets"; + const EVENT: &'static str = "Blocked"; + } + } + pub mod storage { + use super::runtime_types; + pub struct StorageApi; + impl StorageApi { + #[doc = " Details of an asset."] + pub fn asset( + &self, + _0: impl ::std::borrow::Borrow< + runtime_types::staging_xcm::v3::multilocation::MultiLocation, + >, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::AssetDetails< + ::core::primitive::u128, + ::subxt::utils::AccountId32, + ::core::primitive::u128, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Asset", + vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], + [ + 112u8, 239u8, 115u8, 203u8, 164u8, 251u8, 180u8, 224u8, 110u8, 236u8, + 14u8, 48u8, 236u8, 62u8, 237u8, 92u8, 48u8, 28u8, 183u8, 214u8, 89u8, + 246u8, 62u8, 78u8, 135u8, 217u8, 84u8, 211u8, 52u8, 198u8, 55u8, 142u8, + ], + ) + } + #[doc = " Details of an asset."] + pub fn asset_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::AssetDetails< + ::core::primitive::u128, + ::subxt::utils::AccountId32, + ::core::primitive::u128, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Asset", + Vec::new(), + [ + 112u8, 239u8, 115u8, 203u8, 164u8, 251u8, 180u8, 224u8, 110u8, 236u8, + 14u8, 48u8, 236u8, 62u8, 237u8, 92u8, 48u8, 28u8, 183u8, 214u8, 89u8, + 246u8, 62u8, 78u8, 135u8, 217u8, 84u8, 211u8, 52u8, 198u8, 55u8, 142u8, + ], + ) + } + #[doc = " The holdings of a specific account for a specific asset."] + pub fn account( + &self, + _0: impl ::std::borrow::Borrow< + runtime_types::staging_xcm::v3::multilocation::MultiLocation, + >, + _1: impl ::std::borrow::Borrow<::subxt::utils::AccountId32>, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::AssetAccount< + ::core::primitive::u128, + ::core::primitive::u128, + (), + ::subxt::utils::AccountId32, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Account", + vec![ + ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), + ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), + ], + [ + 33u8, 209u8, 210u8, 175u8, 24u8, 163u8, 246u8, 28u8, 57u8, 151u8, 19u8, + 173u8, 106u8, 155u8, 141u8, 240u8, 102u8, 208u8, 72u8, 61u8, 29u8, + 203u8, 218u8, 191u8, 72u8, 204u8, 35u8, 129u8, 3u8, 190u8, 20u8, 164u8, + ], + ) + } + #[doc = " The holdings of a specific account for a specific asset."] + pub fn account_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::AssetAccount< + ::core::primitive::u128, + ::core::primitive::u128, + (), + ::subxt::utils::AccountId32, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Account", + Vec::new(), + [ + 33u8, 209u8, 210u8, 175u8, 24u8, 163u8, 246u8, 28u8, 57u8, 151u8, 19u8, + 173u8, 106u8, 155u8, 141u8, 240u8, 102u8, 208u8, 72u8, 61u8, 29u8, + 203u8, 218u8, 191u8, 72u8, 204u8, 35u8, 129u8, 3u8, 190u8, 20u8, 164u8, + ], + ) + } + #[doc = " Approved balance transfers. First balance is the amount approved for transfer. Second"] + #[doc = " is the amount of `T::Currency` reserved for storing this."] + #[doc = " First key is the asset ID, second key is the owner and third key is the delegate."] + pub fn approvals( + &self, + _0: impl ::std::borrow::Borrow< + runtime_types::staging_xcm::v3::multilocation::MultiLocation, + >, + _1: impl ::std::borrow::Borrow<::subxt::utils::AccountId32>, + _2: impl ::std::borrow::Borrow<::subxt::utils::AccountId32>, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::Approval< + ::core::primitive::u128, + ::core::primitive::u128, + >, + ::subxt::storage::address::Yes, + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Approvals", + vec![ + ::subxt::storage::address::make_static_storage_map_key(_0.borrow()), + ::subxt::storage::address::make_static_storage_map_key(_1.borrow()), + ::subxt::storage::address::make_static_storage_map_key(_2.borrow()), + ], + [ + 142u8, 228u8, 80u8, 196u8, 155u8, 70u8, 48u8, 80u8, 182u8, 157u8, + 124u8, 50u8, 25u8, 204u8, 78u8, 90u8, 198u8, 59u8, 26u8, 78u8, 113u8, + 142u8, 110u8, 25u8, 133u8, 92u8, 8u8, 200u8, 234u8, 221u8, 223u8, + 188u8, + ], + ) + } + #[doc = " Approved balance transfers. First balance is the amount approved for transfer. Second"] + #[doc = " is the amount of `T::Currency` reserved for storing this."] + #[doc = " First key is the asset ID, second key is the owner and third key is the delegate."] + pub fn approvals_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::Approval< + ::core::primitive::u128, + ::core::primitive::u128, + >, + (), + (), + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Approvals", + Vec::new(), + [ + 142u8, 228u8, 80u8, 196u8, 155u8, 70u8, 48u8, 80u8, 182u8, 157u8, + 124u8, 50u8, 25u8, 204u8, 78u8, 90u8, 198u8, 59u8, 26u8, 78u8, 113u8, + 142u8, 110u8, 25u8, 133u8, 92u8, 8u8, 200u8, 234u8, 221u8, 223u8, + 188u8, + ], + ) + } + #[doc = " Metadata of an asset."] + pub fn metadata( + &self, + _0: impl ::std::borrow::Borrow< + runtime_types::staging_xcm::v3::multilocation::MultiLocation, + >, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::AssetMetadata< + ::core::primitive::u128, + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Metadata", + vec![::subxt::storage::address::make_static_storage_map_key(_0.borrow())], + [ + 134u8, 126u8, 216u8, 12u8, 39u8, 11u8, 197u8, 142u8, 106u8, 159u8, + 30u8, 25u8, 200u8, 100u8, 95u8, 81u8, 13u8, 139u8, 2u8, 50u8, 91u8, + 249u8, 166u8, 96u8, 198u8, 104u8, 102u8, 155u8, 113u8, 7u8, 112u8, + 116u8, + ], + ) + } + #[doc = " Metadata of an asset."] + pub fn metadata_root( + &self, + ) -> ::subxt::storage::address::Address< + ::subxt::storage::address::StaticStorageMapKey, + runtime_types::pallet_assets::types::AssetMetadata< + ::core::primitive::u128, + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + (), + ::subxt::storage::address::Yes, + ::subxt::storage::address::Yes, + > { + ::subxt::storage::address::Address::new_static( + "Assets", + "Metadata", + Vec::new(), + [ + 134u8, 126u8, 216u8, 12u8, 39u8, 11u8, 197u8, 142u8, 106u8, 159u8, + 30u8, 25u8, 200u8, 100u8, 95u8, 81u8, 13u8, 139u8, 2u8, 50u8, 91u8, + 249u8, 166u8, 96u8, 198u8, 104u8, 102u8, 155u8, 113u8, 7u8, 112u8, + 116u8, + ], + ) + } + } + } + pub mod constants { + use super::runtime_types; + pub struct ConstantsApi; + impl ConstantsApi { + #[doc = " Max number of items to destroy per `destroy_accounts` and `destroy_approvals` call."] + #[doc = ""] + #[doc = " Must be configured to result in a weight that makes each call fit in a block."] + pub fn remove_items_limit( + &self, + ) -> ::subxt::constants::Address<::core::primitive::u32> { + ::subxt::constants::Address::new_static( + "Assets", + "RemoveItemsLimit", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + #[doc = " The basic amount of funds that must be reserved for an asset."] + pub fn asset_deposit( + &self, + ) -> ::subxt::constants::Address<::core::primitive::u128> { + ::subxt::constants::Address::new_static( + "Assets", + "AssetDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The amount of funds that must be reserved for a non-provider asset account to be"] + #[doc = " maintained."] + pub fn asset_account_deposit( + &self, + ) -> ::subxt::constants::Address<::core::primitive::u128> { + ::subxt::constants::Address::new_static( + "Assets", + "AssetAccountDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The basic amount of funds that must be reserved when adding metadata to your asset."] + pub fn metadata_deposit_base( + &self, + ) -> ::subxt::constants::Address<::core::primitive::u128> { + ::subxt::constants::Address::new_static( + "Assets", + "MetadataDepositBase", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The additional funds that must be reserved for the number of bytes you store in your"] + #[doc = " metadata."] + pub fn metadata_deposit_per_byte( + &self, + ) -> ::subxt::constants::Address<::core::primitive::u128> { + ::subxt::constants::Address::new_static( + "Assets", + "MetadataDepositPerByte", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The amount of funds that must be reserved when creating a new approval."] + pub fn approval_deposit( + &self, + ) -> ::subxt::constants::Address<::core::primitive::u128> { + ::subxt::constants::Address::new_static( + "Assets", + "ApprovalDeposit", + [ + 84u8, 157u8, 140u8, 4u8, 93u8, 57u8, 29u8, 133u8, 105u8, 200u8, 214u8, + 27u8, 144u8, 208u8, 218u8, 160u8, 130u8, 109u8, 101u8, 54u8, 210u8, + 136u8, 71u8, 63u8, 49u8, 237u8, 234u8, 15u8, 178u8, 98u8, 148u8, 156u8, + ], + ) + } + #[doc = " The maximum length of a name or symbol stored on-chain."] + pub fn string_limit(&self) -> ::subxt::constants::Address<::core::primitive::u32> { + ::subxt::constants::Address::new_static( + "Assets", + "StringLimit", + [ + 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, + 125u8, 151u8, 53u8, 76u8, 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, + 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, 203u8, 100u8, 41u8, + 145u8, + ], + ) + } + } + } + } + pub mod runtime_types { + use super::runtime_types; + pub mod bounded_collections { + use super::runtime_types; + pub mod bounded_btree_set { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct BoundedBTreeSet<_0>(pub ::std::vec::Vec<_0>); + } + pub mod bounded_vec { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct BoundedVec<_0>(pub ::std::vec::Vec<_0>); + } + pub mod weak_bounded_vec { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct WeakBoundedVec<_0>(pub ::std::vec::Vec<_0>); + } + } + pub mod cumulus_pallet_parachain_system { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + # [codec (index = 0)] # [doc = "See [`Pallet::set_validation_data`]."] set_validation_data { data : runtime_types :: cumulus_primitives_parachain_inherent :: ParachainInherentData , } , # [codec (index = 1)] # [doc = "See [`Pallet::sudo_send_upward_message`]."] sudo_send_upward_message { message : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , # [codec (index = 2)] # [doc = "See [`Pallet::authorize_upgrade`]."] authorize_upgrade { code_hash : :: subxt :: utils :: H256 , check_version : :: core :: primitive :: bool , } , # [codec (index = 3)] # [doc = "See [`Pallet::enact_authorized_upgrade`]."] enact_authorized_upgrade { code : :: std :: vec :: Vec < :: core :: primitive :: u8 > , } , } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Attempt to upgrade validation function while existing upgrade pending."] + OverlappingUpgrades, + #[codec(index = 1)] + #[doc = "Polkadot currently prohibits this parachain from upgrading its validation function."] + ProhibitedByPolkadot, + #[codec(index = 2)] + #[doc = "The supplied validation function has compiled into a blob larger than Polkadot is"] + #[doc = "willing to run."] + TooBig, + #[codec(index = 3)] + #[doc = "The inherent which supplies the validation data did not run this block."] + ValidationDataNotAvailable, + #[codec(index = 4)] + #[doc = "The inherent which supplies the host configuration did not run this block."] + HostConfigurationNotAvailable, + #[codec(index = 5)] + #[doc = "No validation function upgrade is currently scheduled."] + NotScheduled, + #[codec(index = 6)] + #[doc = "No code upgrade has been authorized."] + NothingAuthorized, + #[codec(index = 7)] + #[doc = "The given code upgrade has not been authorized."] + Unauthorized, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "The validation function has been scheduled to apply."] + ValidationFunctionStored, + #[codec(index = 1)] + #[doc = "The validation function was applied as of the contained relay chain block number."] + ValidationFunctionApplied { relay_chain_block_num: ::core::primitive::u32 }, + #[codec(index = 2)] + #[doc = "The relay-chain aborted the upgrade process."] + ValidationFunctionDiscarded, + #[codec(index = 3)] + #[doc = "Some downward messages have been received and will be processed."] + DownwardMessagesReceived { count: ::core::primitive::u32 }, + #[codec(index = 4)] + #[doc = "Downward messages were processed using the given weight."] + DownwardMessagesProcessed { + weight_used: runtime_types::sp_weights::weight_v2::Weight, + dmq_head: ::subxt::utils::H256, + }, + #[codec(index = 5)] + #[doc = "An upward message was sent to the relay chain."] + UpwardMessageSent { + message_hash: ::core::option::Option<[::core::primitive::u8; 32usize]>, + }, + } + } + pub mod relay_state_snapshot { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct MessagingStateSnapshot { pub dmq_mqc_head : :: subxt :: utils :: H256 , pub relay_dispatch_queue_remaining_capacity : runtime_types :: cumulus_pallet_parachain_system :: relay_state_snapshot :: RelayDispatchQueueRemainingCapacity , pub ingress_channels : :: std :: vec :: Vec < (runtime_types :: polkadot_parachain_primitives :: primitives :: Id , runtime_types :: polkadot_primitives :: v6 :: AbridgedHrmpChannel ,) > , pub egress_channels : :: std :: vec :: Vec < (runtime_types :: polkadot_parachain_primitives :: primitives :: Id , runtime_types :: polkadot_primitives :: v6 :: AbridgedHrmpChannel ,) > , } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct RelayDispatchQueueRemainingCapacity { + pub remaining_count: ::core::primitive::u32, + pub remaining_size: ::core::primitive::u32, + } + } + pub mod unincluded_segment { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Ancestor < _0 > { pub used_bandwidth : runtime_types :: cumulus_pallet_parachain_system :: unincluded_segment :: UsedBandwidth , pub para_head_hash : :: core :: option :: Option < _0 > , pub consumed_go_ahead_signal : :: core :: option :: Option < runtime_types :: polkadot_primitives :: v6 :: UpgradeGoAhead > , } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct HrmpChannelUpdate { + pub msg_count: ::core::primitive::u32, + pub total_bytes: ::core::primitive::u32, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct SegmentTracker < _0 > { pub used_bandwidth : runtime_types :: cumulus_pallet_parachain_system :: unincluded_segment :: UsedBandwidth , pub hrmp_watermark : :: core :: option :: Option < :: core :: primitive :: u32 > , pub consumed_go_ahead_signal : :: core :: option :: Option < runtime_types :: polkadot_primitives :: v6 :: UpgradeGoAhead > , # [codec (skip)] pub __subxt_unused_type_params : :: core :: marker :: PhantomData < _0 > } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct UsedBandwidth { pub ump_msg_count : :: core :: primitive :: u32 , pub ump_total_bytes : :: core :: primitive :: u32 , pub hrmp_outgoing : :: subxt :: utils :: KeyedVec < runtime_types :: polkadot_parachain_primitives :: primitives :: Id , runtime_types :: cumulus_pallet_parachain_system :: unincluded_segment :: HrmpChannelUpdate > , } + } + } + pub mod cumulus_pallet_xcm { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "Downward message is invalid XCM."] + #[doc = "\\[ id \\]"] + InvalidFormat([::core::primitive::u8; 32usize]), + #[codec(index = 1)] + #[doc = "Downward message is unsupported version of XCM."] + #[doc = "\\[ id \\]"] + UnsupportedVersion([::core::primitive::u8; 32usize]), + #[codec(index = 2)] + #[doc = "Downward message executed with the given outcome."] + #[doc = "\\[ id, outcome \\]"] + ExecutedDownward( + [::core::primitive::u8; 32usize], + runtime_types::xcm::v3::traits::Outcome, + ), + } + } + } + pub mod cumulus_pallet_xcmp_queue { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 1)] + #[doc = "See [`Pallet::suspend_xcm_execution`]."] + suspend_xcm_execution, + #[codec(index = 2)] + #[doc = "See [`Pallet::resume_xcm_execution`]."] + resume_xcm_execution, + #[codec(index = 3)] + #[doc = "See [`Pallet::update_suspend_threshold`]."] + update_suspend_threshold { new: ::core::primitive::u32 }, + #[codec(index = 4)] + #[doc = "See [`Pallet::update_drop_threshold`]."] + update_drop_threshold { new: ::core::primitive::u32 }, + #[codec(index = 5)] + #[doc = "See [`Pallet::update_resume_threshold`]."] + update_resume_threshold { new: ::core::primitive::u32 }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Setting the queue config failed since one of its values was invalid."] + BadQueueConfig, + #[codec(index = 1)] + #[doc = "The execution is already suspended."] + AlreadySuspended, + #[codec(index = 2)] + #[doc = "The execution is already resumed."] + AlreadyResumed, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "An HRMP message was sent to a sibling parachain."] + XcmpMessageSent { message_hash: [::core::primitive::u8; 32usize] }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct OutboundChannelDetails { + pub recipient: runtime_types::polkadot_parachain_primitives::primitives::Id, + pub state: runtime_types::cumulus_pallet_xcmp_queue::OutboundState, + pub signals_exist: ::core::primitive::bool, + pub first_index: ::core::primitive::u16, + pub last_index: ::core::primitive::u16, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum OutboundState { + #[codec(index = 0)] + Ok, + #[codec(index = 1)] + Suspended, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct QueueConfigData { + pub suspend_threshold: ::core::primitive::u32, + pub drop_threshold: ::core::primitive::u32, + pub resume_threshold: ::core::primitive::u32, + } + } + pub mod cumulus_primitives_core { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum AggregateMessageOrigin { + #[codec(index = 0)] + Here, + #[codec(index = 1)] + Parent, + #[codec(index = 2)] + Sibling(runtime_types::polkadot_parachain_primitives::primitives::Id), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CollationInfo { + pub upward_messages: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, + pub horizontal_messages: ::std::vec::Vec< + runtime_types::polkadot_core_primitives::OutboundHrmpMessage< + runtime_types::polkadot_parachain_primitives::primitives::Id, + >, + >, + pub new_validation_code: ::core::option::Option< + runtime_types::polkadot_parachain_primitives::primitives::ValidationCode, + >, + pub processed_downward_messages: ::core::primitive::u32, + pub hrmp_watermark: ::core::primitive::u32, + pub head_data: runtime_types::polkadot_parachain_primitives::primitives::HeadData, + } + } + pub mod cumulus_primitives_parachain_inherent { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct MessageQueueChain(pub ::subxt::utils::H256); + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ParachainInherentData { + pub validation_data: + runtime_types::polkadot_primitives::v6::PersistedValidationData< + ::subxt::utils::H256, + ::core::primitive::u32, + >, + pub relay_chain_state: runtime_types::sp_trie::storage_proof::StorageProof, + pub downward_messages: ::std::vec::Vec< + runtime_types::polkadot_core_primitives::InboundDownwardMessage< + ::core::primitive::u32, + >, + >, + pub horizontal_messages: ::subxt::utils::KeyedVec< + runtime_types::polkadot_parachain_primitives::primitives::Id, + ::std::vec::Vec< + runtime_types::polkadot_core_primitives::InboundHrmpMessage< + ::core::primitive::u32, + >, + >, + >, + } + } + pub mod frame_support { + use super::runtime_types; + pub mod dispatch { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum DispatchClass { + #[codec(index = 0)] + Normal, + #[codec(index = 1)] + Operational, + #[codec(index = 2)] + Mandatory, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct DispatchInfo { + pub weight: runtime_types::sp_weights::weight_v2::Weight, + pub class: runtime_types::frame_support::dispatch::DispatchClass, + pub pays_fee: runtime_types::frame_support::dispatch::Pays, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Pays { + #[codec(index = 0)] + Yes, + #[codec(index = 1)] + No, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct PerDispatchClass<_0> { + pub normal: _0, + pub operational: _0, + pub mandatory: _0, + } + } + pub mod traits { + use super::runtime_types; + pub mod messages { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum ProcessMessageError { + #[codec(index = 0)] + BadFormat, + #[codec(index = 1)] + Corrupt, + #[codec(index = 2)] + Unsupported, + #[codec(index = 3)] + Overweight(runtime_types::sp_weights::weight_v2::Weight), + #[codec(index = 4)] + Yield, + } + } + pub mod tokens { + use super::runtime_types; + pub mod misc { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum BalanceStatus { + #[codec(index = 0)] + Free, + #[codec(index = 1)] + Reserved, + } + } + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct PalletId(pub [::core::primitive::u8; 8usize]); + } + pub mod frame_system { + use super::runtime_types; + pub mod extensions { + use super::runtime_types; + pub mod check_genesis { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckGenesis; + } + pub mod check_mortality { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckMortality(pub runtime_types::sp_runtime::generic::era::Era); + } + pub mod check_non_zero_sender { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckNonZeroSender; + } + pub mod check_nonce { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckNonce(#[codec(compact)] pub ::core::primitive::u32); + } + pub mod check_spec_version { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckSpecVersion; + } + pub mod check_tx_version { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckTxVersion; + } + pub mod check_weight { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CheckWeight; + } + } + pub mod limits { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct BlockLength { + pub max: runtime_types::frame_support::dispatch::PerDispatchClass< + ::core::primitive::u32, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct BlockWeights { + pub base_block: runtime_types::sp_weights::weight_v2::Weight, + pub max_block: runtime_types::sp_weights::weight_v2::Weight, + pub per_class: runtime_types::frame_support::dispatch::PerDispatchClass< + runtime_types::frame_system::limits::WeightsPerClass, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct WeightsPerClass { + pub base_extrinsic: runtime_types::sp_weights::weight_v2::Weight, + pub max_extrinsic: + ::core::option::Option, + pub max_total: + ::core::option::Option, + pub reserved: + ::core::option::Option, + } + } + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + #[doc = "See [`Pallet::remark`]."] + remark { remark: ::std::vec::Vec<::core::primitive::u8> }, + #[codec(index = 1)] + #[doc = "See [`Pallet::set_heap_pages`]."] + set_heap_pages { pages: ::core::primitive::u64 }, + #[codec(index = 2)] + #[doc = "See [`Pallet::set_code`]."] + set_code { code: ::std::vec::Vec<::core::primitive::u8> }, + #[codec(index = 3)] + #[doc = "See [`Pallet::set_code_without_checks`]."] + set_code_without_checks { code: ::std::vec::Vec<::core::primitive::u8> }, + #[codec(index = 4)] + #[doc = "See [`Pallet::set_storage`]."] + set_storage { + items: ::std::vec::Vec<( + ::std::vec::Vec<::core::primitive::u8>, + ::std::vec::Vec<::core::primitive::u8>, + )>, + }, + #[codec(index = 5)] + #[doc = "See [`Pallet::kill_storage`]."] + kill_storage { keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>> }, + #[codec(index = 6)] + #[doc = "See [`Pallet::kill_prefix`]."] + kill_prefix { + prefix: ::std::vec::Vec<::core::primitive::u8>, + subkeys: ::core::primitive::u32, + }, + #[codec(index = 7)] + #[doc = "See [`Pallet::remark_with_event`]."] + remark_with_event { remark: ::std::vec::Vec<::core::primitive::u8> }, + #[codec(index = 9)] + #[doc = "See [`Pallet::authorize_upgrade`]."] + authorize_upgrade { code_hash: ::subxt::utils::H256 }, + #[codec(index = 10)] + #[doc = "See [`Pallet::authorize_upgrade_without_checks`]."] + authorize_upgrade_without_checks { code_hash: ::subxt::utils::H256 }, + #[codec(index = 11)] + #[doc = "See [`Pallet::apply_authorized_upgrade`]."] + apply_authorized_upgrade { code: ::std::vec::Vec<::core::primitive::u8> }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Error for the System pallet"] + pub enum Error { + #[codec(index = 0)] + #[doc = "The name of specification does not match between the current runtime"] + #[doc = "and the new runtime."] + InvalidSpecName, + #[codec(index = 1)] + #[doc = "The specification version is not allowed to decrease between the current runtime"] + #[doc = "and the new runtime."] + SpecVersionNeedsToIncrease, + #[codec(index = 2)] + #[doc = "Failed to extract the runtime version from the new runtime."] + #[doc = ""] + #[doc = "Either calling `Core_version` or decoding `RuntimeVersion` failed."] + FailedToExtractRuntimeVersion, + #[codec(index = 3)] + #[doc = "Suicide called when the account has non-default composite data."] + NonDefaultComposite, + #[codec(index = 4)] + #[doc = "There is a non-zero reference count preventing the account from being purged."] + NonZeroRefCount, + #[codec(index = 5)] + #[doc = "The origin filter prevent the call to be dispatched."] + CallFiltered, + #[codec(index = 6)] + #[doc = "No upgrade authorized."] + NothingAuthorized, + #[codec(index = 7)] + #[doc = "The submitted code is not authorized."] + Unauthorized, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Event for the System pallet."] + pub enum Event { + #[codec(index = 0)] + #[doc = "An extrinsic completed successfully."] + ExtrinsicSuccess { + dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + }, + #[codec(index = 1)] + #[doc = "An extrinsic failed."] + ExtrinsicFailed { + dispatch_error: runtime_types::sp_runtime::DispatchError, + dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, + }, + #[codec(index = 2)] + #[doc = "`:code` was updated."] + CodeUpdated, + #[codec(index = 3)] + #[doc = "A new account was created."] + NewAccount { account: ::subxt::utils::AccountId32 }, + #[codec(index = 4)] + #[doc = "An account was reaped."] + KilledAccount { account: ::subxt::utils::AccountId32 }, + #[codec(index = 5)] + #[doc = "On on-chain remark happened."] + Remarked { sender: ::subxt::utils::AccountId32, hash: ::subxt::utils::H256 }, + #[codec(index = 6)] + #[doc = "An upgrade was authorized."] + UpgradeAuthorized { + code_hash: ::subxt::utils::H256, + check_version: ::core::primitive::bool, + }, + } + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct AccountInfo<_0, _1> { + pub nonce: _0, + pub consumers: ::core::primitive::u32, + pub providers: ::core::primitive::u32, + pub sufficients: ::core::primitive::u32, + pub data: _1, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CodeUpgradeAuthorization { + pub code_hash: ::subxt::utils::H256, + pub check_version: ::core::primitive::bool, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct EventRecord<_0, _1> { + pub phase: runtime_types::frame_system::Phase, + pub event: _0, + pub topics: ::std::vec::Vec<_1>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct LastRuntimeUpgradeInfo { + #[codec(compact)] + pub spec_version: ::core::primitive::u32, + pub spec_name: ::std::string::String, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Phase { + #[codec(index = 0)] + ApplyExtrinsic(::core::primitive::u32), + #[codec(index = 1)] + Finalization, + #[codec(index = 2)] + Initialization, + } + } + pub mod gargantua_runtime { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Runtime; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum RuntimeCall { + #[codec(index = 0)] + System(runtime_types::frame_system::pallet::Call), + #[codec(index = 1)] + Timestamp(runtime_types::pallet_timestamp::pallet::Call), + #[codec(index = 2)] + ParachainSystem(runtime_types::cumulus_pallet_parachain_system::pallet::Call), + #[codec(index = 3)] + ParachainInfo(runtime_types::staging_parachain_info::pallet::Call), + #[codec(index = 10)] + Balances(runtime_types::pallet_balances::pallet::Call), + #[codec(index = 21)] + CollatorSelection(runtime_types::pallet_collator_selection::pallet::Call), + #[codec(index = 22)] + Session(runtime_types::pallet_session::pallet::Call), + #[codec(index = 25)] + Sudo(runtime_types::pallet_sudo::pallet::Call), + #[codec(index = 30)] + XcmpQueue(runtime_types::cumulus_pallet_xcmp_queue::pallet::Call), + #[codec(index = 31)] + PolkadotXcm(runtime_types::pallet_xcm::pallet::Call), + #[codec(index = 41)] + Ismp(runtime_types::pallet_ismp::pallet::Call), + #[codec(index = 42)] + MessageQueue(runtime_types::pallet_message_queue::pallet::Call), + #[codec(index = 51)] + IsmpSyncCommittee(runtime_types::ismp_sync_committee::pallet::pallet::Call), + #[codec(index = 52)] + IsmpDemo(runtime_types::pallet_ismp_demo::pallet::Call), + #[codec(index = 53)] + Relayer(runtime_types::pallet_ismp_relayer::pallet::Call), + #[codec(index = 55)] + HostExecutive(runtime_types::pallet_ismp_host_executive::pallet::Call), + #[codec(index = 56)] + CallDecompressor(runtime_types::pallet_call_decompressor::pallet::Call), + #[codec(index = 57)] + Gateway(runtime_types::pallet_asset_gateway::pallet::Call), + #[codec(index = 58)] + Assets(runtime_types::pallet_assets::pallet::Call), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum RuntimeError { + #[codec(index = 0)] + System(runtime_types::frame_system::pallet::Error), + #[codec(index = 2)] + ParachainSystem(runtime_types::cumulus_pallet_parachain_system::pallet::Error), + #[codec(index = 10)] + Balances(runtime_types::pallet_balances::pallet::Error), + #[codec(index = 21)] + CollatorSelection(runtime_types::pallet_collator_selection::pallet::Error), + #[codec(index = 22)] + Session(runtime_types::pallet_session::pallet::Error), + #[codec(index = 25)] + Sudo(runtime_types::pallet_sudo::pallet::Error), + #[codec(index = 30)] + XcmpQueue(runtime_types::cumulus_pallet_xcmp_queue::pallet::Error), + #[codec(index = 31)] + PolkadotXcm(runtime_types::pallet_xcm::pallet::Error), + #[codec(index = 41)] + Ismp(runtime_types::pallet_ismp::pallet::Error), + #[codec(index = 42)] + MessageQueue(runtime_types::pallet_message_queue::pallet::Error), + #[codec(index = 51)] + IsmpSyncCommittee(runtime_types::ismp_sync_committee::pallet::pallet::Error), + #[codec(index = 52)] + IsmpDemo(runtime_types::pallet_ismp_demo::pallet::Error), + #[codec(index = 53)] + Relayer(runtime_types::pallet_ismp_relayer::pallet::Error), + #[codec(index = 55)] + HostExecutive(runtime_types::pallet_ismp_host_executive::pallet::Error), + #[codec(index = 56)] + CallDecompressor(runtime_types::pallet_call_decompressor::pallet::Error), + #[codec(index = 57)] + Gateway(runtime_types::pallet_asset_gateway::pallet::Error), + #[codec(index = 58)] + Assets(runtime_types::pallet_assets::pallet::Error), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum RuntimeEvent { + #[codec(index = 0)] + System(runtime_types::frame_system::pallet::Event), + #[codec(index = 2)] + ParachainSystem(runtime_types::cumulus_pallet_parachain_system::pallet::Event), + #[codec(index = 10)] + Balances(runtime_types::pallet_balances::pallet::Event), + #[codec(index = 11)] + TransactionPayment(runtime_types::pallet_transaction_payment::pallet::Event), + #[codec(index = 21)] + CollatorSelection(runtime_types::pallet_collator_selection::pallet::Event), + #[codec(index = 22)] + Session(runtime_types::pallet_session::pallet::Event), + #[codec(index = 25)] + Sudo(runtime_types::pallet_sudo::pallet::Event), + #[codec(index = 30)] + XcmpQueue(runtime_types::cumulus_pallet_xcmp_queue::pallet::Event), + #[codec(index = 31)] + PolkadotXcm(runtime_types::pallet_xcm::pallet::Event), + #[codec(index = 32)] + CumulusXcm(runtime_types::cumulus_pallet_xcm::pallet::Event), + #[codec(index = 41)] + Ismp(runtime_types::pallet_ismp::pallet::Event), + #[codec(index = 42)] + MessageQueue(runtime_types::pallet_message_queue::pallet::Event), + #[codec(index = 52)] + IsmpDemo(runtime_types::pallet_ismp_demo::pallet::Event), + #[codec(index = 53)] + Relayer(runtime_types::pallet_ismp_relayer::pallet::Event), + #[codec(index = 57)] + Gateway(runtime_types::pallet_asset_gateway::pallet::Event), + #[codec(index = 58)] + Assets(runtime_types::pallet_assets::pallet::Event), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum RuntimeHoldReason {} + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct SessionKeys { + pub aura: runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, + } + } + pub mod ismp { + use super::runtime_types; + pub mod consensus { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct StateCommitment { + pub timestamp: ::core::primitive::u64, + pub overlay_root: ::core::option::Option<::subxt::utils::H256>, + pub state_root: ::subxt::utils::H256, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct StateMachineHeight { + pub id: runtime_types::ismp::consensus::StateMachineId, + pub height: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct StateMachineId { + pub state_id: runtime_types::ismp::host::StateMachine, + pub consensus_state_id: [::core::primitive::u8; 4usize], + } + } + pub mod events { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Meta { + pub source: runtime_types::ismp::host::StateMachine, + pub dest: runtime_types::ismp::host::StateMachine, + pub nonce: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct RequestResponseHandled { + pub commitment: ::subxt::utils::H256, + pub relayer: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct TimeoutHandled { + pub commitment: ::subxt::utils::H256, + } + } + pub mod host { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Ethereum { + #[codec(index = 0)] + ExecutionLayer, + #[codec(index = 1)] + Optimism, + #[codec(index = 2)] + Arbitrum, + #[codec(index = 3)] + Base, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum StateMachine { + #[codec(index = 0)] + Ethereum(runtime_types::ismp::host::Ethereum), + #[codec(index = 1)] + Polkadot(::core::primitive::u32), + #[codec(index = 2)] + Kusama(::core::primitive::u32), + #[codec(index = 3)] + Grandpa([::core::primitive::u8; 4usize]), + #[codec(index = 4)] + Beefy([::core::primitive::u8; 4usize]), + #[codec(index = 5)] + Polygon, + #[codec(index = 6)] + Bsc, + } + } + pub mod messaging { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ConsensusMessage { + pub consensus_proof: ::std::vec::Vec<::core::primitive::u8>, + pub consensus_state_id: [::core::primitive::u8; 4usize], + pub signer: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CreateConsensusState { + pub consensus_state: ::std::vec::Vec<::core::primitive::u8>, + pub consensus_client_id: [::core::primitive::u8; 4usize], + pub consensus_state_id: [::core::primitive::u8; 4usize], + pub unbonding_period: ::core::primitive::u64, + pub challenge_period: ::core::primitive::u64, + pub state_machine_commitments: ::std::vec::Vec<( + runtime_types::ismp::consensus::StateMachineId, + runtime_types::ismp::messaging::StateCommitmentHeight, + )>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct FraudProofMessage { + pub proof_1: ::std::vec::Vec<::core::primitive::u8>, + pub proof_2: ::std::vec::Vec<::core::primitive::u8>, + pub consensus_state_id: [::core::primitive::u8; 4usize], + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Message { + #[codec(index = 0)] + Consensus(runtime_types::ismp::messaging::ConsensusMessage), + #[codec(index = 1)] + FraudProof(runtime_types::ismp::messaging::FraudProofMessage), + #[codec(index = 2)] + Request(runtime_types::ismp::messaging::RequestMessage), + #[codec(index = 3)] + Response(runtime_types::ismp::messaging::ResponseMessage), + #[codec(index = 4)] + Timeout(runtime_types::ismp::messaging::TimeoutMessage), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Proof { + pub height: runtime_types::ismp::consensus::StateMachineHeight, + pub proof: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct RequestMessage { + pub requests: ::std::vec::Vec, + pub proof: runtime_types::ismp::messaging::Proof, + pub signer: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct ResponseMessage { + pub datagram: runtime_types::ismp::router::RequestResponse, + pub proof: runtime_types::ismp::messaging::Proof, + pub signer: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct StateCommitmentHeight { + pub commitment: runtime_types::ismp::consensus::StateCommitment, + pub height: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum TimeoutMessage { + #[codec(index = 0)] + Post { + requests: ::std::vec::Vec, + timeout_proof: runtime_types::ismp::messaging::Proof, + }, + #[codec(index = 1)] + PostResponse { + responses: ::std::vec::Vec, + timeout_proof: runtime_types::ismp::messaging::Proof, }, + #[codec(index = 2)] + Get { requests: ::std::vec::Vec }, + } + } + pub mod router { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Get { + pub source: runtime_types::ismp::host::StateMachine, + pub dest: runtime_types::ismp::host::StateMachine, + pub nonce: ::core::primitive::u64, + pub from: ::std::vec::Vec<::core::primitive::u8>, + pub keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, + pub height: ::core::primitive::u64, + pub timeout_timestamp: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct GetResponse { + pub get: runtime_types::ismp::router::Get, + pub values: ::subxt::utils::KeyedVec< + ::std::vec::Vec<::core::primitive::u8>, + ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>, + >, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Post { + pub source: runtime_types::ismp::host::StateMachine, + pub dest: runtime_types::ismp::host::StateMachine, + pub nonce: ::core::primitive::u64, + pub from: ::std::vec::Vec<::core::primitive::u8>, + pub to: ::std::vec::Vec<::core::primitive::u8>, + pub timeout_timestamp: ::core::primitive::u64, + pub data: ::std::vec::Vec<::core::primitive::u8>, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct PostResponse { + pub post: runtime_types::ismp::router::Post, + pub response: ::std::vec::Vec<::core::primitive::u8>, + pub timeout_timestamp: ::core::primitive::u64, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Request { + #[codec(index = 0)] + Post(runtime_types::ismp::router::Post), + #[codec(index = 1)] + Get(runtime_types::ismp::router::Get), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum RequestResponse { + #[codec(index = 0)] + Request(::std::vec::Vec), + #[codec(index = 1)] + Response(::std::vec::Vec), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Response { + #[codec(index = 0)] + Post(runtime_types::ismp::router::PostResponse), + #[codec(index = 1)] + Get(runtime_types::ismp::router::GetResponse), + } + } + } + pub mod ismp_sync_committee { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + #[doc = "See [`Pallet::add_ismp_address`]."] + add_ismp_address { + contract_address: ::subxt::utils::H160, + state_machine_id: runtime_types::ismp::consensus::StateMachineId, + }, + #[codec(index = 1)] + #[doc = "See [`Pallet::add_l2_consensus`]."] + add_l2_consensus { + state_machine_id: runtime_types::ismp::consensus::StateMachineId, + l2_consensus: runtime_types::ismp_sync_committee::types::L2Consensus, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Contract Address Already Exists"] + ContractAddressAlreadyExists, + #[codec(index = 1)] + #[doc = "Error fetching consensus state"] + ErrorFetchingConsensusState, + #[codec(index = 2)] + #[doc = "Error decoding consensus state"] + ErrorDecodingConsensusState, + #[codec(index = 3)] + #[doc = "Error storing consensus state"] + ErrorStoringConsensusState, + } + } + } + pub mod types { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum L2Consensus { + #[codec(index = 0)] + ArbitrumOrbit(::subxt::utils::H160), #[codec(index = 1)] - #[doc = "An extrinsic failed."] - ExtrinsicFailed { - dispatch_error: runtime_types::sp_runtime::DispatchError, - dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, - }, + OpL2Oracle(::subxt::utils::H160), #[codec(index = 2)] - #[doc = "`:code` was updated."] - CodeUpdated, - #[codec(index = 3)] - #[doc = "A new account was created."] - NewAccount { account: ::subxt::utils::AccountId32 }, - #[codec(index = 4)] - #[doc = "An account was reaped."] - KilledAccount { account: ::subxt::utils::AccountId32 }, - #[codec(index = 5)] - #[doc = "On on-chain remark happened."] - Remarked { sender: ::subxt::utils::AccountId32, hash: ::subxt::utils::H256 }, - #[codec(index = 6)] - #[doc = "An upgrade was authorized."] - UpgradeAuthorized { - code_hash: ::subxt::utils::H256, - check_version: ::core::primitive::bool, - }, + OpFaultProofs(::subxt::utils::H160), } } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AccountInfo<_0, _1> { - pub nonce: _0, - pub consumers: ::core::primitive::u32, - pub providers: ::core::primitive::u32, - pub sufficients: ::core::primitive::u32, - pub data: _1, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CodeUpgradeAuthorization { - pub code_hash: ::subxt::utils::H256, - pub check_version: ::core::primitive::bool, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EventRecord<_0, _1> { - pub phase: runtime_types::frame_system::Phase, - pub event: _0, - pub topics: ::std::vec::Vec<_1>, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct LastRuntimeUpgradeInfo { - #[codec(compact)] - pub spec_version: ::core::primitive::u32, - pub spec_name: ::std::string::String, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Phase { - #[codec(index = 0)] - ApplyExtrinsic(::core::primitive::u32), - #[codec(index = 1)] - Finalization, - #[codec(index = 2)] - Initialization, - } } - pub mod gargantua_runtime { + pub mod pallet_asset_gateway { use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Runtime; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeCall { - #[codec(index = 0)] - System(runtime_types::frame_system::pallet::Call), - #[codec(index = 1)] - Timestamp(runtime_types::pallet_timestamp::pallet::Call), - #[codec(index = 2)] - ParachainSystem(runtime_types::cumulus_pallet_parachain_system::pallet::Call), - #[codec(index = 3)] - ParachainInfo(runtime_types::staging_parachain_info::pallet::Call), - #[codec(index = 10)] - Balances(runtime_types::pallet_balances::pallet::Call), - #[codec(index = 21)] - CollatorSelection(runtime_types::pallet_collator_selection::pallet::Call), - #[codec(index = 22)] - Session(runtime_types::pallet_session::pallet::Call), - #[codec(index = 25)] - Sudo(runtime_types::pallet_sudo::pallet::Call), - #[codec(index = 30)] - XcmpQueue(runtime_types::cumulus_pallet_xcmp_queue::pallet::Call), - #[codec(index = 31)] - PolkadotXcm(runtime_types::pallet_xcm::pallet::Call), - #[codec(index = 33)] - MessageQueue(runtime_types::pallet_message_queue::pallet::Call), - #[codec(index = 40)] - Ismp(runtime_types::pallet_ismp::pallet::Call), - #[codec(index = 41)] - IsmpSyncCommittee(runtime_types::ismp_sync_committee::pallet::pallet::Call), - #[codec(index = 42)] - IsmpDemo(runtime_types::ismp_demo::pallet::Call), - #[codec(index = 43)] - Relayer(runtime_types::pallet_ismp_relayer::pallet::Call), - #[codec(index = 45)] - StateMachineManager(runtime_types::state_machine_manager::pallet::Call), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeError { - #[codec(index = 0)] - System(runtime_types::frame_system::pallet::Error), - #[codec(index = 2)] - ParachainSystem(runtime_types::cumulus_pallet_parachain_system::pallet::Error), - #[codec(index = 10)] - Balances(runtime_types::pallet_balances::pallet::Error), - #[codec(index = 21)] - CollatorSelection(runtime_types::pallet_collator_selection::pallet::Error), - #[codec(index = 22)] - Session(runtime_types::pallet_session::pallet::Error), - #[codec(index = 25)] - Sudo(runtime_types::pallet_sudo::pallet::Error), - #[codec(index = 30)] - XcmpQueue(runtime_types::cumulus_pallet_xcmp_queue::pallet::Error), - #[codec(index = 31)] - PolkadotXcm(runtime_types::pallet_xcm::pallet::Error), - #[codec(index = 33)] - MessageQueue(runtime_types::pallet_message_queue::pallet::Error), - #[codec(index = 40)] - Ismp(runtime_types::pallet_ismp::pallet::Error), - #[codec(index = 41)] - IsmpSyncCommittee(runtime_types::ismp_sync_committee::pallet::pallet::Error), - #[codec(index = 42)] - IsmpDemo(runtime_types::ismp_demo::pallet::Error), - #[codec(index = 43)] - Relayer(runtime_types::pallet_ismp_relayer::pallet::Error), - #[codec(index = 45)] - StateMachineManager(runtime_types::state_machine_manager::pallet::Error), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeEvent { - #[codec(index = 0)] - System(runtime_types::frame_system::pallet::Event), - #[codec(index = 2)] - ParachainSystem(runtime_types::cumulus_pallet_parachain_system::pallet::Event), - #[codec(index = 10)] - Balances(runtime_types::pallet_balances::pallet::Event), - #[codec(index = 11)] - TransactionPayment(runtime_types::pallet_transaction_payment::pallet::Event), - #[codec(index = 21)] - CollatorSelection(runtime_types::pallet_collator_selection::pallet::Event), - #[codec(index = 22)] - Session(runtime_types::pallet_session::pallet::Event), - #[codec(index = 25)] - Sudo(runtime_types::pallet_sudo::pallet::Event), - #[codec(index = 30)] - XcmpQueue(runtime_types::cumulus_pallet_xcmp_queue::pallet::Event), - #[codec(index = 31)] - PolkadotXcm(runtime_types::pallet_xcm::pallet::Event), - #[codec(index = 32)] - CumulusXcm(runtime_types::cumulus_pallet_xcm::pallet::Event), - #[codec(index = 33)] - MessageQueue(runtime_types::pallet_message_queue::pallet::Event), - #[codec(index = 40)] - Ismp(runtime_types::pallet_ismp::pallet::Event), - #[codec(index = 42)] - IsmpDemo(runtime_types::ismp_demo::pallet::Event), - #[codec(index = 43)] - Relayer(runtime_types::pallet_ismp_relayer::pallet::Event), - #[codec(index = 45)] - StateMachineManager(runtime_types::state_machine_manager::pallet::Event), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeHoldReason {} - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SessionKeys { - pub aura: runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, + pub mod pallet { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + #[doc = "See [`Pallet::set_params`]."] + set_params { + update: + runtime_types::pallet_asset_gateway::pallet::TokenGatewayParamsUpdate, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Error encountered while dispatching post request"] + DispatchPostError, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "Events emiited by the relayer pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "An XCM transfer from the relay chain has been transformed into a crosschain message"] + AssetTeleported { + from: ::subxt::utils::AccountId32, + to: ::subxt::utils::H160, + amount: ::core::primitive::u128, + dest: runtime_types::ismp::host::StateMachine, + }, + #[codec(index = 1)] + #[doc = "An asset has been received and transferred to the beneficiary's account on the"] + #[doc = "relaychain"] + AssetReceived { + beneficiary: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + source: runtime_types::ismp::host::StateMachine, + }, + #[codec(index = 2)] + #[doc = "An asset has been refunded and transferred to the beneficiary's account on the"] + #[doc = "relaychain"] + AssetRefunded { + beneficiary: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + source: runtime_types::ismp::host::StateMachine, + }, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct TokenGatewayParams { + pub protocol_fee_percentage: runtime_types::sp_arithmetic::per_things::Percent, + pub token_gateway_address: ::subxt::utils::H160, + pub dot_asset_id: ::subxt::utils::H256, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct TokenGatewayParamsUpdate { + pub protocol_fee_percentage: + ::core::option::Option, + pub token_gateway_address: ::core::option::Option<::subxt::utils::H160>, + pub dot_asset_id: ::core::option::Option<::subxt::utils::H256>, + } } } - pub mod ismp { + pub mod pallet_assets { use super::runtime_types; - pub mod consensus { + pub mod pallet { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -12154,10 +14791,222 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StateCommitment { - pub timestamp: ::core::primitive::u64, - pub overlay_root: ::core::option::Option<::subxt::utils::H256>, - pub state_root: ::subxt::utils::H256, + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + #[doc = "See [`Pallet::create`]."] + create { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + min_balance: ::core::primitive::u128, + }, + #[codec(index = 1)] + #[doc = "See [`Pallet::force_create`]."] + force_create { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + is_sufficient: ::core::primitive::bool, + #[codec(compact)] + min_balance: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "See [`Pallet::start_destroy`]."] + start_destroy { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 3)] + #[doc = "See [`Pallet::destroy_accounts`]."] + destroy_accounts { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 4)] + #[doc = "See [`Pallet::destroy_approvals`]."] + destroy_approvals { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 5)] + #[doc = "See [`Pallet::finish_destroy`]."] + finish_destroy { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 6)] + #[doc = "See [`Pallet::mint`]."] + mint { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + beneficiary: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 7)] + #[doc = "See [`Pallet::burn`]."] + burn { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 8)] + #[doc = "See [`Pallet::transfer`]."] + transfer { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 9)] + #[doc = "See [`Pallet::transfer_keep_alive`]."] + transfer_keep_alive { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 10)] + #[doc = "See [`Pallet::force_transfer`]."] + force_transfer { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + source: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 11)] + #[doc = "See [`Pallet::freeze`]."] + freeze { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 12)] + #[doc = "See [`Pallet::thaw`]."] + thaw { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 13)] + #[doc = "See [`Pallet::freeze_asset`]."] + freeze_asset { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 14)] + #[doc = "See [`Pallet::thaw_asset`]."] + thaw_asset { id: runtime_types::staging_xcm::v3::multilocation::MultiLocation }, + #[codec(index = 15)] + #[doc = "See [`Pallet::transfer_ownership`]."] + transfer_ownership { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 16)] + #[doc = "See [`Pallet::set_team`]."] + set_team { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + issuer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + freezer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 17)] + #[doc = "See [`Pallet::set_metadata`]."] + set_metadata { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + name: ::std::vec::Vec<::core::primitive::u8>, + symbol: ::std::vec::Vec<::core::primitive::u8>, + decimals: ::core::primitive::u8, + }, + #[codec(index = 18)] + #[doc = "See [`Pallet::clear_metadata`]."] + clear_metadata { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 19)] + #[doc = "See [`Pallet::force_set_metadata`]."] + force_set_metadata { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + name: ::std::vec::Vec<::core::primitive::u8>, + symbol: ::std::vec::Vec<::core::primitive::u8>, + decimals: ::core::primitive::u8, + is_frozen: ::core::primitive::bool, + }, + #[codec(index = 20)] + #[doc = "See [`Pallet::force_clear_metadata`]."] + force_clear_metadata { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 21)] + #[doc = "See [`Pallet::force_asset_status`]."] + force_asset_status { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + issuer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + admin: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + freezer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + min_balance: ::core::primitive::u128, + is_sufficient: ::core::primitive::bool, + is_frozen: ::core::primitive::bool, + }, + #[codec(index = 22)] + #[doc = "See [`Pallet::approve_transfer`]."] + approve_transfer { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 23)] + #[doc = "See [`Pallet::cancel_approval`]."] + cancel_approval { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 24)] + #[doc = "See [`Pallet::force_cancel_approval`]."] + force_cancel_approval { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + delegate: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 25)] + #[doc = "See [`Pallet::transfer_approved`]."] + transfer_approved { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + destination: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + amount: ::core::primitive::u128, + }, + #[codec(index = 26)] + #[doc = "See [`Pallet::touch`]."] + touch { id: runtime_types::staging_xcm::v3::multilocation::MultiLocation }, + #[codec(index = 27)] + #[doc = "See [`Pallet::refund`]."] + refund { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + allow_burn: ::core::primitive::bool, + }, + #[codec(index = 28)] + #[doc = "See [`Pallet::set_min_balance`]."] + set_min_balance { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + min_balance: ::core::primitive::u128, + }, + #[codec(index = 29)] + #[doc = "See [`Pallet::touch_other`]."] + touch_other { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 30)] + #[doc = "See [`Pallet::refund_other`]."] + refund_other { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 31)] + #[doc = "See [`Pallet::block`]."] + block { + id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12169,9 +15018,71 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StateMachineHeight { - pub id: runtime_types::ismp::consensus::StateMachineId, - pub height: ::core::primitive::u64, + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Account balance must be greater than or equal to the transfer amount."] + BalanceLow, + #[codec(index = 1)] + #[doc = "The account to alter does not exist."] + NoAccount, + #[codec(index = 2)] + #[doc = "The signing account has no permission to do the operation."] + NoPermission, + #[codec(index = 3)] + #[doc = "The given asset ID is unknown."] + Unknown, + #[codec(index = 4)] + #[doc = "The origin account is frozen."] + Frozen, + #[codec(index = 5)] + #[doc = "The asset ID is already taken."] + InUse, + #[codec(index = 6)] + #[doc = "Invalid witness data given."] + BadWitness, + #[codec(index = 7)] + #[doc = "Minimum balance should be non-zero."] + MinBalanceZero, + #[codec(index = 8)] + #[doc = "Unable to increment the consumer reference counters on the account. Either no provider"] + #[doc = "reference exists to allow a non-zero balance of a non-self-sufficient asset, or one"] + #[doc = "fewer then the maximum number of consumers has been reached."] + UnavailableConsumer, + #[codec(index = 9)] + #[doc = "Invalid metadata given."] + BadMetadata, + #[codec(index = 10)] + #[doc = "No approval exists that would allow the transfer."] + Unapproved, + #[codec(index = 11)] + #[doc = "The source account would not survive the transfer and it needs to stay alive."] + WouldDie, + #[codec(index = 12)] + #[doc = "The asset-account already exists."] + AlreadyExists, + #[codec(index = 13)] + #[doc = "The asset-account doesn't have an associated deposit."] + NoDeposit, + #[codec(index = 14)] + #[doc = "The operation would result in funds being burned."] + WouldBurn, + #[codec(index = 15)] + #[doc = "The asset is a live asset and is actively being used. Usually emit for operations such"] + #[doc = "as `start_destroy` which require the asset to be in a destroying state."] + LiveAsset, + #[codec(index = 16)] + #[doc = "The asset is not live, and likely being destroyed."] + AssetNotLive, + #[codec(index = 17)] + #[doc = "The asset status is not the expected status."] + IncorrectStatus, + #[codec(index = 18)] + #[doc = "The asset should be frozen before the given operation."] + NotFrozen, + #[codec(index = 19)] + #[doc = "Callback action resulted in error"] + CallbackFailed, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12183,12 +15094,169 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StateMachineId { - pub state_id: runtime_types::ismp::host::StateMachine, - pub consensus_state_id: [::core::primitive::u8; 4usize], + #[doc = "The `Event` enum of this pallet"] + pub enum Event { + #[codec(index = 0)] + #[doc = "Some asset class was created."] + Created { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + creator: ::subxt::utils::AccountId32, + owner: ::subxt::utils::AccountId32, + }, + #[codec(index = 1)] + #[doc = "Some assets were issued."] + Issued { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Some assets were transferred."] + Transferred { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + from: ::subxt::utils::AccountId32, + to: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "Some assets were destroyed."] + Burned { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::AccountId32, + balance: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "The management team changed."] + TeamChanged { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + issuer: ::subxt::utils::AccountId32, + admin: ::subxt::utils::AccountId32, + freezer: ::subxt::utils::AccountId32, + }, + #[codec(index = 5)] + #[doc = "The owner changed."] + OwnerChanged { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::AccountId32, + }, + #[codec(index = 6)] + #[doc = "Some account `who` was frozen."] + Frozen { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::AccountId32, + }, + #[codec(index = 7)] + #[doc = "Some account `who` was thawed."] + Thawed { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::AccountId32, + }, + #[codec(index = 8)] + #[doc = "Some asset `asset_id` was frozen."] + AssetFrozen { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 9)] + #[doc = "Some asset `asset_id` was thawed."] + AssetThawed { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 10)] + #[doc = "Accounts were destroyed for given asset."] + AccountsDestroyed { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + accounts_destroyed: ::core::primitive::u32, + accounts_remaining: ::core::primitive::u32, + }, + #[codec(index = 11)] + #[doc = "Approvals were destroyed for given asset."] + ApprovalsDestroyed { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + approvals_destroyed: ::core::primitive::u32, + approvals_remaining: ::core::primitive::u32, + }, + #[codec(index = 12)] + #[doc = "An asset class is in the process of being destroyed."] + DestructionStarted { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 13)] + #[doc = "An asset class was destroyed."] + Destroyed { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 14)] + #[doc = "Some asset class was force-created."] + ForceCreated { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::AccountId32, + }, + #[codec(index = 15)] + #[doc = "New metadata has been set for an asset."] + MetadataSet { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + name: ::std::vec::Vec<::core::primitive::u8>, + symbol: ::std::vec::Vec<::core::primitive::u8>, + decimals: ::core::primitive::u8, + is_frozen: ::core::primitive::bool, + }, + #[codec(index = 16)] + #[doc = "Metadata has been cleared for an asset."] + MetadataCleared { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 17)] + #[doc = "(Additional) funds have been approved for transfer to a destination account."] + ApprovedTransfer { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + source: ::subxt::utils::AccountId32, + delegate: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 18)] + #[doc = "An approval for account `delegate` was cancelled by `owner`."] + ApprovalCancelled { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::AccountId32, + delegate: ::subxt::utils::AccountId32, + }, + #[codec(index = 19)] + #[doc = "An `amount` was transferred in its entirety from `owner` to `destination` by"] + #[doc = "the approved `delegate`."] + TransferredApproved { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + owner: ::subxt::utils::AccountId32, + delegate: ::subxt::utils::AccountId32, + destination: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 20)] + #[doc = "An asset has had its attributes changed by the `Force` origin."] + AssetStatusChanged { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + }, + #[codec(index = 21)] + #[doc = "The min_balance of an asset has been updated by the asset owner."] + AssetMinBalanceChanged { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + new_min_balance: ::core::primitive::u128, + }, + #[codec(index = 22)] + #[doc = "Some account `who` was created with a deposit from `depositor`."] + Touched { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::AccountId32, + depositor: ::subxt::utils::AccountId32, + }, + #[codec(index = 23)] + #[doc = "Some account `who` was blocked."] + Blocked { + asset_id: runtime_types::staging_xcm::v3::multilocation::MultiLocation, + who: ::subxt::utils::AccountId32, + }, } } - pub mod host { + pub mod types { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -12200,15 +15268,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Ethereum { + pub enum AccountStatus { #[codec(index = 0)] - ExecutionLayer, + Liquid, #[codec(index = 1)] - Optimism, + Frozen, #[codec(index = 2)] - Arbitrum, - #[codec(index = 3)] - Base, + Blocked, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12220,25 +15286,10 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum StateMachine { - #[codec(index = 0)] - Ethereum(runtime_types::ismp::host::Ethereum), - #[codec(index = 1)] - Polkadot(::core::primitive::u32), - #[codec(index = 2)] - Kusama(::core::primitive::u32), - #[codec(index = 3)] - Grandpa([::core::primitive::u8; 4usize]), - #[codec(index = 4)] - Beefy([::core::primitive::u8; 4usize]), - #[codec(index = 5)] - Polygon, - #[codec(index = 6)] - Bsc, + pub struct Approval<_0, _1> { + pub amount: _0, + pub deposit: _1, } - } - pub mod messaging { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -12249,9 +15300,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ConsensusMessage { - pub consensus_proof: ::std::vec::Vec<::core::primitive::u8>, - pub consensus_state_id: [::core::primitive::u8; 4usize], + pub struct AssetAccount<_0, _1, _2, _3> { + pub balance: _0, + pub status: runtime_types::pallet_assets::types::AccountStatus, + pub reason: runtime_types::pallet_assets::types::ExistenceReason<_0, _3>, + pub extra: _2, + #[codec(skip)] + pub __subxt_unused_type_params: ::core::marker::PhantomData<_1>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12263,16 +15318,19 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CreateConsensusState { - pub consensus_state: ::std::vec::Vec<::core::primitive::u8>, - pub consensus_client_id: [::core::primitive::u8; 4usize], - pub consensus_state_id: [::core::primitive::u8; 4usize], - pub unbonding_period: ::core::primitive::u64, - pub challenge_period: ::core::primitive::u64, - pub state_machine_commitments: ::std::vec::Vec<( - runtime_types::ismp::consensus::StateMachineId, - runtime_types::ismp::messaging::StateCommitmentHeight, - )>, + pub struct AssetDetails<_0, _1, _2> { + pub owner: _1, + pub issuer: _1, + pub admin: _1, + pub freezer: _1, + pub supply: _0, + pub deposit: _2, + pub min_balance: _0, + pub is_sufficient: ::core::primitive::bool, + pub accounts: ::core::primitive::u32, + pub sufficients: ::core::primitive::u32, + pub approvals: ::core::primitive::u32, + pub status: runtime_types::pallet_assets::types::AssetStatus, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12284,10 +15342,12 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct FraudProofMessage { - pub proof_1: ::std::vec::Vec<::core::primitive::u8>, - pub proof_2: ::std::vec::Vec<::core::primitive::u8>, - pub consensus_state_id: [::core::primitive::u8; 4usize], + pub struct AssetMetadata<_0, _1> { + pub deposit: _0, + pub name: _1, + pub symbol: _1, + pub decimals: ::core::primitive::u8, + pub is_frozen: ::core::primitive::bool, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12299,31 +15359,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Message { + pub enum AssetStatus { #[codec(index = 0)] - Consensus(runtime_types::ismp::messaging::ConsensusMessage), + Live, #[codec(index = 1)] - FraudProof(runtime_types::ismp::messaging::FraudProofMessage), + Frozen, #[codec(index = 2)] - Request(runtime_types::ismp::messaging::RequestMessage), - #[codec(index = 3)] - Response(runtime_types::ismp::messaging::ResponseMessage), - #[codec(index = 4)] - Timeout(runtime_types::ismp::messaging::TimeoutMessage), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Proof { - pub height: runtime_types::ismp::consensus::StateMachineHeight, - pub proof: ::std::vec::Vec<::core::primitive::u8>, + Destroying, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12335,11 +15377,24 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct RequestMessage { - pub requests: ::std::vec::Vec, - pub proof: runtime_types::ismp::messaging::Proof, - pub signer: ::std::vec::Vec<::core::primitive::u8>, + pub enum ExistenceReason<_0, _1> { + #[codec(index = 0)] + Consumer, + #[codec(index = 1)] + Sufficient, + #[codec(index = 2)] + DepositHeld(_0), + #[codec(index = 3)] + DepositRefunded, + #[codec(index = 4)] + DepositFrom(_1, _0), } + } + } + pub mod pallet_balances { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -12350,10 +15405,52 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ResponseMessage { - pub datagram: runtime_types::ismp::router::RequestResponse, - pub proof: runtime_types::ismp::messaging::Proof, - pub signer: ::std::vec::Vec<::core::primitive::u8>, + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { + #[codec(index = 0)] + #[doc = "See [`Pallet::transfer_allow_death`]."] + transfer_allow_death { + dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "See [`Pallet::force_transfer`]."] + force_transfer { + source: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "See [`Pallet::transfer_keep_alive`]."] + transfer_keep_alive { + dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + value: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "See [`Pallet::transfer_all`]."] + transfer_all { + dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + keep_alive: ::core::primitive::bool, + }, + #[codec(index = 5)] + #[doc = "See [`Pallet::force_unreserve`]."] + force_unreserve { + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + amount: ::core::primitive::u128, + }, + #[codec(index = 6)] + #[doc = "See [`Pallet::upgrade_accounts`]."] + upgrade_accounts { who: ::std::vec::Vec<::subxt::utils::AccountId32> }, + #[codec(index = 8)] + #[doc = "See [`Pallet::force_set_balance`]."] + force_set_balance { + who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + new_free: ::core::primitive::u128, + }, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12365,9 +15462,38 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StateCommitmentHeight { - pub commitment: runtime_types::ismp::consensus::StateCommitment, - pub height: ::core::primitive::u64, + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Vesting balance too high to send value."] + VestingBalance, + #[codec(index = 1)] + #[doc = "Account liquidity restrictions prevent withdrawal."] + LiquidityRestrictions, + #[codec(index = 2)] + #[doc = "Balance too low to send value."] + InsufficientBalance, + #[codec(index = 3)] + #[doc = "Value too low to create account due to existential deposit."] + ExistentialDeposit, + #[codec(index = 4)] + #[doc = "Transfer/payment would kill account."] + Expendability, + #[codec(index = 5)] + #[doc = "A vesting schedule already exists for this account."] + ExistingVestingSchedule, + #[codec(index = 6)] + #[doc = "Beneficiary account must pre-exist."] + DeadAccount, + #[codec(index = 7)] + #[doc = "Number of named reserves exceed `MaxReserves`."] + TooManyReserves, + #[codec(index = 8)] + #[doc = "Number of holds exceed `MaxHolds`."] + TooManyHolds, + #[codec(index = 9)] + #[doc = "Number of freezes exceed `MaxFreezes`."] + TooManyFreezes, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12379,22 +15505,92 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum TimeoutMessage { + #[doc = "The `Event` enum of this pallet"] + pub enum Event { #[codec(index = 0)] - Post { - requests: ::std::vec::Vec, - timeout_proof: runtime_types::ismp::messaging::Proof, + #[doc = "An account was created with some free balance."] + Endowed { + account: ::subxt::utils::AccountId32, + free_balance: ::core::primitive::u128, }, #[codec(index = 1)] - PostResponse { - responses: ::std::vec::Vec, - timeout_proof: runtime_types::ismp::messaging::Proof, + #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] + #[doc = "resulting in an outright loss."] + DustLost { + account: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, }, #[codec(index = 2)] - Get { requests: ::std::vec::Vec }, + #[doc = "Transfer succeeded."] + Transfer { + from: ::subxt::utils::AccountId32, + to: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "A balance was set by root."] + BalanceSet { who: ::subxt::utils::AccountId32, free: ::core::primitive::u128 }, + #[codec(index = 4)] + #[doc = "Some balance was reserved (moved from free to reserved)."] + Reserved { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 5)] + #[doc = "Some balance was unreserved (moved from reserved to free)."] + Unreserved { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 6)] + #[doc = "Some balance was moved from the reserve of the first account to the second account."] + #[doc = "Final argument indicates the destination balance type."] + ReserveRepatriated { + from: ::subxt::utils::AccountId32, + to: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + destination_status: + runtime_types::frame_support::traits::tokens::misc::BalanceStatus, + }, + #[codec(index = 7)] + #[doc = "Some amount was deposited (e.g. for transaction fees)."] + Deposit { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 8)] + #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] + Withdraw { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 9)] + #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] + Slashed { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 10)] + #[doc = "Some amount was minted into an account."] + Minted { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 11)] + #[doc = "Some amount was burned from an account."] + Burned { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 12)] + #[doc = "Some amount was suspended from an account (it can be restored later)."] + Suspended { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 13)] + #[doc = "Some amount was restored into an account."] + Restored { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 14)] + #[doc = "An account was upgraded."] + Upgraded { who: ::subxt::utils::AccountId32 }, + #[codec(index = 15)] + #[doc = "Total issuance was increased by `amount`, creating a credit to be balanced."] + Issued { amount: ::core::primitive::u128 }, + #[codec(index = 16)] + #[doc = "Total issuance was decreased by `amount`, creating a debt to be balanced."] + Rescinded { amount: ::core::primitive::u128 }, + #[codec(index = 17)] + #[doc = "Some balance was locked."] + Locked { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 18)] + #[doc = "Some balance was unlocked."] + Unlocked { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 19)] + #[doc = "Some balance was frozen."] + Frozen { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + #[codec(index = 20)] + #[doc = "Some balance was thawed."] + Thawed { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, } } - pub mod router { + pub mod types { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -12406,31 +15602,11 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Get { - pub source: runtime_types::ismp::host::StateMachine, - pub dest: runtime_types::ismp::host::StateMachine, - pub nonce: ::core::primitive::u64, - pub from: ::std::vec::Vec<::core::primitive::u8>, - pub keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, - pub height: ::core::primitive::u64, - pub timeout_timestamp: ::core::primitive::u64, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetResponse { - pub get: runtime_types::ismp::router::Get, - pub values: ::subxt::utils::KeyedVec< - ::std::vec::Vec<::core::primitive::u8>, - ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>, - >, + pub struct AccountData<_0> { + pub free: _0, + pub reserved: _0, + pub frozen: _0, + pub flags: runtime_types::pallet_balances::types::ExtraFlags, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12442,16 +15618,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Post { - pub source: runtime_types::ismp::host::StateMachine, - pub dest: runtime_types::ismp::host::StateMachine, - pub nonce: ::core::primitive::u64, - pub from: ::std::vec::Vec<::core::primitive::u8>, - pub to: ::std::vec::Vec<::core::primitive::u8>, - pub timeout_timestamp: ::core::primitive::u64, - pub data: ::std::vec::Vec<::core::primitive::u8>, + pub struct BalanceLock<_0> { + pub id: [::core::primitive::u8; 8usize], + pub amount: _0, + pub reasons: runtime_types::pallet_balances::types::Reasons, } #[derive( + :: subxt :: ext :: codec :: CompactAs, :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, :: subxt :: ext :: scale_decode :: DecodeAsType, @@ -12461,11 +15634,7 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct PostResponse { - pub post: runtime_types::ismp::router::Post, - pub response: ::std::vec::Vec<::core::primitive::u8>, - pub timeout_timestamp: ::core::primitive::u64, - } + pub struct ExtraFlags(pub ::core::primitive::u128); #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -12476,11 +15645,9 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Request { - #[codec(index = 0)] - Post(runtime_types::ismp::router::Post), - #[codec(index = 1)] - Get(runtime_types::ismp::router::Get), + pub struct IdAmount<_0, _1> { + pub id: _0, + pub amount: _1, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12492,11 +15659,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RequestResponse { + pub enum Reasons { #[codec(index = 0)] - Request(::std::vec::Vec), + Fee, #[codec(index = 1)] - Response(::std::vec::Vec), + Misc, + #[codec(index = 2)] + All, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12508,15 +15677,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Response { - #[codec(index = 0)] - Post(runtime_types::ismp::router::PostResponse), - #[codec(index = 1)] - Get(runtime_types::ismp::router::GetResponse), + pub struct ReserveData<_0, _1> { + pub id: _0, + pub amount: _1, } } } - pub mod ismp_demo { + pub mod pallet_call_decompressor { use super::runtime_types; pub mod pallet { use super::runtime_types; @@ -12533,191 +15700,43 @@ pub mod api { #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] pub enum Call { #[codec(index = 0)] - #[doc = "See [`Pallet::transfer`]."] - transfer { - params: runtime_types::ismp_demo::pallet::TransferParams< - ::subxt::utils::AccountId32, - ::core::primitive::u128, - >, - }, - #[codec(index = 1)] - #[doc = "See [`Pallet::get_request`]."] - get_request { params: runtime_types::ismp_demo::pallet::GetRequest }, - #[codec(index = 2)] - #[doc = "See [`Pallet::dispatch_to_evm`]."] - dispatch_to_evm { params: runtime_types::ismp_demo::pallet::EvmParams }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Pallet Errors"] - pub enum Error { - #[codec(index = 0)] - #[doc = "Error encountered when initializing transfer"] - TransferFailed, - #[codec(index = 1)] - #[doc = "Failed to dispatch get request"] - GetDispatchFailed, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Pallet events"] - pub enum Event { - #[codec(index = 0)] - #[doc = "Some balance has been transferred"] - BalanceTransferred { - from: ::subxt::utils::AccountId32, - to: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - dest_chain: runtime_types::ismp::host::StateMachine, - }, - #[codec(index = 1)] - #[doc = "Some balance has been received"] - BalanceReceived { - from: ::subxt::utils::AccountId32, - to: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - source_chain: runtime_types::ismp::host::StateMachine, + #[doc = "See [`Pallet::decompress_call`]."] + decompress_call { + compressed: ::std::vec::Vec<::core::primitive::u8>, + encoded_call_size: ::core::primitive::u32, }, - #[codec(index = 2)] - #[doc = "Request data receieved"] - Request { - source: runtime_types::ismp::host::StateMachine, - data: ::std::string::String, - }, - #[codec(index = 3)] - #[doc = "Get response recieved"] - GetResponse( - ::std::vec::Vec< - ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>, - >, - ), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EvmParams { - pub module: ::subxt::utils::H160, - pub destination: runtime_types::ismp::host::Ethereum, - pub timeout: ::core::primitive::u64, - pub count: ::core::primitive::u64, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetRequest { - pub para_id: ::core::primitive::u32, - pub height: ::core::primitive::u32, - pub timeout: ::core::primitive::u64, - pub keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct TransferParams<_0, _1> { - pub to: _0, - pub amount: _1, - pub para_id: ::core::primitive::u32, - pub timeout: ::core::primitive::u64, - } - } - } - pub mod ismp_sync_committee { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::add_ismp_address`]."] - add_ismp_address { - contract_address: ::subxt::utils::H160, - state_machine_id: runtime_types::ismp::consensus::StateMachineId, - }, - #[codec(index = 1)] - #[doc = "See [`Pallet::add_l2_oracle`]."] - add_l2_oracle { - state_machine_id: runtime_types::ismp::consensus::StateMachineId, - l2_oracle: ::subxt::utils::H160, - }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Error` enum of this pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Contract Address Already Exists"] - ContractAddressAlreadyExists, - #[codec(index = 1)] - #[doc = "Error fetching consensus state"] - ErrorFetchingConsensusState, - #[codec(index = 2)] - #[doc = "Error decoding consensus state"] - ErrorDecodingConsensusState, - #[codec(index = 3)] - #[doc = "Error storing consensus state"] - ErrorStoringConsensusState, - } + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Unsupported Call"] + CallNotSupported, + #[codec(index = 1)] + #[doc = "Error executing Call"] + ErrorExecutingCall, + #[codec(index = 2)] + #[doc = "Decompression Failed"] + DecompressionFailed, + #[codec(index = 3)] + #[doc = "Error Decoding Call"] + ErrorDecodingCall, + #[codec(index = 4)] + #[doc = "Call Size Out Of Bound"] + CallSizeOutOfBound, } } } - pub mod pallet_balances { + pub mod pallet_collator_selection { use super::runtime_types; pub mod pallet { use super::runtime_types; @@ -12734,48 +15753,34 @@ pub mod api { #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] pub enum Call { #[codec(index = 0)] - #[doc = "See [`Pallet::transfer_allow_death`]."] - transfer_allow_death { - dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - #[codec(compact)] - value: ::core::primitive::u128, - }, + #[doc = "See [`Pallet::set_invulnerables`]."] + set_invulnerables { new: ::std::vec::Vec<::subxt::utils::AccountId32> }, + #[codec(index = 1)] + #[doc = "See [`Pallet::set_desired_candidates`]."] + set_desired_candidates { max: ::core::primitive::u32 }, #[codec(index = 2)] - #[doc = "See [`Pallet::force_transfer`]."] - force_transfer { - source: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - #[codec(compact)] - value: ::core::primitive::u128, - }, + #[doc = "See [`Pallet::set_candidacy_bond`]."] + set_candidacy_bond { bond: ::core::primitive::u128 }, #[codec(index = 3)] - #[doc = "See [`Pallet::transfer_keep_alive`]."] - transfer_keep_alive { - dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - #[codec(compact)] - value: ::core::primitive::u128, - }, + #[doc = "See [`Pallet::register_as_candidate`]."] + register_as_candidate, #[codec(index = 4)] - #[doc = "See [`Pallet::transfer_all`]."] - transfer_all { - dest: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - keep_alive: ::core::primitive::bool, - }, + #[doc = "See [`Pallet::leave_intent`]."] + leave_intent, #[codec(index = 5)] - #[doc = "See [`Pallet::force_unreserve`]."] - force_unreserve { - who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - amount: ::core::primitive::u128, - }, + #[doc = "See [`Pallet::add_invulnerable`]."] + add_invulnerable { who: ::subxt::utils::AccountId32 }, #[codec(index = 6)] - #[doc = "See [`Pallet::upgrade_accounts`]."] - upgrade_accounts { who: ::std::vec::Vec<::subxt::utils::AccountId32> }, + #[doc = "See [`Pallet::remove_invulnerable`]."] + remove_invulnerable { who: ::subxt::utils::AccountId32 }, + #[codec(index = 7)] + #[doc = "See [`Pallet::update_bond`]."] + update_bond { new_deposit: ::core::primitive::u128 }, #[codec(index = 8)] - #[doc = "See [`Pallet::force_set_balance`]."] - force_set_balance { - who: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - #[codec(compact)] - new_free: ::core::primitive::u128, + #[doc = "See [`Pallet::take_candidate_slot`]."] + take_candidate_slot { + deposit: ::core::primitive::u128, + target: ::subxt::utils::AccountId32, }, } #[derive( @@ -12788,38 +15793,73 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct CandidateInfo<_0, _1> { + pub who: _0, + pub deposit: _1, + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] #[doc = "The `Error` enum of this pallet."] pub enum Error { #[codec(index = 0)] - #[doc = "Vesting balance too high to send value."] - VestingBalance, + #[doc = "The pallet has too many candidates."] + TooManyCandidates, #[codec(index = 1)] - #[doc = "Account liquidity restrictions prevent withdrawal."] - LiquidityRestrictions, + #[doc = "Leaving would result in too few candidates."] + TooFewEligibleCollators, #[codec(index = 2)] - #[doc = "Balance too low to send value."] - InsufficientBalance, + #[doc = "Account is already a candidate."] + AlreadyCandidate, #[codec(index = 3)] - #[doc = "Value too low to create account due to existential deposit."] - ExistentialDeposit, + #[doc = "Account is not a candidate."] + NotCandidate, #[codec(index = 4)] - #[doc = "Transfer/payment would kill account."] - Expendability, + #[doc = "There are too many Invulnerables."] + TooManyInvulnerables, #[codec(index = 5)] - #[doc = "A vesting schedule already exists for this account."] - ExistingVestingSchedule, + #[doc = "Account is already an Invulnerable."] + AlreadyInvulnerable, #[codec(index = 6)] - #[doc = "Beneficiary account must pre-exist."] - DeadAccount, + #[doc = "Account is not an Invulnerable."] + NotInvulnerable, #[codec(index = 7)] - #[doc = "Number of named reserves exceed `MaxReserves`."] - TooManyReserves, + #[doc = "Account has no associated validator ID."] + NoAssociatedValidatorId, #[codec(index = 8)] - #[doc = "Number of holds exceed `MaxHolds`."] - TooManyHolds, + #[doc = "Validator ID is not yet registered."] + ValidatorNotRegistered, #[codec(index = 9)] - #[doc = "Number of freezes exceed `MaxFreezes`."] - TooManyFreezes, + #[doc = "Could not insert in the candidate list."] + InsertToCandidateListFailed, + #[codec(index = 10)] + #[doc = "Could not remove from the candidate list."] + RemoveFromCandidateListFailed, + #[codec(index = 11)] + #[doc = "New deposit amount would be below the minimum candidacy bond."] + DepositTooLow, + #[codec(index = 12)] + #[doc = "Could not update the candidate list."] + UpdateCandidateListFailed, + #[codec(index = 13)] + #[doc = "Deposit amount is too low to take the target's slot in the candidate list."] + InsufficientBond, + #[codec(index = 14)] + #[doc = "The target account to be replaced in the candidate list is not a candidate."] + TargetIsNotCandidate, + #[codec(index = 15)] + #[doc = "The updated deposit amount is equal to the amount already reserved."] + IdenticalDeposit, + #[codec(index = 16)] + #[doc = "Cannot lower candidacy bond while occupying a future collator slot in the list."] + InvalidUnreserve, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -12834,89 +15874,158 @@ pub mod api { #[doc = "The `Event` enum of this pallet"] pub enum Event { #[codec(index = 0)] - #[doc = "An account was created with some free balance."] - Endowed { - account: ::subxt::utils::AccountId32, - free_balance: ::core::primitive::u128, - }, + #[doc = "New Invulnerables were set."] + NewInvulnerables { invulnerables: ::std::vec::Vec<::subxt::utils::AccountId32> }, #[codec(index = 1)] - #[doc = "An account was removed whose balance was non-zero but below ExistentialDeposit,"] - #[doc = "resulting in an outright loss."] - DustLost { - account: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, + #[doc = "A new Invulnerable was added."] + InvulnerableAdded { account_id: ::subxt::utils::AccountId32 }, + #[codec(index = 2)] + #[doc = "An Invulnerable was removed."] + InvulnerableRemoved { account_id: ::subxt::utils::AccountId32 }, + #[codec(index = 3)] + #[doc = "The number of desired candidates was set."] + NewDesiredCandidates { desired_candidates: ::core::primitive::u32 }, + #[codec(index = 4)] + #[doc = "The candidacy bond was set."] + NewCandidacyBond { bond_amount: ::core::primitive::u128 }, + #[codec(index = 5)] + #[doc = "A new candidate joined."] + CandidateAdded { + account_id: ::subxt::utils::AccountId32, + deposit: ::core::primitive::u128, + }, + #[codec(index = 6)] + #[doc = "Bond of a candidate updated."] + CandidateBondUpdated { + account_id: ::subxt::utils::AccountId32, + deposit: ::core::primitive::u128, + }, + #[codec(index = 7)] + #[doc = "A candidate was removed."] + CandidateRemoved { account_id: ::subxt::utils::AccountId32 }, + #[codec(index = 8)] + #[doc = "An account was replaced in the candidate list by another one."] + CandidateReplaced { + old: ::subxt::utils::AccountId32, + new: ::subxt::utils::AccountId32, + deposit: ::core::primitive::u128, }, + #[codec(index = 9)] + #[doc = "An account was unable to be added to the Invulnerables because they did not have keys"] + #[doc = "registered. Other Invulnerables may have been set."] + InvalidInvulnerableSkipped { account_id: ::subxt::utils::AccountId32 }, + } + } + } + pub mod pallet_ismp { + use super::runtime_types; + pub mod errors { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum HandlingError { + #[codec(index = 0)] + ChallengePeriodNotElapsed { + update_time: ::core::primitive::u64, + current_time: ::core::primitive::u64, + delay_period: ::core::option::Option<::core::primitive::u64>, + consensus_client_id: + ::core::option::Option<[::core::primitive::u8; 4usize]>, + }, + #[codec(index = 1)] + ConsensusStateNotFound { id: [::core::primitive::u8; 4usize] }, #[codec(index = 2)] - #[doc = "Transfer succeeded."] - Transfer { - from: ::subxt::utils::AccountId32, - to: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, + StateCommitmentNotFound { + height: runtime_types::ismp::consensus::StateMachineHeight, }, #[codec(index = 3)] - #[doc = "A balance was set by root."] - BalanceSet { who: ::subxt::utils::AccountId32, free: ::core::primitive::u128 }, + FrozenConsensusClient { id: [::core::primitive::u8; 4usize] }, #[codec(index = 4)] - #[doc = "Some balance was reserved (moved from free to reserved)."] - Reserved { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + FrozenStateMachine { id: runtime_types::ismp::consensus::StateMachineId }, #[codec(index = 5)] - #[doc = "Some balance was unreserved (moved from reserved to free)."] - Unreserved { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + RequestCommitmentNotFound { meta: runtime_types::ismp::events::Meta }, #[codec(index = 6)] - #[doc = "Some balance was moved from the reserve of the first account to the second account."] - #[doc = "Final argument indicates the destination balance type."] - ReserveRepatriated { - from: ::subxt::utils::AccountId32, - to: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - destination_status: - runtime_types::frame_support::traits::tokens::misc::BalanceStatus, - }, + RequestVerificationFailed { meta: runtime_types::ismp::events::Meta }, #[codec(index = 7)] - #[doc = "Some amount was deposited (e.g. for transaction fees)."] - Deposit { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + ResponseVerificationFailed { meta: runtime_types::ismp::events::Meta }, #[codec(index = 8)] - #[doc = "Some amount was withdrawn from the account (e.g. for transaction fees)."] - Withdraw { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + ConsensusProofVerificationFailed { id: [::core::primitive::u8; 4usize] }, #[codec(index = 9)] - #[doc = "Some amount was removed from the account (e.g. for misbehavior)."] - Slashed { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + ExpiredConsensusClient { id: [::core::primitive::u8; 4usize] }, #[codec(index = 10)] - #[doc = "Some amount was minted into an account."] - Minted { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + CannotHandleMessage, #[codec(index = 11)] - #[doc = "Some amount was burned from an account."] - Burned { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + ImplementationSpecific { msg: ::std::vec::Vec<::core::primitive::u8> }, #[codec(index = 12)] - #[doc = "Some amount was suspended from an account (it can be restored later)."] - Suspended { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + UnbondingPeriodElapsed { id: [::core::primitive::u8; 4usize] }, #[codec(index = 13)] - #[doc = "Some amount was restored into an account."] - Restored { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + MembershipProofVerificationFailed { + msg: ::std::vec::Vec<::core::primitive::u8>, + }, #[codec(index = 14)] - #[doc = "An account was upgraded."] - Upgraded { who: ::subxt::utils::AccountId32 }, + NonMembershipProofVerificationFailed { + msg: ::std::vec::Vec<::core::primitive::u8>, + }, #[codec(index = 15)] - #[doc = "Total issuance was increased by `amount`, creating a credit to be balanced."] - Issued { amount: ::core::primitive::u128 }, + CannotCreateAlreadyExistingConsensusClient { + id: [::core::primitive::u8; 4usize], + }, #[codec(index = 16)] - #[doc = "Total issuance was decreased by `amount`, creating a debt to be balanced."] - Rescinded { amount: ::core::primitive::u128 }, + RequestTimeoutNotElapsed { + meta: runtime_types::ismp::events::Meta, + timeout_timestamp: ::core::primitive::u64, + state_machine_time: ::core::primitive::u64, + }, #[codec(index = 17)] - #[doc = "Some balance was locked."] - Locked { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + RequestTimeoutVerificationFailed { meta: runtime_types::ismp::events::Meta }, #[codec(index = 18)] - #[doc = "Some balance was unlocked."] - Unlocked { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + InsufficientProofHeight, #[codec(index = 19)] - #[doc = "Some balance was frozen."] - Frozen { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + ModuleNotFound(::std::vec::Vec<::core::primitive::u8>), #[codec(index = 20)] - #[doc = "Some balance was thawed."] - Thawed { who: ::subxt::utils::AccountId32, amount: ::core::primitive::u128 }, + ModuleDispatchError { + msg: ::std::vec::Vec<::core::primitive::u8>, + meta: runtime_types::ismp::events::Meta, + }, + #[codec(index = 21)] + UnsolicitedResponse { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 22)] + RequestTimeout { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 23)] + ResponseTimeout { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 24)] + DuplicateRequest { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 25)] + DuplicateResponse { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 26)] + RequestProofMetadataNotValid { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 27)] + ResponseProofMetadataNotValid { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 28)] + RequestProxyProhibited { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 29)] + ResponseProxyProhibited { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 30)] + InvalidRequestDestination { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 31)] + InvalidResponseDestination { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 32)] + InvalidResponseType { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 33)] + UnknownRequest { meta: runtime_types::ismp::events::Meta }, + #[codec(index = 34)] + UnknownResponse { meta: runtime_types::ismp::events::Meta }, } } - pub mod types { + pub mod events { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -12928,53 +16037,42 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AccountData<_0> { - pub free: _0, - pub reserved: _0, - pub frozen: _0, - pub flags: runtime_types::pallet_balances::types::ExtraFlags, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BalanceLock<_0> { - pub id: [::core::primitive::u8; 8usize], - pub amount: _0, - pub reasons: runtime_types::pallet_balances::types::Reasons, - } - #[derive( - :: subxt :: ext :: codec :: CompactAs, - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ExtraFlags(pub ::core::primitive::u128); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct IdAmount<_0, _1> { - pub id: _0, - pub amount: _1, + pub enum Event { + #[codec(index = 0)] + StateMachineUpdated { + state_machine_id: runtime_types::ismp::consensus::StateMachineId, + latest_height: ::core::primitive::u64, + }, + #[codec(index = 1)] + Response { + dest_chain: runtime_types::ismp::host::StateMachine, + source_chain: runtime_types::ismp::host::StateMachine, + request_nonce: ::core::primitive::u64, + commitment: ::subxt::utils::H256, + }, + #[codec(index = 2)] + Request { + dest_chain: runtime_types::ismp::host::StateMachine, + source_chain: runtime_types::ismp::host::StateMachine, + request_nonce: ::core::primitive::u64, + commitment: ::subxt::utils::H256, + }, + #[codec(index = 3)] + PostRequestHandled(runtime_types::ismp::events::RequestResponseHandled), + #[codec(index = 4)] + PostResponseHandled(runtime_types::ismp::events::RequestResponseHandled), + #[codec(index = 5)] + GetRequestHandled(runtime_types::ismp::events::RequestResponseHandled), + #[codec(index = 6)] + PostRequestTimeoutHandled(runtime_types::ismp::events::TimeoutHandled), + #[codec(index = 7)] + PostResponseTimeoutHandled(runtime_types::ismp::events::TimeoutHandled), + #[codec(index = 8)] + GetRequestTimeoutHandled(runtime_types::ismp::events::TimeoutHandled), } + } + pub mod mmr { + use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -12985,13 +16083,11 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Reasons { + pub enum Leaf { #[codec(index = 0)] - Fee, + Request(runtime_types::ismp::router::Request), #[codec(index = 1)] - Misc, - #[codec(index = 2)] - All, + Response(runtime_types::ismp::router::Response), } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13003,14 +16099,13 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ReserveData<_0, _1> { - pub id: _0, - pub amount: _1, + pub enum ProofKeys { + #[codec(index = 0)] + Requests(::std::vec::Vec<::subxt::utils::H256>), + #[codec(index = 1)] + Responses(::std::vec::Vec<::subxt::utils::H256>), } } - } - pub mod pallet_collator_selection { - use super::runtime_types; pub mod pallet { use super::runtime_types; #[derive( @@ -13026,34 +16121,22 @@ pub mod api { #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] pub enum Call { #[codec(index = 0)] - #[doc = "See [`Pallet::set_invulnerables`]."] - set_invulnerables { new: ::std::vec::Vec<::subxt::utils::AccountId32> }, + #[doc = "See [`Pallet::handle`]."] + handle { messages: ::std::vec::Vec }, #[codec(index = 1)] - #[doc = "See [`Pallet::set_desired_candidates`]."] - set_desired_candidates { max: ::core::primitive::u32 }, + #[doc = "See [`Pallet::create_consensus_client`]."] + create_consensus_client { + message: runtime_types::ismp::messaging::CreateConsensusState, + }, #[codec(index = 2)] - #[doc = "See [`Pallet::set_candidacy_bond`]."] - set_candidacy_bond { bond: ::core::primitive::u128 }, + #[doc = "See [`Pallet::update_consensus_state`]."] + update_consensus_state { + message: runtime_types::pallet_ismp::pallet::UpdateConsensusState, + }, #[codec(index = 3)] - #[doc = "See [`Pallet::register_as_candidate`]."] - register_as_candidate, - #[codec(index = 4)] - #[doc = "See [`Pallet::leave_intent`]."] - leave_intent, - #[codec(index = 5)] - #[doc = "See [`Pallet::add_invulnerable`]."] - add_invulnerable { who: ::subxt::utils::AccountId32 }, - #[codec(index = 6)] - #[doc = "See [`Pallet::remove_invulnerable`]."] - remove_invulnerable { who: ::subxt::utils::AccountId32 }, - #[codec(index = 7)] - #[doc = "See [`Pallet::update_bond`]."] - update_bond { new_deposit: ::core::primitive::u128 }, - #[codec(index = 8)] - #[doc = "See [`Pallet::take_candidate_slot`]."] - take_candidate_slot { - deposit: ::core::primitive::u128, - target: ::subxt::utils::AccountId32, + #[doc = "See [`Pallet::validate_messages`]."] + validate_messages { + messages: ::std::vec::Vec, }, } #[derive( @@ -13066,73 +16149,20 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CandidateInfo<_0, _1> { - pub who: _0, - pub deposit: _1, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Error` enum of this pallet."] + #[doc = "Pallet errors"] pub enum Error { #[codec(index = 0)] - #[doc = "The pallet has too many candidates."] - TooManyCandidates, + #[doc = "Invalid ISMP message"] + InvalidMessage, #[codec(index = 1)] - #[doc = "Leaving would result in too few candidates."] - TooFewEligibleCollators, - #[codec(index = 2)] - #[doc = "Account is already a candidate."] - AlreadyCandidate, - #[codec(index = 3)] - #[doc = "Account is not a candidate."] - NotCandidate, - #[codec(index = 4)] - #[doc = "There are too many Invulnerables."] - TooManyInvulnerables, - #[codec(index = 5)] - #[doc = "Account is already an Invulnerable."] - AlreadyInvulnerable, - #[codec(index = 6)] - #[doc = "Account is not an Invulnerable."] - NotInvulnerable, - #[codec(index = 7)] - #[doc = "Account has no associated validator ID."] - NoAssociatedValidatorId, - #[codec(index = 8)] - #[doc = "Validator ID is not yet registered."] - ValidatorNotRegistered, - #[codec(index = 9)] - #[doc = "Could not insert in the candidate list."] - InsertToCandidateListFailed, - #[codec(index = 10)] - #[doc = "Could not remove from the candidate list."] - RemoveFromCandidateListFailed, - #[codec(index = 11)] - #[doc = "New deposit amount would be below the minimum candidacy bond."] - DepositTooLow, - #[codec(index = 12)] - #[doc = "Could not update the candidate list."] - UpdateCandidateListFailed, - #[codec(index = 13)] - #[doc = "Deposit amount is too low to take the target's slot in the candidate list."] - InsufficientBond, - #[codec(index = 14)] - #[doc = "The target account to be replaced in the candidate list is not a candidate."] - TargetIsNotCandidate, - #[codec(index = 15)] - #[doc = "The updated deposit amount is equal to the amount already reserved."] - IdenticalDeposit, - #[codec(index = 16)] - #[doc = "Cannot lower candidacy bond while occupying a future collator slot in the list."] - InvalidUnreserve, + #[doc = "Encountered an error while creating the consensus client."] + ConsensusClientCreationFailed, + #[codec(index = 2)] + #[doc = "Couldn't update unbonding period"] + UnbondingPeriodUpdateFailed, + #[codec(index = 3)] + #[doc = "Couldn't update challenge period"] + ChallengePeriodUpdateFailed, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13147,52 +16177,82 @@ pub mod api { #[doc = "The `Event` enum of this pallet"] pub enum Event { #[codec(index = 0)] - #[doc = "New Invulnerables were set."] - NewInvulnerables { invulnerables: ::std::vec::Vec<::subxt::utils::AccountId32> }, + #[doc = "Emitted when a state machine is successfully updated to a new height"] + StateMachineUpdated { + state_machine_id: runtime_types::ismp::consensus::StateMachineId, + latest_height: ::core::primitive::u64, + }, #[codec(index = 1)] - #[doc = "A new Invulnerable was added."] - InvulnerableAdded { account_id: ::subxt::utils::AccountId32 }, + #[doc = "Emitted when a state commitment is vetoed by a fisherman"] + StateCommitmentVetoed { + height: runtime_types::ismp::consensus::StateMachineHeight, + fisherman: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + }, #[codec(index = 2)] - #[doc = "An Invulnerable was removed."] - InvulnerableRemoved { account_id: ::subxt::utils::AccountId32 }, + #[doc = "Indicates that a consensus client has been created"] + ConsensusClientCreated { consensus_client_id: [::core::primitive::u8; 4usize] }, #[codec(index = 3)] - #[doc = "The number of desired candidates was set."] - NewDesiredCandidates { desired_candidates: ::core::primitive::u32 }, + #[doc = "Indicates that a consensus client has been created"] + ConsensusClientFrozen { consensus_client_id: [::core::primitive::u8; 4usize] }, #[codec(index = 4)] - #[doc = "The candidacy bond was set."] - NewCandidacyBond { bond_amount: ::core::primitive::u128 }, + #[doc = "An Outgoing Response has been deposited"] + Response { + dest_chain: runtime_types::ismp::host::StateMachine, + source_chain: runtime_types::ismp::host::StateMachine, + request_nonce: ::core::primitive::u64, + commitment: ::subxt::utils::H256, + }, #[codec(index = 5)] - #[doc = "A new candidate joined."] - CandidateAdded { - account_id: ::subxt::utils::AccountId32, - deposit: ::core::primitive::u128, + #[doc = "An Outgoing Request has been deposited"] + Request { + dest_chain: runtime_types::ismp::host::StateMachine, + source_chain: runtime_types::ismp::host::StateMachine, + request_nonce: ::core::primitive::u64, + commitment: ::subxt::utils::H256, }, #[codec(index = 6)] - #[doc = "Bond of a candidate updated."] - CandidateBondUpdated { - account_id: ::subxt::utils::AccountId32, - deposit: ::core::primitive::u128, + #[doc = "Some errors handling some ismp messages"] + Errors { + errors: ::std::vec::Vec, }, #[codec(index = 7)] - #[doc = "A candidate was removed."] - CandidateRemoved { account_id: ::subxt::utils::AccountId32 }, + #[doc = "Post Request Handled"] + PostRequestHandled(runtime_types::ismp::events::RequestResponseHandled), #[codec(index = 8)] - #[doc = "An account was replaced in the candidate list by another one."] - CandidateReplaced { - old: ::subxt::utils::AccountId32, - new: ::subxt::utils::AccountId32, - deposit: ::core::primitive::u128, - }, + #[doc = "Post Response Handled"] + PostResponseHandled(runtime_types::ismp::events::RequestResponseHandled), #[codec(index = 9)] - #[doc = "An account was unable to be added to the Invulnerables because they did not have keys"] - #[doc = "registered. Other Invulnerables may have been set."] - InvalidInvulnerableSkipped { account_id: ::subxt::utils::AccountId32 }, + #[doc = "Get Response Handled"] + GetRequestHandled(runtime_types::ismp::events::RequestResponseHandled), + #[codec(index = 10)] + #[doc = "Post request timeout handled"] + PostRequestTimeoutHandled(runtime_types::ismp::events::TimeoutHandled), + #[codec(index = 11)] + #[doc = "Post response timeout handled"] + PostResponseTimeoutHandled(runtime_types::ismp::events::TimeoutHandled), + #[codec(index = 12)] + #[doc = "Get request timeout handled"] + GetRequestTimeoutHandled(runtime_types::ismp::events::TimeoutHandled), + } + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct UpdateConsensusState { + pub consensus_state_id: [::core::primitive::u8; 4usize], + pub unbonding_period: ::core::option::Option<::core::primitive::u64>, + pub challenge_period: ::core::option::Option<::core::primitive::u64>, } } - } - pub mod pallet_ismp { - use super::runtime_types; - pub mod dispatcher { + pub mod primitives { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -13204,9 +16264,9 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct FeeMetadata { - pub origin: ::subxt::utils::AccountId32, - pub fee: ::core::primitive::u128, + pub struct LeafIndexAndPos { + pub leaf_index: ::core::primitive::u64, + pub pos: ::core::primitive::u64, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13218,13 +16278,12 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct LeafMetadata { - pub mmr: runtime_types::pallet_ismp::primitives::LeafIndexAndPos, - pub meta: runtime_types::pallet_ismp::dispatcher::FeeMetadata, + pub struct Proof<_0> { + pub leaf_positions: + ::std::vec::Vec, + pub leaf_count: ::core::primitive::u64, + pub items: ::std::vec::Vec<_0>, } - } - pub mod errors { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -13235,86 +16294,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum HandlingError { - #[codec(index = 0)] - ChallengePeriodNotElapsed { - update_time: ::core::primitive::u64, - current_time: ::core::primitive::u64, - delay_period: ::core::option::Option<::core::primitive::u64>, - consensus_client_id: - ::core::option::Option<[::core::primitive::u8; 4usize]>, - }, - #[codec(index = 1)] - ConsensusStateNotFound { id: [::core::primitive::u8; 4usize] }, - #[codec(index = 2)] - StateCommitmentNotFound { - height: runtime_types::ismp::consensus::StateMachineHeight, - }, - #[codec(index = 3)] - FrozenConsensusClient { id: [::core::primitive::u8; 4usize] }, - #[codec(index = 4)] - FrozenStateMachine { id: runtime_types::ismp::consensus::StateMachineId }, - #[codec(index = 5)] - RequestCommitmentNotFound { - nonce: ::core::primitive::u64, - source: runtime_types::ismp::host::StateMachine, - dest: runtime_types::ismp::host::StateMachine, - }, - #[codec(index = 6)] - RequestVerificationFailed { - nonce: ::core::primitive::u64, - source: runtime_types::ismp::host::StateMachine, - dest: runtime_types::ismp::host::StateMachine, - }, - #[codec(index = 7)] - ResponseVerificationFailed { - nonce: ::core::primitive::u64, - source: runtime_types::ismp::host::StateMachine, - dest: runtime_types::ismp::host::StateMachine, - }, - #[codec(index = 8)] - ConsensusProofVerificationFailed { id: [::core::primitive::u8; 4usize] }, - #[codec(index = 9)] - ExpiredConsensusClient { id: [::core::primitive::u8; 4usize] }, - #[codec(index = 10)] - CannotHandleMessage, - #[codec(index = 11)] - ImplementationSpecific { msg: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 12)] - UnbondingPeriodElapsed { id: [::core::primitive::u8; 4usize] }, - #[codec(index = 13)] - MembershipProofVerificationFailed { - msg: ::std::vec::Vec<::core::primitive::u8>, - }, - #[codec(index = 14)] - NonMembershipProofVerificationFailed { - msg: ::std::vec::Vec<::core::primitive::u8>, - }, - #[codec(index = 15)] - CannotCreateAlreadyExistingConsensusClient { - id: [::core::primitive::u8; 4usize], - }, - #[codec(index = 16)] - RequestTimeoutNotElapsed { - nonce: ::core::primitive::u64, - source: runtime_types::ismp::host::StateMachine, - dest: runtime_types::ismp::host::StateMachine, - timeout_timestamp: ::core::primitive::u64, - state_machine_time: ::core::primitive::u64, - }, - #[codec(index = 17)] - RequestTimeoutVerificationFailed { - nonce: ::core::primitive::u64, - source: runtime_types::ismp::host::StateMachine, - dest: runtime_types::ismp::host::StateMachine, - }, - #[codec(index = 18)] - InsufficientProofHeight, - #[codec(index = 19)] - ModuleNotFound(::std::vec::Vec<::core::primitive::u8>), + pub struct WeightUsed { + pub weight_used: runtime_types::sp_weights::weight_v2::Weight, + pub weight_limit: runtime_types::sp_weights::weight_v2::Weight, } } - pub mod events { + } + pub mod pallet_ismp_demo { + use super::runtime_types; + pub mod pallet { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -13326,52 +16314,23 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Event { + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { #[codec(index = 0)] - StateMachineUpdated { - state_machine_id: runtime_types::ismp::consensus::StateMachineId, - latest_height: ::core::primitive::u64, + #[doc = "See [`Pallet::transfer`]."] + transfer { + params: runtime_types::pallet_ismp_demo::pallet::TransferParams< + ::subxt::utils::AccountId32, + ::core::primitive::u128, + >, }, #[codec(index = 1)] - Response { - dest_chain: runtime_types::ismp::host::StateMachine, - source_chain: runtime_types::ismp::host::StateMachine, - request_nonce: ::core::primitive::u64, - commitment: ::subxt::utils::H256, - }, + #[doc = "See [`Pallet::get_request`]."] + get_request { params: runtime_types::pallet_ismp_demo::pallet::GetRequest }, #[codec(index = 2)] - Request { - dest_chain: runtime_types::ismp::host::StateMachine, - source_chain: runtime_types::ismp::host::StateMachine, - request_nonce: ::core::primitive::u64, - commitment: ::subxt::utils::H256, - }, - } - } - pub mod mmr { - use super::runtime_types; - pub mod mmr { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum ProofKeys { - #[codec(index = 0)] - Requests(::std::vec::Vec<::subxt::utils::H256>), - #[codec(index = 1)] - Responses(::std::vec::Vec<::subxt::utils::H256>), - } + #[doc = "See [`Pallet::dispatch_to_evm`]."] + dispatch_to_evm { params: runtime_types::pallet_ismp_demo::pallet::EvmParams }, } - } - pub mod mmr_primitives { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -13382,15 +16341,15 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Leaf { + #[doc = "Pallet Errors"] + pub enum Error { #[codec(index = 0)] - Request(runtime_types::ismp::router::Request), + #[doc = "Error encountered when initializing transfer"] + TransferFailed, #[codec(index = 1)] - Response(runtime_types::ismp::router::Response), + #[doc = "Failed to dispatch get request"] + GetDispatchFailed, } - } - pub mod pallet { - use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -13401,26 +16360,37 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { + #[doc = "Pallet events"] + pub enum Event { #[codec(index = 0)] - #[doc = "See [`Pallet::handle`]."] - handle { messages: ::std::vec::Vec }, + #[doc = "Some balance has been transferred"] + BalanceTransferred { + from: ::subxt::utils::AccountId32, + to: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + dest_chain: runtime_types::ismp::host::StateMachine, + }, #[codec(index = 1)] - #[doc = "See [`Pallet::create_consensus_client`]."] - create_consensus_client { - message: runtime_types::ismp::messaging::CreateConsensusState, + #[doc = "Some balance has been received"] + BalanceReceived { + from: ::subxt::utils::AccountId32, + to: ::subxt::utils::AccountId32, + amount: ::core::primitive::u128, + source_chain: runtime_types::ismp::host::StateMachine, }, #[codec(index = 2)] - #[doc = "See [`Pallet::update_consensus_state`]."] - update_consensus_state { - message: runtime_types::pallet_ismp::pallet::UpdateConsensusState, + #[doc = "Request data receieved"] + Request { + source: runtime_types::ismp::host::StateMachine, + data: ::std::string::String, }, #[codec(index = 3)] - #[doc = "See [`Pallet::validate_messages`]."] - validate_messages { - messages: ::std::vec::Vec, - }, + #[doc = "Get response recieved"] + GetResponse( + ::std::vec::Vec< + ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>, + >, + ), } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13432,20 +16402,11 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Pallet errors"] - pub enum Error { - #[codec(index = 0)] - #[doc = "Invalid ISMP message"] - InvalidMessage, - #[codec(index = 1)] - #[doc = "Encountered an error while creating the consensus client."] - ConsensusClientCreationFailed, - #[codec(index = 2)] - #[doc = "Couldn't update unbonding period"] - UnbondingPeriodUpdateFailed, - #[codec(index = 3)] - #[doc = "Couldn't update challenge period"] - ChallengePeriodUpdateFailed, + pub struct EvmParams { + pub module: ::subxt::utils::H160, + pub destination: runtime_types::ismp::host::Ethereum, + pub timeout: ::core::primitive::u64, + pub count: ::core::primitive::u64, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13457,41 +16418,11 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - #[codec(index = 0)] - #[doc = "Emitted when a state machine is successfully updated to a new height"] - StateMachineUpdated { - state_machine_id: runtime_types::ismp::consensus::StateMachineId, - latest_height: ::core::primitive::u64, - }, - #[codec(index = 1)] - #[doc = "Indicates that a consensus client has been created"] - ConsensusClientCreated { consensus_client_id: [::core::primitive::u8; 4usize] }, - #[codec(index = 2)] - #[doc = "Indicates that a consensus client has been created"] - ConsensusClientFrozen { consensus_client_id: [::core::primitive::u8; 4usize] }, - #[codec(index = 3)] - #[doc = "An Outgoing Response has been deposited"] - Response { - dest_chain: runtime_types::ismp::host::StateMachine, - source_chain: runtime_types::ismp::host::StateMachine, - request_nonce: ::core::primitive::u64, - commitment: ::subxt::utils::H256, - }, - #[codec(index = 4)] - #[doc = "An Outgoing Request has been deposited"] - Request { - dest_chain: runtime_types::ismp::host::StateMachine, - source_chain: runtime_types::ismp::host::StateMachine, - request_nonce: ::core::primitive::u64, - commitment: ::subxt::utils::H256, - }, - #[codec(index = 5)] - #[doc = "Some errors handling some ismp messages"] - Errors { - errors: ::std::vec::Vec, - }, + pub struct GetRequest { + pub para_id: ::core::primitive::u32, + pub height: ::core::primitive::u32, + pub timeout: ::core::primitive::u64, + pub keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13503,13 +16434,17 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct UpdateConsensusState { - pub consensus_state_id: [::core::primitive::u8; 4usize], - pub unbonding_period: ::core::option::Option<::core::primitive::u64>, - pub challenge_period: ::core::option::Option<::core::primitive::u64>, + pub struct TransferParams<_0, _1> { + pub to: _0, + pub amount: _1, + pub para_id: ::core::primitive::u32, + pub timeout: ::core::primitive::u64, } } - pub mod primitives { + } + pub mod pallet_ismp_host_executive { + use super::runtime_types; + pub mod pallet { use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, @@ -13521,27 +16456,22 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Error { + #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] + pub enum Call { #[codec(index = 0)] - InvalidNumericOp, + #[doc = "See [`Pallet::set_host_params`]."] + set_host_params { + params: ::subxt::utils::KeyedVec< + runtime_types::ismp::host::StateMachine, + runtime_types::pallet_ismp_host_executive::params::HostParam, + >, + }, #[codec(index = 1)] - Push, - #[codec(index = 2)] - GetRoot, - #[codec(index = 3)] - Commit, - #[codec(index = 4)] - GenerateProof, - #[codec(index = 5)] - Verify, - #[codec(index = 6)] - LeafNotFound, - #[codec(index = 7)] - PalletNotIncluded, - #[codec(index = 8)] - InvalidLeafIndex, - #[codec(index = 9)] - InvalidBestKnownBlock, + #[doc = "See [`Pallet::update_host_params`]."] + update_host_params { + state_machine: runtime_types::ismp::host::StateMachine, + update: runtime_types::pallet_ismp_host_executive::params::HostParamUpdate, + }, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13553,10 +16483,18 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct LeafIndexAndPos { - pub leaf_index: ::core::primitive::u64, - pub pos: ::core::primitive::u64, + #[doc = "The `Error` enum of this pallet."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Could not commit the outgoing request"] + DispatchFailed, + #[codec(index = 1)] + #[doc = "The requested state machine was unrecognized"] + UnknownStateMachine, } + } + pub mod params { + use super::runtime_types; #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -13567,11 +16505,31 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Proof<_0> { - pub leaf_positions: - ::std::vec::Vec, - pub leaf_count: ::core::primitive::u64, - pub items: ::std::vec::Vec<_0>, + pub struct HostParam { + pub default_timeout: ::core::primitive::u128, + pub per_byte_fee: ::core::primitive::u128, + pub fee_token: ::subxt::utils::H160, + pub admin: ::subxt::utils::H160, + pub handler: ::subxt::utils::H160, + pub host_manager: ::subxt::utils::H160, + pub un_staking_period: ::core::primitive::u128, + pub challenge_period: ::core::primitive::u128, + pub consensus_client: ::subxt::utils::H160, + pub consensus_state: + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + pub consensus_update_timestamp: ::core::primitive::u128, + pub state_machine_whitelist: + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u32, + >, + pub fishermen: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::subxt::utils::H160, + >, + pub hyperbridge: runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, } #[derive( :: subxt :: ext :: codec :: Decode, @@ -13583,25 +16541,39 @@ pub mod api { # [codec (crate = :: subxt :: ext :: codec)] #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct WeightUsed { - pub weight_used: runtime_types::sp_weights::weight_v2::Weight, - pub weight_limit: runtime_types::sp_weights::weight_v2::Weight, + pub struct HostParamUpdate { + pub default_timeout: ::core::option::Option<::core::primitive::u128>, + pub per_byte_fee: ::core::option::Option<::core::primitive::u128>, + pub fee_token: ::core::option::Option<::subxt::utils::H160>, + pub admin: ::core::option::Option<::subxt::utils::H160>, + pub handler: ::core::option::Option<::subxt::utils::H160>, + pub host_manager: ::core::option::Option<::subxt::utils::H160>, + pub un_staking_period: ::core::option::Option<::core::primitive::u128>, + pub challenge_period: ::core::option::Option<::core::primitive::u128>, + pub consensus_client: ::core::option::Option<::subxt::utils::H160>, + pub consensus_state: ::core::option::Option< + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, + pub consensus_update_timestamp: ::core::option::Option<::core::primitive::u128>, + pub state_machine_whitelist: ::core::option::Option< + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u32, + >, + >, + pub fishermen: ::core::option::Option< + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::subxt::utils::H160, + >, + >, + pub hyperbridge: ::core::option::Option< + runtime_types::bounded_collections::bounded_vec::BoundedVec< + ::core::primitive::u8, + >, + >, } } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ResponseReceipt { - pub response: ::subxt::utils::H256, - pub relayer: ::std::vec::Vec<::core::primitive::u8>, - } } pub mod pallet_ismp_relayer { use super::runtime_types; @@ -14940,6 +17912,21 @@ pub mod api { #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] pub struct FixedU128(pub ::core::primitive::u128); } + pub mod per_things { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: CompactAs, + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub struct Percent(pub ::core::primitive::u8); + } #[derive( :: subxt :: ext :: codec :: Decode, :: subxt :: ext :: codec :: Encode, @@ -15121,6 +18108,41 @@ pub mod api { >, } } + pub mod sp_mmr_primitives { + use super::runtime_types; + #[derive( + :: subxt :: ext :: codec :: Decode, + :: subxt :: ext :: codec :: Encode, + :: subxt :: ext :: scale_decode :: DecodeAsType, + :: subxt :: ext :: scale_encode :: EncodeAsType, + Debug, + )] + # [codec (crate = :: subxt :: ext :: codec)] + #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] + #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] + pub enum Error { + #[codec(index = 0)] + InvalidNumericOp, + #[codec(index = 1)] + Push, + #[codec(index = 2)] + GetRoot, + #[codec(index = 3)] + Commit, + #[codec(index = 4)] + GenerateProof, + #[codec(index = 5)] + Verify, + #[codec(index = 6)] + LeafNotFound, + #[codec(index = 7)] + PalletNotIncluded, + #[codec(index = 8)] + InvalidLeafIndex, + #[codec(index = 9)] + InvalidBestKnownBlock, + } + } pub mod sp_runtime { use super::runtime_types; pub mod generic { @@ -16086,109 +19108,6 @@ pub mod api { } } } - pub mod state_machine_manager { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::add_whitelist_account`]."] - add_whitelist_account { account: ::subxt::utils::AccountId32 }, - #[codec(index = 1)] - #[doc = "See [`Pallet::remove_whitelist_account`]."] - remove_whitelist_account { account: ::subxt::utils::AccountId32 }, - #[codec(index = 2)] - #[doc = "See [`Pallet::freeze_state_machine`]."] - freeze_state_machine { - state_machine: runtime_types::ismp::consensus::StateMachineId, - }, - #[codec(index = 3)] - #[doc = "See [`Pallet::unfreeze_state_machine`]."] - unfreeze_state_machine { - state_machine: runtime_types::ismp::consensus::StateMachineId, - }, - #[codec(index = 4)] - #[doc = "See [`Pallet::set_host_manger_addresses`]."] - set_host_manger_addresses { - addresses: ::subxt::utils::KeyedVec< - runtime_types::ismp::host::StateMachine, - ::std::vec::Vec<::core::primitive::u8>, - >, - }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Error` enum of this pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Account Already Whitelisted"] - AccountAlreadyWhitelisted, - #[codec(index = 1)] - #[doc = "Account not whitelisted to freeze state machine"] - AccountNotWhitelisted, - #[codec(index = 2)] - #[doc = "State Machine Already Frozen"] - StateMachineAlreadyFrozen, - #[codec(index = 3)] - #[doc = "State Machine Not Frozen"] - StateMachineNotFrozen, - #[codec(index = 4)] - #[doc = "Error Freezing State Machine"] - ErrorFreezingStateMachine, - #[codec(index = 5)] - #[doc = "Error Unfreezing State Machine"] - ErrorUnFreezingStateMachine, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - #[codec(index = 0)] - #[doc = "An account `account` has been whitelisted"] - AccountWhitelisted { account: ::subxt::utils::AccountId32 }, - #[codec(index = 1)] - #[doc = "An account `account` has been removed from whitelisted accounts"] - AccountRemovedFromWhitelistedAccount { account: ::subxt::utils::AccountId32 }, - #[codec(index = 2)] - #[doc = "`state_machine` is frozen"] - StateMachineFrozen { - state_machine: runtime_types::ismp::consensus::StateMachineId, - }, - #[codec(index = 3)] - #[doc = " `state_machine` is unfrozen"] - StateMachineUnFrozen { - state_machine: runtime_types::ismp::consensus::StateMachineId, - }, - } - } - } pub mod xcm { use super::runtime_types; pub mod double_encoded { diff --git a/modules/subxt/subxt-utils/src/lib.rs b/modules/subxt/subxt-utils/src/lib.rs new file mode 100644 index 000000000..c0bb77f93 --- /dev/null +++ b/modules/subxt/subxt-utils/src/lib.rs @@ -0,0 +1,172 @@ +use codec::Encode; +use sp_core_hashing::keccak_256; +use subxt::{ + config::{polkadot::PolkadotExtrinsicParams, substrate::SubstrateHeader, Hasher}, + utils::{AccountId32, MultiAddress, MultiSignature, H256}, +}; + +pub mod gargantua; + +mod gargantua_conversion { + use ismp::{ + consensus::{StateCommitment, StateMachineHeight, StateMachineId}, + host::{Ethereum, StateMachine}, + }; + + impl From + for StateCommitment + { + fn from( + commitment: crate::gargantua::api::runtime_types::ismp::consensus::StateCommitment, + ) -> Self { + StateCommitment { + timestamp: commitment.timestamp, + overlay_root: commitment.overlay_root, + state_root: commitment.state_root, + } + } + } + + impl From + for StateMachineHeight + { + fn from( + state_machine_height: crate::gargantua::api::runtime_types::ismp::consensus::StateMachineHeight, + ) -> Self { + StateMachineHeight { + id: state_machine_height.id.into(), + height: state_machine_height.height, + } + } + } + + impl From + for StateMachineId + { + fn from( + state_machine_id: crate::gargantua::api::runtime_types::ismp::consensus::StateMachineId, + ) -> Self { + StateMachineId { + state_id: state_machine_id.state_id.into(), + consensus_state_id: state_machine_id.consensus_state_id, + } + } + } + + impl From for StateMachine { + fn from( + state_machine_id: crate::gargantua::api::runtime_types::ismp::host::StateMachine, + ) -> Self { + match state_machine_id { + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Ethereum( + ethereum, + ) => match ethereum { + crate::gargantua::api::runtime_types::ismp::host::Ethereum::ExecutionLayer => + StateMachine::Ethereum(Ethereum::ExecutionLayer), + crate::gargantua::api::runtime_types::ismp::host::Ethereum::Optimism => + StateMachine::Ethereum(Ethereum::Optimism), + crate::gargantua::api::runtime_types::ismp::host::Ethereum::Arbitrum => + StateMachine::Ethereum(Ethereum::Arbitrum), + crate::gargantua::api::runtime_types::ismp::host::Ethereum::Base => + StateMachine::Ethereum(Ethereum::Base), + }, + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Polkadot(id) => + StateMachine::Polkadot(id), + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Kusama(id) => + StateMachine::Kusama(id), + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Grandpa( + consensus_state_id, + ) => StateMachine::Grandpa(consensus_state_id), + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Beefy( + consensus_state_id, + ) => StateMachine::Beefy(consensus_state_id), + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Polygon => + StateMachine::Polygon, + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Bsc => + StateMachine::Bsc, + } + } + } + + impl From + for crate::gargantua::api::runtime_types::ismp::consensus::StateMachineHeight + { + fn from(state_machine_height: StateMachineHeight) -> Self { + crate::gargantua::api::runtime_types::ismp::consensus::StateMachineHeight { + id: state_machine_height.id.into(), + height: state_machine_height.height, + } + } + } + + impl From + for crate::gargantua::api::runtime_types::ismp::consensus::StateMachineId + { + fn from(state_machine_id: StateMachineId) -> Self { + Self { + state_id: state_machine_id.state_id.into(), + consensus_state_id: state_machine_id.consensus_state_id, + } + } + } + + impl From for crate::gargantua::api::runtime_types::ismp::host::StateMachine { + fn from(state_machine_id: StateMachine) -> Self { + match state_machine_id { + StateMachine::Ethereum(ethereum) => match ethereum { + Ethereum::ExecutionLayer => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Ethereum( + crate::gargantua::api::runtime_types::ismp::host::Ethereum::ExecutionLayer, + ), + Ethereum::Optimism => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Ethereum( + crate::gargantua::api::runtime_types::ismp::host::Ethereum::Optimism, + ), + Ethereum::Arbitrum => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Ethereum( + crate::gargantua::api::runtime_types::ismp::host::Ethereum::Arbitrum, + ), + Ethereum::Base => crate::gargantua::api::runtime_types::ismp::host::StateMachine::Ethereum( + crate::gargantua::api::runtime_types::ismp::host::Ethereum::Base, + ), + }, + StateMachine::Polkadot(id) => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Polkadot(id), + StateMachine::Kusama(id) => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Kusama(id), + StateMachine::Grandpa(consensus_state_id) => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Grandpa(consensus_state_id), + StateMachine::Beefy(consensus_state_id) => + crate::gargantua::api::runtime_types::ismp::host::StateMachine::Beefy(consensus_state_id), + + StateMachine::Polygon => crate::gargantua::api::runtime_types::ismp::host::StateMachine::Polygon, + StateMachine::Bsc => crate::gargantua::api::runtime_types::ismp::host::StateMachine::Bsc, + } + } + } +} + +/// Implements [`subxt::Config`] for substrate chains with keccak as their hashing algorithm +#[derive(Clone)] +pub struct Hyperbridge; + +/// A type that can hash values using the keccak_256 algorithm. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode)] +pub struct RuntimeHasher; + +impl Hasher for RuntimeHasher { + type Output = H256; + fn hash(s: &[u8]) -> Self::Output { + keccak_256(s).into() + } +} + +impl subxt::Config for Hyperbridge { + type Hash = H256; + type AccountId = AccountId32; + type Address = MultiAddress; + type Signature = MultiSignature; + type Hasher = RuntimeHasher; + type Header = SubstrateHeader; + type ExtrinsicParams = PolkadotExtrinsicParams; +} diff --git a/modules/trees/mmr/Cargo.toml b/modules/trees/mmr/Cargo.toml deleted file mode 100644 index 781a5c11f..000000000 --- a/modules/trees/mmr/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "mmr-utils" -version = "0.1.0" -edition = "2021" -description = "Utilities for merkle mountain range trees" -authors = ["Polytope Labs "] - -[dependencies] -merkle-mountain-range = { workspace = true } diff --git a/modules/trees/mmr/gadget/Cargo.toml b/modules/trees/mmr/gadget/Cargo.toml new file mode 100644 index 000000000..e96bb2639 --- /dev/null +++ b/modules/trees/mmr/gadget/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "mmr-gadget" +version = "29.0.0" +license = "GPL-3.0-or-later WITH Classpath-exception-2.0" +description = "MMR Client gadget for substrate" +homepage = "https://substrate.io" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +codec = { workspace = true, default-features = true } +futures = "0.3.30" +log = { workspace = true, default-features = true } +sp-api = { workspace = true, default-features = true } +sp-blockchain = { workspace = true, default-features = true} +sc-client-api = { workspace = true, default-features = true } +sp-core = { workspace = true, default-features = true } +sp-mmr-primitives = { workspace = true, default-features = true } +sc-offchain = { workspace = true, default-features = true } +sp-runtime = { workspace = true, default-features = true } +pallet-mmr-runtime-api = { workspace = true, default-features = true } +pallet-ismp = { workspace = true, default-features = true } + diff --git a/modules/trees/mmr/gadget/src/aux_schema.rs b/modules/trees/mmr/gadget/src/aux_schema.rs new file mode 100644 index 000000000..6f1b94edf --- /dev/null +++ b/modules/trees/mmr/gadget/src/aux_schema.rs @@ -0,0 +1,99 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Schema for MMR-gadget state persisted in the aux-db. + +use crate::LOG_TARGET; +use codec::{Decode, Encode}; +use log::{info, trace}; +use sc_client_api::backend::AuxStore; +use sp_blockchain::{Error as ClientError, Result as ClientResult}; +use sp_runtime::traits::{Block, NumberFor}; + +const VERSION_KEY: &[u8] = b"mmr_auxschema_version"; +const GADGET_STATE: &[u8] = b"mmr_gadget_state"; + +const CURRENT_VERSION: u32 = 1; +pub(crate) type PersistedState = NumberFor; + +pub(crate) fn write_current_version(backend: &B) -> ClientResult<()> { + info!(target: LOG_TARGET, "write aux schema version {:?}", CURRENT_VERSION); + AuxStore::insert_aux(backend, &[(VERSION_KEY, CURRENT_VERSION.encode().as_slice())], &[]) +} + +/// Write gadget state. +pub(crate) fn write_gadget_state( + backend: &BE, + state: &PersistedState, +) -> ClientResult<()> { + trace!(target: LOG_TARGET, "persisting {:?}", state); + backend.insert_aux(&[(GADGET_STATE, state.encode().as_slice())], &[]) +} + +fn load_decode(backend: &B, key: &[u8]) -> ClientResult> { + match backend.get_aux(key)? { + None => Ok(None), + Some(t) => T::decode(&mut &t[..]) + .map_err(|e| ClientError::Backend(format!("MMR aux DB is corrupted: {}", e))) + .map(Some), + } +} + +/// Load persistent data from backend. +pub(crate) fn load_state(backend: &BE) -> ClientResult>> +where + B: Block, + BE: AuxStore, +{ + let version: Option = load_decode(backend, VERSION_KEY)?; + + match version { + None => (), + Some(1) => return load_decode::<_, PersistedState>(backend, GADGET_STATE), + other => + return Err(ClientError::Backend(format!("Unsupported MMR aux DB version: {:?}", other))), + } + + // No persistent state found in DB. + Ok(None) +} + +/// Load or initialize persistent data from backend. +pub(crate) fn load_or_init_state( + backend: &BE, + default: NumberFor, +) -> sp_blockchain::Result> +where + B: Block, + BE: AuxStore, +{ + // Initialize gadget best_canon from AUX DB or from pallet genesis. + if let Some(best) = load_state::(backend)? { + info!(target: LOG_TARGET, "Loading MMR best canonicalized state from db: {:?}.", best); + Ok(best) + } else { + info!( + target: LOG_TARGET, + "Loading MMR from pallet genesis on what appears to be the first startup: {:?}.", + default + ); + write_current_version(backend)?; + write_gadget_state::(backend, &default)?; + Ok(default) + } +} diff --git a/modules/trees/mmr/gadget/src/lib.rs b/modules/trees/mmr/gadget/src/lib.rs new file mode 100644 index 000000000..a0f4528f2 --- /dev/null +++ b/modules/trees/mmr/gadget/src/lib.rs @@ -0,0 +1,202 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! # MMR offchain gadget +//! +//! The MMR offchain gadget is run alongside `pallet-mmr` to assist it with offchain +//! canonicalization of finalized MMR leaves and nodes. +//! The gadget should only be run on nodes that have Indexing API enabled (otherwise +//! `pallet-mmr` cannot write to offchain and this gadget has nothing to do). +//! +//! The runtime `pallet-mmr` creates one new MMR leaf per block and all inner MMR parent nodes +//! generated by the MMR when adding said leaf. MMR nodes are stored both in: +//! - on-chain storage - hashes only; not full leaf content; +//! - off-chain storage - via Indexing API, full leaf content (and all internal nodes as well) is +//! saved to the Off-chain DB using a key derived from `parent_hash` and node index in MMR. The +//! `parent_hash` is also used within the key to avoid conflicts and overwrites on forks (leaf +//! data is only allowed to reference data coming from parent block). +//! +//! This gadget is driven by block finality and in responsible for pruning stale forks from +//! offchain db, and moving finalized forks under a "canonical" key based solely on node `pos` +//! in the MMR. + +#![warn(missing_docs)] + +extern crate pallet_mmr_runtime_api; +extern crate sp_runtime; + +mod aux_schema; +mod offchain_mmr; + +use crate::offchain_mmr::OffchainMmr; +use futures::StreamExt; +use log::{error, trace, warn}; +use pallet_ismp::mmr::Leaf; +use pallet_mmr_runtime_api::MmrRuntimeApi; +use sc_client_api::{Backend, BlockchainEvents, FinalityNotification, FinalityNotifications}; +use sc_offchain::OffchainDb; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::{HeaderBackend, HeaderMetadata}; +use sp_mmr_primitives::LeafIndex; +use sp_runtime::traits::{Block, Header, NumberFor}; +use std::{marker::PhantomData, sync::Arc}; + +/// Logging target for the mmr gadget. +pub const LOG_TARGET: &str = "mmr"; + +/// Hashing Output +pub type HashFor = <::Header as Header>::Hash; + +/// A convenience MMR client trait that defines all the type bounds a MMR client +/// has to satisfy and defines some helper methods. +pub trait MmrClient: + BlockchainEvents + HeaderBackend + HeaderMetadata + ProvideRuntimeApi +where + B: Block, + BE: Backend, + Self::Api: MmrRuntimeApi, NumberFor, Leaf>, +{ + /// Get the block number where the mmr pallet was added to the runtime. + fn first_mmr_block_num(&self, notification: &FinalityNotification) -> Option> { + let best_block_hash = notification.header.hash(); + match self.runtime_api().pallet_genesis(best_block_hash) { + Ok(Ok(number)) => number, + _ => { + trace!( + target: LOG_TARGET, + "Failed to fetch pallet-mmr genesis", + ); + None + }, + } + } +} + +impl MmrClient for T +where + B: Block, + BE: Backend, + T: BlockchainEvents + HeaderBackend + HeaderMetadata + ProvideRuntimeApi, + T::Api: MmrRuntimeApi, NumberFor, Leaf>, +{ + // empty +} + +struct OffchainMmrBuilder, C> { + backend: Arc, + client: Arc, + offchain_db: OffchainDb, + indexing_prefix: Vec, + _phantom: PhantomData, +} + +impl OffchainMmrBuilder +where + B: Block, + BE: Backend, + C: MmrClient, + C::Api: MmrRuntimeApi, NumberFor, Leaf>, +{ + async fn try_build( + self, + finality_notifications: &mut FinalityNotifications, + ) -> Option> { + while let Some(notification) = finality_notifications.next().await { + if let Some(first_mmr_block_num) = self.client.first_mmr_block_num(¬ification) { + let mut offchain_mmr = OffchainMmr::new( + self.backend, + self.client, + self.offchain_db, + self.indexing_prefix, + first_mmr_block_num, + )?; + + // We need to make sure all blocks leading up to current notification + // have also been canonicalized. + offchain_mmr.canonicalize_catch_up(¬ification); + // We have to canonicalize and prune the blocks in the finality + // notification that lead to building the offchain-mmr as well. + offchain_mmr.canonicalize_and_prune(notification); + return Some(offchain_mmr) + } + } + + error!( + target: LOG_TARGET, + "Finality notifications stream closed unexpectedly. \ + Couldn't build the canonicalization engine", + ); + None + } +} + +/// A MMR Gadget. +pub struct MmrGadget, C> { + finality_notifications: FinalityNotifications, + + _phantom: PhantomData<(B, BE, C)>, +} + +impl MmrGadget +where + B: Block, + ::Number: Into, + BE: Backend, + C: MmrClient, + C::Api: MmrRuntimeApi, NumberFor, Leaf>, +{ + async fn run(mut self, builder: OffchainMmrBuilder) { + let mut offchain_mmr = match builder.try_build(&mut self.finality_notifications).await { + Some(offchain_mmr) => offchain_mmr, + None => return, + }; + + while let Some(notification) = self.finality_notifications.next().await { + offchain_mmr.canonicalize_and_prune(notification); + } + } + + /// Create and run the MMR gadget. + pub async fn start(client: Arc, backend: Arc, indexing_prefix: Vec) { + let offchain_db = match backend.offchain_storage() { + Some(offchain_storage) => OffchainDb::new(offchain_storage), + None => { + warn!( + target: LOG_TARGET, + "Can't spawn a MmrGadget for a node without offchain storage." + ); + return + }, + }; + + let mmr_gadget = MmrGadget:: { + finality_notifications: client.finality_notification_stream(), + + _phantom: Default::default(), + }; + mmr_gadget + .run(OffchainMmrBuilder { + backend, + client, + offchain_db, + indexing_prefix, + _phantom: Default::default(), + }) + .await + } +} diff --git a/modules/trees/mmr/gadget/src/offchain_mmr.rs b/modules/trees/mmr/gadget/src/offchain_mmr.rs new file mode 100644 index 000000000..452901839 --- /dev/null +++ b/modules/trees/mmr/gadget/src/offchain_mmr.rs @@ -0,0 +1,306 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Logic for canonicalizing MMR offchain entries for finalized forks, +//! and for pruning MMR offchain entries for stale forks. + +#![warn(missing_docs)] + +use crate::{aux_schema, HashFor, MmrClient, LOG_TARGET}; +use log::{debug, error, info, warn}; +use pallet_ismp::mmr::Leaf; +use pallet_mmr_runtime_api::MmrRuntimeApi; +use sc_client_api::{Backend, FinalityNotification}; +use sc_offchain::OffchainDb; +use sp_blockchain::{CachedHeaderMetadata, ForkBackend}; +use sp_core::offchain::{DbExternalities, StorageKind}; +use sp_mmr_primitives::{utils::NodesUtils, LeafIndex, NodeIndex}; +use sp_runtime::{ + traits::{Block, Header, NumberFor, One}, + Saturating, +}; +use std::{collections::VecDeque, sync::Arc}; + +/// `OffchainMMR` exposes MMR offchain canonicalization and pruning logic. +pub struct OffchainMmr, C> { + backend: Arc, + client: Arc, + offchain_db: OffchainDb, + indexing_prefix: Vec, + first_mmr_block: NumberFor, + best_canonicalized: NumberFor, +} + +impl OffchainMmr +where + BE: Backend, + B: Block, + C: MmrClient, + C::Api: MmrRuntimeApi, NumberFor, Leaf>, +{ + pub fn new( + backend: Arc, + client: Arc, + offchain_db: OffchainDb, + indexing_prefix: Vec, + first_mmr_block: NumberFor, + ) -> Option { + let mut best_canonicalized = first_mmr_block.saturating_sub(One::one()); + best_canonicalized = aux_schema::load_or_init_state::(&*backend, best_canonicalized) + .map_err(|e| error!(target: LOG_TARGET, "Error loading state from aux db: {:?}", e)) + .ok()?; + + Some(Self { + backend, + client, + offchain_db, + indexing_prefix, + first_mmr_block, + best_canonicalized, + }) + } + + fn node_temp_offchain_key(&self, pos: NodeIndex, parent_hash: B::Hash) -> Vec { + NodesUtils::node_temp_offchain_key::(&self.indexing_prefix, pos, parent_hash) + } + + fn node_canon_offchain_key(&self, pos: NodeIndex) -> Vec { + NodesUtils::node_canon_offchain_key(&self.indexing_prefix, pos) + } + + fn write_gadget_state_or_log(&self) { + if let Err(e) = + aux_schema::write_gadget_state::(&*self.backend, &self.best_canonicalized) + { + debug!(target: LOG_TARGET, "error saving state: {:?}", e); + } + } + + fn header_metadata_or_log( + &self, + hash: B::Hash, + action: &str, + ) -> Option> { + match self.client.header_metadata(hash) { + Ok(header) => Some(header), + _ => { + debug!( + target: LOG_TARGET, + "Block {} not found. Couldn't {} associated branch.", hash, action + ); + None + }, + } + } + + /// Fetch all the positions for all nodes added between these leaf counts including the leaf + /// positions + fn nodes_added_by_new_leaves( + &self, + block_num: NumberFor, + action: &str, + old_leaf_count: LeafIndex, + new_leaf_count: LeafIndex, + ) -> Vec { + let mut nodes = vec![]; + for leaf_index in old_leaf_count..new_leaf_count { + let branch = NodesUtils::right_branch_ending_in_leaf(leaf_index); + nodes.extend(&branch); + } + debug!(target: LOG_TARGET, "Nodes to {} for block {}: {:?}", action, block_num, nodes); + nodes + } + + fn prune_branch(&mut self, block_hash: &B::Hash) { + let action = "prune"; + let header = match self.header_metadata_or_log(*block_hash, action) { + Some(header) => header, + _ => return, + }; + + let parent_hash = header.parent; + let parent_leaf_count = match self.client.runtime_api().mmr_leaf_count(parent_hash) { + Ok(Ok(leaf_count)) => leaf_count, + _ => { + debug!(target: LOG_TARGET, "Failed to fetch mmr leaf count for {:?}", parent_hash); + return + }, + }; + + let current_leaf_count = match self.client.runtime_api().mmr_leaf_count(header.hash) { + Ok(Ok(leaf_count)) => leaf_count, + _ => { + debug!(target: LOG_TARGET, "Failed to fetch mmr leaf count for {:?}", header.hash); + return + }, + }; + + // We prune the leaf associated with the provided block and all the nodes added by that + // leaf. + let stale_nodes = self.nodes_added_by_new_leaves( + header.number, + action, + parent_leaf_count, + current_leaf_count, + ); + + for pos in stale_nodes { + let temp_key = self.node_temp_offchain_key(pos, header.parent); + self.offchain_db.local_storage_clear(StorageKind::PERSISTENT, &temp_key); + debug!(target: LOG_TARGET, "Pruned elem at pos {} with temp key {:?}", pos, temp_key); + } + } + + fn canonicalize_branch(&mut self, block_hash: B::Hash) { + let action = "canonicalize"; + let header = match self.header_metadata_or_log(block_hash, action) { + Some(header) => header, + _ => return, + }; + + // Don't canonicalize branches corresponding to blocks for which the MMR pallet + // wasn't yet initialized. + if header.number < self.first_mmr_block { + return + } + + let parent_hash = header.parent; + let parent_leaf_count = match self.client.runtime_api().mmr_leaf_count(parent_hash) { + Ok(Ok(leaf_count)) => leaf_count, + _ => { + debug!(target: LOG_TARGET, "Failed to fetch mmr leaf count for {:?}", parent_hash); + return + }, + }; + + let current_leaf_count = match self.client.runtime_api().mmr_leaf_count(header.hash) { + Ok(Ok(leaf_count)) => leaf_count, + _ => { + debug!(target: LOG_TARGET, "Failed to fetch mmr leaf count for {:?}", header.hash); + return + }, + }; + + // We "canonicalize" the leaves associated with the provided block + // and all the nodes added by those leaves. + let to_canon_nodes = self.nodes_added_by_new_leaves( + header.number, + action, + parent_leaf_count, + current_leaf_count, + ); + + for pos in to_canon_nodes { + let temp_key = self.node_temp_offchain_key(pos, header.parent); + if let Some(elem) = + self.offchain_db.local_storage_get(StorageKind::PERSISTENT, &temp_key) + { + let canon_key = self.node_canon_offchain_key(pos); + self.offchain_db.local_storage_set(StorageKind::PERSISTENT, &canon_key, &elem); + self.offchain_db.local_storage_clear(StorageKind::PERSISTENT, &temp_key); + debug!( + target: LOG_TARGET, + "Moved elem at pos {} from temp key {:?} to canon key {:?}", + pos, + temp_key, + canon_key + ); + } else { + debug!( + target: LOG_TARGET, + "Couldn't canonicalize elem at pos {} using temp key {:?}", pos, temp_key + ); + } + } + if self.best_canonicalized != header.number.saturating_sub(One::one()) { + warn!( + target: LOG_TARGET, + "Detected canonicalization skip: best {:?} current {:?}.", + self.best_canonicalized, + header.number, + ); + } + self.best_canonicalized = header.number; + } + + /// In case of missed finality notifications (node restarts for example), + /// make sure to also canon everything leading up to `notification.tree_route`. + pub fn canonicalize_catch_up(&mut self, notification: &FinalityNotification) { + let first = notification.tree_route.first().unwrap_or(¬ification.hash); + if let Some(mut header) = self.header_metadata_or_log(*first, "canonicalize") { + let mut to_canon = VecDeque::<::Hash>::new(); + // Walk up the chain adding all blocks newer than `self.best_canonicalized`. + loop { + header = match self.header_metadata_or_log(header.parent, "canonicalize") { + Some(header) => header, + _ => break, + }; + if header.number <= self.best_canonicalized { + break + } + to_canon.push_front(header.hash); + } + // Canonicalize all blocks leading up to current finality notification. + for hash in to_canon.drain(..) { + self.canonicalize_branch(hash); + } + self.write_gadget_state_or_log(); + } + } + + fn handle_potential_pallet_reset(&mut self, notification: &FinalityNotification) { + if let Some(first_mmr_block_num) = self.client.first_mmr_block_num(¬ification) { + if first_mmr_block_num != self.first_mmr_block { + info!( + target: LOG_TARGET, + "pallet-mmr reset detected at block {:?} with new genesis at block {:?}", + notification.header.number(), + first_mmr_block_num + ); + self.first_mmr_block = first_mmr_block_num; + self.best_canonicalized = first_mmr_block_num.saturating_sub(One::one()); + self.write_gadget_state_or_log(); + } + } + } + + /// Move leafs and nodes added by finalized blocks in offchain db from _fork-aware key_ to + /// _canonical key_. + /// Prune leafs and nodes added by stale blocks in offchain db from _fork-aware key_. + pub fn canonicalize_and_prune(&mut self, notification: FinalityNotification) { + // Update the first MMR block in case of a pallet reset. + self.handle_potential_pallet_reset(¬ification); + + // Move offchain MMR nodes for finalized blocks to canonical keys. + for hash in notification.tree_route.iter().chain(std::iter::once(¬ification.hash)) { + self.canonicalize_branch(*hash); + } + self.write_gadget_state_or_log(); + + // Remove offchain MMR nodes for stale forks. + let stale_forks = self.client.expand_forks(¬ification.stale_heads).unwrap_or_else( + |(stale_forks, e)| { + warn!(target: LOG_TARGET, "{:?}", e); + stale_forks + }, + ); + for hash in stale_forks.iter() { + self.prune_branch(hash); + } + } +} diff --git a/modules/trees/mmr/pallet/Cargo.toml b/modules/trees/mmr/pallet/Cargo.toml new file mode 100644 index 000000000..da268a913 --- /dev/null +++ b/modules/trees/mmr/pallet/Cargo.toml @@ -0,0 +1,62 @@ +[package] +name = "pallet-mmr" +version = "0.1.0" +edition = "2021" +authors = ["Polytope Labs "] +license = "Apache-2.0" +description = "A fork of the FRAME Merkle Mountain Range pallet which allows accumulating multiple leaves per block" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +serde = { version = "1.0.136", features = ["derive"], default-features = false } + +codec = { workspace = true } +log = { workspace = true } +scale-info = { workspace = true } +frame-benchmarking = { workspace = true, optional = true } +frame-support = { workspace = true } +frame-system = { workspace = true } +sp-core = { workspace = true } +sp-io = { workspace = true } +sp-mmr-primitives = { workspace = true } +mmr-primitives = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } +merkle-mountain-range = { workspace = true } + +[dev-dependencies] +array-bytes = "6.1" +env_logger = "0.11" +itertools = "0.10.3" + +[features] +default = ["std"] +std = [ + "codec/std", + "frame-benchmarking?/std", + "frame-support/std", + "frame-system/std", + "log/std", + "scale-info/std", + "sp-core/std", + "sp-io/std", + "sp-mmr-primitives/std", + "mmr-primitives/std", + "sp-runtime/std", + "sp-std/std", + "merkle-mountain-range/std", + "serde/default", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "sp-runtime/runtime-benchmarks", +] +try-runtime = [ + "frame-support/try-runtime", + "frame-system/try-runtime", + "sp-runtime/try-runtime", +] diff --git a/modules/trees/mmr/pallet/runtime-api/Cargo.toml b/modules/trees/mmr/pallet/runtime-api/Cargo.toml new file mode 100644 index 000000000..1cfb89f3a --- /dev/null +++ b/modules/trees/mmr/pallet/runtime-api/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "pallet-mmr-runtime-api" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +sp-api = { workspace = true } +sp-std = { workspace = true } +sp-core = { workspace = true } +serde = { version = "1.0.136", features = ["derive"], optional = true } +codec = { workspace = true } +sp-mmr-primitives = { workspace = true } + +[features] +default = ['std'] +std = ['sp-api/std', 'sp-std/std', 'codec/std', "serde", "sp-core/std", "sp-mmr-primitives/std"] + diff --git a/modules/trees/mmr/pallet/runtime-api/src/lib.rs b/modules/trees/mmr/pallet/runtime-api/src/lib.rs new file mode 100644 index 000000000..be6af5435 --- /dev/null +++ b/modules/trees/mmr/pallet/runtime-api/src/lib.rs @@ -0,0 +1,21 @@ +//! Pallet-mmr runtime Apis + +#![cfg_attr(not(feature = "std"), no_std)] +#![allow(clippy::too_many_arguments)] +#![deny(missing_docs)] + +use sp_mmr_primitives::{Error, LeafIndex}; + +sp_api::decl_runtime_apis! { + /// MmrRuntimeApi + pub trait MmrRuntimeApi { + /// Return Block number where pallet-mmr was added to the runtime + fn pallet_genesis() -> Result, Error>; + + /// Return the number of MMR leaves. + fn mmr_leaf_count() -> Result; + + /// Return the on-chain MMR root hash. + fn mmr_root() -> Result; + } +} diff --git a/modules/trees/mmr/pallet/src/lib.rs b/modules/trees/mmr/pallet/src/lib.rs new file mode 100644 index 000000000..837d75bec --- /dev/null +++ b/modules/trees/mmr/pallet/src/lib.rs @@ -0,0 +1,355 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! # Merkle Mountain Range +//! +//! ## Overview +//! +//! Details on Merkle Mountain Ranges (MMRs) can be found here: +//! +//! +//! The MMR pallet constructs an MMR from leaves provided by the [`MerkleMountainRangeTree::push`] +//! method. MMR nodes are stored both in: +//! - on-chain storage - hashes only; not full leaf content; +//! - off-chain storage - via Indexing API we push full leaf content (and all internal nodes as +//! well) to the Off-chain DB, so that the data is available for Off-chain workers. +//! Hashing used for MMR is configurable independently from the rest of the runtime (i.e. not using +//! `frame_system::Hashing`) so something compatible with external chains can be used (like +//! Keccak256 for Ethereum compatibility). +//! +//! Depending on the usage context (off-chain vs on-chain) the pallet is able to: +//! - verify MMR leaf proofs (on-chain) +//! - generate leaf proofs (off-chain) +//! +//! See [primitives::Compact] documentation for how you can optimize proof size for leafs that are +//! composed from multiple elements. +//! +//! ## What for? +//! +//! Primary use case for this pallet is to generate MMR root hashes, that can latter on be used by +//! BEEFY protocol (see ). +//! MMR root hashes along with BEEFY will make it possible to build Super Light Clients (SLC) of +//! Substrate-based chains. The SLC will be able to follow finality and can be shown proofs of more +//! details that happened on the source chain. +//! In that case the chain which contains the pallet generates the Root Hashes and Proofs, which +//! are then presented to another chain acting as a light client which can verify them. +//! +//! Secondary use case is to archive historical data, but still be able to retrieve them on-demand +//! if needed. For instance if parent block hashes are stored in the MMR it's possible at any point +//! in time to provide an MMR proof about some past block hash, while this data can be safely pruned +//! from on-chain storage. +//! +//! NOTE This pallet is experimental and not proven to work in production. +#![cfg_attr(not(feature = "std"), no_std)] + +use core::marker::PhantomData; +use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor}; +use log; +use merkle_mountain_range::MMRStore; +use sp_core::H256; + +use sp_runtime::traits::{self, One}; +use sp_std::prelude::*; + +use mmr_primitives::{DataOrHash, LeafMetadata, MerkleMountainRangeTree}; +pub use pallet::*; +use sp_mmr_primitives::mmr_lib::leaf_index_to_pos; +pub use sp_mmr_primitives::{ + self as primitives, utils::NodesUtils, Error, LeafDataProvider, LeafIndex, NodeIndex, +}; + +pub use mmr::storage::{OffchainStorage, Storage}; + +pub mod mmr; + +/// An MMR specific to the pallet. +type ModuleMmr = mmr::Mmr>; + +/// Leaf data. +type LeafOf = >::Leaf; + +/// Hashing used for the pallet. +pub(crate) type HashingOf = >::Hashing; +/// Hash type used for the pallet. +pub(crate) type HashOf = <>::Hashing as traits::Hash>::Output; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + + #[pallet::pallet] + #[pallet::without_storage_info] + pub struct Pallet(PhantomData<(T, I)>); + + /// This pallet's configuration trait + #[pallet::config] + pub trait Config: frame_system::Config { + /// Prefix for elements stored in the Off-chain DB via Indexing API. + /// + /// Each node of the MMR is inserted both on-chain and off-chain via Indexing API. + /// The former does not store full leaf content, just its compact version (hash), + /// and some of the inner mmr nodes might be pruned from on-chain storage. + /// The latter will contain all the entries in their full form. + /// + /// Each node is stored in the Off-chain DB under key derived from the + /// [`Self::INDEXING_PREFIX`] and its in-tree index (MMR position). + const INDEXING_PREFIX: &'static [u8]; + + /// A hasher type for MMR. + /// + /// To construct trie nodes that result in merging (bagging) two peaks, depending on the + /// node kind we take either: + /// - The node (hash) itself if it's an inner node. + /// - The hash of SCALE-encoding of the leaf data if it's a leaf node. + /// + /// Then we create a tuple of these two hashes, SCALE-encode it (concatenate) and + /// hash, to obtain a new MMR inner node - the new peak. + type Hashing: traits::Hash; + + /// Generic leaf type to be inserted into the MMR. + type Leaf: mmr_primitives::FullLeaf + scale_info::TypeInfo; + } + + /// Latest MMR Root hash. + #[pallet::storage] + #[pallet::getter(fn mmr_root_hash)] + pub type RootHash, I: 'static = ()> = StorageValue<_, HashOf, ValueQuery>; + + /// Current size of the MMR (number of leaves). + #[pallet::storage] + #[pallet::getter(fn mmr_leaves)] + pub type NumberOfLeaves, I: 'static = ()> = StorageValue<_, LeafIndex, ValueQuery>; + + /// Height at which the pallet started inserting leaves into offchain storage. + #[pallet::storage] + #[pallet::getter(fn initial_height)] + pub type InitialHeight, I: 'static = ()> = + StorageValue<_, BlockNumberFor, OptionQuery>; + + /// Temporary leaf storage for while the block is still executing. + #[pallet::storage] + #[pallet::getter(fn intermediate_leaves)] + pub type IntermediateLeaves, I: 'static = ()> = + CountedStorageMap<_, Identity, NodeIndex, T::Leaf, OptionQuery>; + + /// Hashes of the nodes in the MMR. + /// + /// Note this collection only contains MMR peaks, the inner nodes (and leaves) + /// are pruned and only stored in the Offchain DB. + #[pallet::storage] + #[pallet::getter(fn mmr_peak)] + pub type Nodes, I: 'static = ()> = + CountedStorageMap<_, Identity, NodeIndex, HashOf, OptionQuery>; + + // Set the initial height at which leaves were pushed to the offchain db for the offchain + // mmr gadget. Since this is in on_initialize, then the leaves were set in a previous block. + #[pallet::hooks] + impl, I: 'static> Hooks> for Pallet { + fn on_initialize(_n: BlockNumberFor) -> Weight { + if NumberOfLeaves::::get() > 0 && InitialHeight::::get().is_none() { + InitialHeight::::put(frame_system::Pallet::::block_number() - One::one()) + } + + Default::default() + } + } +} + +impl MerkleMountainRangeTree for Pallet +where + I: 'static, + T: Config, + HashOf: Into, +{ + type Leaf = T::Leaf; + + fn leaf_count() -> LeafIndex { + NumberOfLeaves::::get() + } + + fn generate_proof( + indices: Vec, + ) -> Result<(Vec, primitives::Proof), Error> { + let (leaves, proof) = Pallet::::generate_proof(indices)?; + let proof_nodes = proof.items.into_iter().map(Into::into).collect(); + let new_proof = primitives::Proof { + leaf_indices: proof.leaf_indices, + leaf_count: proof.leaf_count, + items: proof_nodes, + }; + + Ok((leaves, new_proof)) + } + + fn push(leaf: T::Leaf) -> LeafMetadata { + let temp_count = IntermediateLeaves::::count() as u64; + let index = NumberOfLeaves::::get() + temp_count; + IntermediateLeaves::::insert(temp_count, leaf); + let position = leaf_index_to_pos(index); + LeafMetadata { position, index } + } + + fn finalize() -> Result { + let buffer_len = IntermediateLeaves::::count() as u64; + // no new leaves? early return + if buffer_len == 0 { + return Ok(RootHash::::get().into()) + } + + let leaves = NumberOfLeaves::::get(); + let mut mmr: ModuleMmr = mmr::Mmr::new(leaves); + + // append new leaves to MMR + let range = 0u64..buffer_len; + for index in range { + let leaf = IntermediateLeaves::::get(index) + .expect("Infallible: Leaf was inserted in this block"); + // Mmr push should never fail + match mmr.push(leaf) { + None => { + log::error!(target: "pallet-mmr", "MMR push failed "); + // MMR push never fails, but better safe than sorry. + Err(Error::Push)? + }, + Some(position) => { + log::trace!(target: "pallet-mmr", "MMR push {position}"); + }, + } + } + + // Update the size, `mmr.finalize()` should also never fail. + let (leaves, root) = match mmr.finalize() { + Ok((leaves, root)) => (leaves, root), + Err(e) => { + log::error!(target: "pallet-mmr", "MMR finalize failed: {:?}", e); + Err(Error::Commit)? + }, + }; + + let _ = IntermediateLeaves::::clear(buffer_len as u32, None); + NumberOfLeaves::::put(leaves); + RootHash::::put(root); + + Ok(root.into()) + } + + fn get_leaf(pos: NodeIndex) -> Result, Error> { + let store = Storage::::default(); + store + .get_elem(pos) + .map(|val| { + val.and_then(|inner| match inner { + DataOrHash::Data(leaf) => Some(leaf), + _ => None, + }) + }) + .map_err(|_| Error::LeafNotFound) + } +} + +/// Stateless MMR proof verification for batch of leaves. +/// +/// This function can be used to verify received MMR [primitives::Proof] (`proof`) +/// for given leaves set (`leaves`) against a known MMR root hash (`root`). +/// Note, the leaves should be sorted such that corresponding leaves and leaf indices have the +/// same position in both the `leaves` vector and the `leaf_indices` vector contained in the +/// [primitives::Proof]. +pub fn verify_leaves_proof( + root: H::Output, + leaves: Vec>, + proof: primitives::Proof, +) -> Result<(), primitives::Error> +where + H: traits::Hash, + L: mmr_primitives::FullLeaf, +{ + let is_valid = mmr::verify_leaves_proof::(root, leaves, proof)?; + if is_valid { + Ok(()) + } else { + Err(primitives::Error::Verify.log_debug(("The proof is incorrect.", root))) + } +} + +impl, I: 'static> Pallet { + /// Build offchain key from `parent_hash` of block that originally added node `pos` to MMR. + /// + /// This combination makes the offchain (key,value) entry resilient to chain forks. + fn node_temp_offchain_key( + pos: NodeIndex, + parent_hash: ::Hash, + ) -> sp_std::prelude::Vec { + NodesUtils::node_temp_offchain_key::>(&T::INDEXING_PREFIX, pos, parent_hash) + } + + /// Build canonical offchain key for node `pos` in MMR. + /// + /// Used for nodes added by now finalized blocks. + /// Never read keys using `node_canon_offchain_key` unless you sure that + /// there's no `node_offchain_key` key in the storage. + fn node_canon_offchain_key(pos: NodeIndex) -> sp_std::prelude::Vec { + NodesUtils::node_canon_offchain_key(&T::INDEXING_PREFIX, pos) + } + + /// Return the on-chain MMR root hash. + pub fn mmr_root() -> HashOf { + RootHash::::get() + } + + /// Generate an MMR proof for the given `leaf_indices`. + /// Generates a proof for the MMR at the current block height. + /// + /// Note this method can only be used from an off-chain context + /// (Offchain Worker or Runtime API call), since it requires + /// all the leaves to be present. + /// It may return an error or panic if used incorrectly. + pub fn generate_proof( + indices: Vec, + ) -> Result<(Vec>, primitives::Proof>), primitives::Error> { + let leaves_count = NumberOfLeaves::::get(); + let mmr: ModuleMmr = mmr::Mmr::new(leaves_count); + mmr.generate_proof(indices) + } + + /// Verify MMR proof for given `leaves`. + /// + /// This method is safe to use within the runtime code. + /// It will return `Ok(())` if the proof is valid + /// and an `Err(..)` if MMR is inconsistent (some leaves are missing) + /// or the proof is invalid. + pub fn verify_leaves( + leaves: Vec>, + proof: primitives::Proof>, + ) -> Result<(), primitives::Error> { + if proof.leaf_count > NumberOfLeaves::::get() || + proof.leaf_count == 0 || + (proof.items.len().saturating_add(leaves.len())) as u64 > proof.leaf_count + { + return Err(primitives::Error::Verify + .log_debug("The proof has incorrect number of leaves or proof items.")) + } + + let mmr: ModuleMmr = mmr::Mmr::new(proof.leaf_count); + let is_valid = mmr.verify_leaves_proof(leaves, proof)?; + if is_valid { + Ok(()) + } else { + Err(primitives::Error::Verify.log_debug("The proof is incorrect.")) + } + } +} diff --git a/modules/trees/mmr/pallet/src/mmr/mmr.rs b/modules/trees/mmr/pallet/src/mmr/mmr.rs new file mode 100644 index 000000000..2e576af8e --- /dev/null +++ b/modules/trees/mmr/pallet/src/mmr/mmr.rs @@ -0,0 +1,199 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::{ + mmr::{ + storage::{OffchainStorage, RuntimeStorage, Storage}, + Hasher, Node, NodeOf, + }, + primitives::{self, Error, NodeIndex}, + Config, HashOf, HashingOf, +}; +use sp_mmr_primitives::utils::NodesUtils; +use sp_std::prelude::*; + +/// Stateless verification of the proof for a batch of leaves. +/// Note, the leaves should be sorted such that corresponding leaves and leaf indices have the +/// same position in both the `leaves` vector and the `leaf_indices` vector contained in the +/// [primitives::Proof] +pub fn verify_leaves_proof( + root: H::Output, + leaves: Vec>, + proof: primitives::Proof, +) -> Result +where + H: sp_runtime::traits::Hash, + L: mmr_primitives::FullLeaf, +{ + let size = NodesUtils::new(proof.leaf_count).size(); + + if leaves.len() != proof.leaf_indices.len() { + return Err(Error::Verify.log_debug("Proof leaf_indices not same length with leaves")) + } + + let leaves_and_position_data = proof + .leaf_indices + .into_iter() + .map(|index| merkle_mountain_range::leaf_index_to_pos(index)) + .zip(leaves.into_iter()) + .collect(); + + let p = merkle_mountain_range::MerkleProof::, Hasher>::new( + size, + proof.items.into_iter().map(Node::Hash).collect(), + ); + p.verify(Node::Hash(root), leaves_and_position_data) + .map_err(|e| Error::Verify.log_debug(e)) +} + +/// A wrapper around an MMR library to expose limited functionality. +/// +/// Available functions depend on the storage kind ([Runtime](crate::mmr::storage::RuntimeStorage) +/// vs [Off-chain](crate::mmr::storage::OffchainStorage)). +pub struct Mmr +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, + Storage: merkle_mountain_range::MMRStore>, +{ + mmr: merkle_mountain_range::MMR< + NodeOf, + Hasher, L>, + Storage, + >, + leaves: NodeIndex, +} + +impl Mmr +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, + Storage: merkle_mountain_range::MMRStore>, +{ + /// Create a pointer to an existing MMR with given number of leaves. + pub fn new(leaves: NodeIndex) -> Self { + let size = NodesUtils::new(leaves).size(); + Self { mmr: merkle_mountain_range::MMR::new(size, Default::default()), leaves } + } + + /// Verify proof for a set of leaves. + /// Note, the leaves should be sorted such that corresponding leaves and leaf indices have + /// the same position in both the `leaves` vector and the `leaf_indices` vector contained in the + /// [primitives::Proof] + pub fn verify_leaves_proof( + &self, + leaves: Vec, + proof: primitives::Proof>, + ) -> Result { + let p = + merkle_mountain_range::MerkleProof::, Hasher, L>>::new( + self.mmr.mmr_size(), + proof.items.into_iter().map(Node::Hash).collect(), + ); + + if leaves.len() != proof.leaf_indices.len() { + return Err(Error::Verify.log_debug("Proof leaf_indices not same length with leaves")) + } + + let leaves_positions_and_data = proof + .leaf_indices + .into_iter() + .map(|index| merkle_mountain_range::leaf_index_to_pos(index)) + .zip(leaves.into_iter().map(|leaf| Node::Data(leaf))) + .collect(); + let root = self.mmr.get_root().map_err(|e| Error::GetRoot.log_error(e))?; + p.verify(root, leaves_positions_and_data) + .map_err(|e| Error::Verify.log_debug(e)) + } + + /// Return the internal size of the MMR (number of nodes). + #[cfg(test)] + pub fn size(&self) -> NodeIndex { + self.mmr.mmr_size() + } +} + +/// Runtime specific MMR functions. +impl Mmr +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, +{ + /// Push another item to the MMR. + /// + /// Returns element position (index) in the MMR. + pub fn push(&mut self, leaf: L) -> Option { + let position = + self.mmr.push(Node::Data(leaf)).map_err(|e| Error::Push.log_error(e)).ok()?; + + self.leaves += 1; + + Some(position) + } + + /// Commit the changes to underlying storage, return current number of leaves and + /// calculate the new MMR's root hash. + pub fn finalize(self) -> Result<(NodeIndex, HashOf), Error> { + let root = self.mmr.get_root().map_err(|e| Error::GetRoot.log_error(e))?; + self.mmr.commit().map_err(|e| Error::Commit.log_error(e))?; + Ok((self.leaves, root.hash())) + } +} + +/// Off-chain specific MMR functions. +impl Mmr +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, +{ + /// Generate a proof for given leaf indices. + /// + /// Proof generation requires all the nodes (or their hashes) to be available in the storage. + /// (i.e. you can't run the function in the pruned storage). + pub fn generate_proof( + &self, + leaf_indices: Vec, + ) -> Result<(Vec, primitives::Proof>), Error> { + let positions = leaf_indices + .iter() + .map(|index| merkle_mountain_range::leaf_index_to_pos(*index)) + .collect::>(); + let store = >::default(); + let leaves = positions + .iter() + .map(|pos| match merkle_mountain_range::MMRStore::get_elem(&store, *pos) { + Ok(Some(Node::Data(leaf))) => Ok(leaf), + e => Err(Error::LeafNotFound.log_debug(e)), + }) + .collect::, Error>>()?; + + let leaf_count = self.leaves; + self.mmr + .gen_proof(positions) + .map_err(|e| Error::GenerateProof.log_error(e)) + .map(|p| primitives::Proof { + leaf_indices, + leaf_count, + items: p.proof_items().iter().map(|x| x.hash()).collect(), + }) + .map(|p| (leaves, p)) + } +} diff --git a/modules/trees/mmr/pallet/src/mmr/mod.rs b/modules/trees/mmr/pallet/src/mmr/mod.rs new file mode 100644 index 000000000..8529e24a7 --- /dev/null +++ b/modules/trees/mmr/pallet/src/mmr/mod.rs @@ -0,0 +1,44 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +mod mmr; +pub mod storage; + +use mmr_primitives::{DataOrHash, FullLeaf}; +use sp_runtime::traits; + +pub use self::mmr::{verify_leaves_proof, Mmr}; + +/// Node type for runtime `T`. +pub type NodeOf = Node<>::Hashing, L>; + +/// A node stored in the MMR. +pub type Node = DataOrHash; + +/// Default Merging & Hashing behavior for MMR. +pub struct Hasher(core::marker::PhantomData<(H, L)>); + +impl merkle_mountain_range::Merge for Hasher { + type Item = Node; + + fn merge(left: &Self::Item, right: &Self::Item) -> merkle_mountain_range::Result { + let mut concat = left.hash().as_ref().to_vec(); + concat.extend_from_slice(right.hash().as_ref()); + + Ok(Node::Hash(::hash(&concat))) + } +} diff --git a/modules/trees/mmr/pallet/src/mmr/storage.rs b/modules/trees/mmr/pallet/src/mmr/storage.rs new file mode 100644 index 000000000..c6040dbf5 --- /dev/null +++ b/modules/trees/mmr/pallet/src/mmr/storage.rs @@ -0,0 +1,217 @@ +// This file is part of Substrate. + +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! An MMR storage implementation. + +use codec::Encode; +use log::{debug, trace}; +use merkle_mountain_range::helper; +use sp_core::offchain::StorageKind; +use sp_io::offchain_index; +use sp_mmr_primitives::utils::NodesUtils; +use sp_std::iter::Peekable; +#[cfg(not(feature = "std"))] +use sp_std::prelude::*; + +use crate::{ + mmr::{Node, NodeOf}, + primitives::NodeIndex, + Config, Nodes, NumberOfLeaves, Pallet, +}; + +/// A marker type for runtime-specific storage implementation. +/// +/// Allows appending new items to the MMR and proof verification. +/// MMR nodes are appended to two different storages: +/// 1. We add nodes (leaves) hashes to the on-chain storage (see [crate::Nodes]). +/// 2. We add full leaves (and all inner nodes as well) into the `IndexingAPI` during block +/// processing, so the values end up in the Offchain DB if indexing is enabled. +pub struct RuntimeStorage; + +/// A marker type for offchain-specific storage implementation. +/// +/// Allows proof generation and verification, but does not support appending new items. +/// MMR nodes are assumed to be stored in the Off-Chain DB. Note this storage type +/// DOES NOT support adding new items to the MMR. +pub struct OffchainStorage; + +/// A storage layer for MMR. +/// +/// There are two different implementations depending on the use case. +/// See docs for [RuntimeStorage] and [OffchainStorage]. +pub struct Storage(sp_std::marker::PhantomData<(StorageType, T, I, L)>); + +impl Default for Storage { + fn default() -> Self { + Self(Default::default()) + } +} + +impl merkle_mountain_range::MMRStore> for Storage +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, +{ + fn get_elem(&self, pos: NodeIndex) -> merkle_mountain_range::Result>> { + // We should only get here when trying to generate proofs. The client requests + // for proofs for finalized blocks, which should usually be already canonicalized, + // unless the MMR client gadget has a delay. + let key = Pallet::::node_canon_offchain_key(pos); + debug!( + target: "pallet-mmr::offchain", "offchain db get {}: canon key {:?}", + pos, key + ); + // Try to retrieve the element from Off-chain DB. + if let Some(elem) = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, &key) { + return Ok(codec::Decode::decode(&mut &*elem).ok()) + } else { + // alas the store hasn't been canonicalized yet + Err(merkle_mountain_range::Error::InconsistentStore)? + } + } + + fn append( + &mut self, + _: NodeIndex, + _: Vec>, + ) -> merkle_mountain_range::Result<()> { + panic!("MMR must not be altered in the off-chain context.") + } +} + +impl merkle_mountain_range::MMRStore> for Storage +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, +{ + fn get_elem(&self, pos: NodeIndex) -> merkle_mountain_range::Result>> { + Ok(Nodes::::get(pos).map(Node::Hash)) + } + + fn append( + &mut self, + pos: NodeIndex, + elems: Vec>, + ) -> merkle_mountain_range::Result<()> { + if elems.is_empty() { + return Ok(()) + } + + trace!( + target: "pallet-mmr", "elems: {:?}", + elems.iter().map(|elem| elem.hash()).collect::>() + ); + + let leaves = NumberOfLeaves::::get(); + let size = NodesUtils::new(leaves).size(); + + if pos != size { + return Err(merkle_mountain_range::Error::InconsistentStore) + } + + let new_size = size + elems.len() as NodeIndex; + + // A sorted (ascending) iterator over peak indices to prune and persist. + let (peaks_to_prune, mut peaks_to_store) = peaks_to_prune_and_store(size, new_size); + + // Now we are going to iterate over elements to insert + // and keep track of the current `node_index` and `leaf_index`. + let mut leaf_index = leaves; + let mut node_index = size; + + // Use parent hash of block adding new nodes (this block) as extra identifier + // in offchain DB to avoid DB collisions and overwrites in case of forks. + let parent_hash = >::parent_hash(); + for elem in elems { + // On-chain we are going to only store new peaks. + if peaks_to_store.next_if_eq(&node_index).is_some() { + Nodes::::insert(node_index, elem.hash()); + } + // We are storing full node off-chain (using indexing API). + Self::store_to_offchain(node_index, parent_hash, &elem); + + // Increase the indices. + if let Node::Data(..) = elem { + leaf_index += 1; + } + node_index += 1; + } + + // Update current number of leaves. + NumberOfLeaves::::put(leaf_index); + + // And remove all remaining items from `peaks_before` collection. + for pos in peaks_to_prune { + Nodes::::remove(pos); + } + + Ok(()) + } +} + +impl Storage +where + T: Config, + I: 'static, + L: mmr_primitives::FullLeaf, +{ + fn store_to_offchain( + pos: NodeIndex, + parent_hash: ::Hash, + node: &NodeOf, + ) { + let encoded_node = node.encode(); + // We store this leaf offchain keyed by `(parent_hash, node_index)` to make it + // fork-resistant. The MMR client gadget task will "canonicalize" it on the first + // finality notification that follows, when we are not worried about forks anymore. + let temp_key = Pallet::::node_temp_offchain_key(pos, parent_hash); + debug!( + target: "pallet-mmr::offchain", "offchain db set: pos {} parent_hash {:?} key {:?}", + pos, parent_hash, temp_key + ); + // Indexing API is used to store the full node content. + offchain_index::set(&temp_key, &encoded_node); + } +} + +fn peaks_to_prune_and_store( + old_size: NodeIndex, + new_size: NodeIndex, +) -> (impl Iterator, Peekable>) { + // A sorted (ascending) collection of peak indices before and after insertion. + // both collections may share a common prefix. + let peaks_before = if old_size == 0 { vec![] } else { helper::get_peaks(old_size) }; + let peaks_after = helper::get_peaks(new_size); + trace!(target: "pallet-mmr", "peaks_before: {:?}", peaks_before); + trace!(target: "pallet-mmr", "peaks_after: {:?}", peaks_after); + let mut peaks_before = peaks_before.into_iter().peekable(); + let mut peaks_after = peaks_after.into_iter().peekable(); + + // Consume a common prefix between `peaks_before` and `peaks_after`, + // since that's something we will not be touching anyway. + while peaks_before.peek() == peaks_after.peek() { + peaks_before.next(); + peaks_after.next(); + } + + // what's left in both collections is: + // 1. Old peaks to remove from storage + // 2. New peaks to persist in storage + (peaks_before, peaks_after) +} diff --git a/modules/trees/mmr/primitives/Cargo.toml b/modules/trees/mmr/primitives/Cargo.toml new file mode 100644 index 000000000..6bb595a5d --- /dev/null +++ b/modules/trees/mmr/primitives/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "mmr-primitives" +version = "0.1.0" +edition = "2021" +description = "Utilities for merkle mountain range trees" +authors = ["Polytope Labs "] + +[dependencies] +merkle-mountain-range = { workspace = true } +codec = { workspace = true } +sp-core = { workspace = true } +sp-runtime = { workspace = true } +sp-std = { workspace = true } +sp-mmr-primitives = { workspace = true } +serde = { version = "1.0.136", features = ["derive"], default-features = false } +scale-info = { workspace = true } + +[features] +default = ["std"] +std = [ + "codec/std", + "sp-core/std", + "sp-runtime/std", + "sp-std/std", + "serde/default", + "scale-info/std", + "sp-mmr-primitives/std", + "merkle-mountain-range/std", +] diff --git a/modules/trees/mmr/primitives/src/lib.rs b/modules/trees/mmr/primitives/src/lib.rs new file mode 100644 index 000000000..ca6ddfa69 --- /dev/null +++ b/modules/trees/mmr/primitives/src/lib.rs @@ -0,0 +1,210 @@ +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; +use alloc::{vec, vec::Vec}; +use core::marker::PhantomData; +use merkle_mountain_range::helper::{get_peaks, parent_offset, pos_height_in_tree, sibling_offset}; +use sp_core::H256; +use sp_mmr_primitives as primitives; +use sp_mmr_primitives::NodeIndex; +use sp_runtime::{scale_info, traits, RuntimeDebug}; +use sp_std::fmt; + +/// Leaf index and position +#[derive( + codec::Encode, + codec::Decode, + scale_info::TypeInfo, + Ord, + PartialOrd, + Eq, + PartialEq, + Clone, + Copy, + RuntimeDebug, + Default, +)] +#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] +pub struct LeafMetadata { + /// Leaf index in the tree + pub index: u64, + /// Leaf node position in the tree + pub position: u64, +} + +/// Public interface for this pallet. Other runtime pallets will use this interface to insert leaves +/// into the tree. They can insert as many as they need and request the computed root hash at a +/// later time. This is so that the mmr root is only computed once per block. +/// +/// Internally, the pallet makes use of temporary storage item where it places leaves that have not +/// yet been finalized. +pub trait MerkleMountainRangeTree { + /// Associated leaf type. + type Leaf; + + /// Returns the total number of leaves that have been committed to the tree. + fn leaf_count() -> u64; + + /// Generate an MMR proof for the given `leaf_indices`. + /// Generates a proof for the MMR at the current block height. + fn generate_proof( + indices: Vec, + ) -> Result<(Vec, primitives::Proof), primitives::Error>; + + /// Push a new leaf into the MMR. Doesn't actually perform any expensive tree recomputation. + /// Simply adds the leaves to a buffer where they can be recalled when the tree actually + /// needs to be finalized. + fn push(leaf: Self::Leaf) -> LeafMetadata; + + /// Finalize the tree and compute it's new root hash. Ideally this should only be called once a + /// block. This will pull the leaves from the buffer and commit them to the underlying tree. + fn finalize() -> Result; + + /// Given the leaf position, it should return the leaf from the mmr store + fn get_leaf(pos: NodeIndex) -> Result, primitives::Error>; +} + +/// NoOp tree can be used as a drop in replacement for when the underlying mmr tree is unneeded. +pub struct NoOpTree(PhantomData); + +impl MerkleMountainRangeTree for NoOpTree { + type Leaf = T; + + fn leaf_count() -> u64 { + 0 + } + + fn generate_proof( + _indices: Vec, + ) -> Result<(Vec, primitives::Proof), primitives::Error> { + Err(primitives::Error::GenerateProof)? + } + + fn push(_leaf: T) -> LeafMetadata { + Default::default() + } + + fn finalize() -> Result { + Ok(H256::default()) + } + + fn get_leaf(_pos: NodeIndex) -> Result, primitives::Error> { + Ok(None) + } +} + +/// A full leaf content stored in the offchain-db. +pub trait FullLeaf: Clone + PartialEq + fmt::Debug + codec::FullCodec { + /// Compute the leaf preimage to be hashed. + fn preimage(&self) -> Vec; +} + +/// An element representing either full data or its hash. +/// +/// See [Compact] to see how it may be used in practice to reduce the size +/// of proofs in case multiple [LeafDataProvider]s are composed together. +/// This is also used internally by the MMR to differentiate leaf nodes (data) +/// and inner nodes (hashes). +/// +/// [DataOrHash::hash] method calculates the hash of this element in its compact form, +/// so should be used instead of hashing the encoded form (which will always be non-compact). +#[derive(RuntimeDebug, Clone, PartialEq)] +pub enum DataOrHash { + /// Arbitrary data in its full form. + Data(L), + /// A hash of some data. + Hash(H::Output), +} + +impl From for DataOrHash { + fn from(l: L) -> Self { + Self::Data(l) + } +} + +mod encoding { + use super::*; + + /// A helper type to implement [codec::Codec] for [DataOrHash]. + #[derive(codec::Encode, codec::Decode)] + enum Either { + Left(A), + Right(B), + } + + impl codec::Encode for DataOrHash { + fn encode_to(&self, dest: &mut T) { + match self { + Self::Data(l) => + l.using_encoded(|data| Either::<&[u8], &H::Output>::Left(data).encode_to(dest)), + Self::Hash(h) => Either::<&[u8], &H::Output>::Right(h).encode_to(dest), + } + } + } + + impl codec::Decode for DataOrHash { + fn decode(value: &mut I) -> Result { + let decoded: Either, H::Output> = Either::decode(value)?; + Ok(match decoded { + Either::Left(l) => DataOrHash::Data(L::decode(&mut &*l)?), + Either::Right(r) => DataOrHash::Hash(r), + }) + } + } +} + +impl DataOrHash { + /// Retrieve a hash of this item. + /// + /// Depending on the node type it's going to either be a contained value for [DataOrHash::Hash] + /// node, or a hash of SCALE-encoded [DataOrHash::Data] data. + pub fn hash(&self) -> H::Output { + match *self { + Self::Data(ref leaf) => ::hash(&leaf.preimage()), + Self::Hash(ref hash) => *hash, + } + } +} + +/// Converts a node's mmr position, to it's k-index. The k-index is the node's index within a layer +/// of the subtree. +pub fn mmr_position_to_k_index(mut leaves: Vec, mmr_size: u64) -> Vec<(u64, usize)> { + let peaks = get_peaks(mmr_size); + let mut leaves_with_k_indices = vec![]; + + for peak in peaks { + let leaves: Vec<_> = take_while_vec(&mut leaves, |pos| *pos <= peak); + + if leaves.len() > 0 { + for pos in leaves { + let height = pos_height_in_tree(peak); + let mut index = 0; + let mut parent_pos = peak; + for height in (1..=height).rev() { + let left_child = parent_pos - parent_offset(height - 1); + let right_child = left_child + sibling_offset(height - 1); + index *= 2; + if left_child >= pos { + parent_pos = left_child; + } else { + parent_pos = right_child; + index += 1; + } + } + + leaves_with_k_indices.push((pos, index)); + } + } + } + + leaves_with_k_indices +} + +fn take_while_vec bool>(v: &mut Vec, p: P) -> Vec { + for i in 0..v.len() { + if !p(&v[i]) { + return v.drain(..i).collect(); + } + } + v.drain(..).collect() +} diff --git a/modules/trees/mmr/simnode-tests/Cargo.toml b/modules/trees/mmr/simnode-tests/Cargo.toml new file mode 100644 index 000000000..8c75f180c --- /dev/null +++ b/modules/trees/mmr/simnode-tests/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "simnode-tests" +version = "0.1.0" +edition = "2021" +description = "Simnode tests for mmr gadget" +authors = ["Polytope Labs "] + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +subxt = { workspace = true, default-features = true } +anyhow = "1.0.70" +futures = "0.3.28" +tokio = { version = "1.27.0", features = ["macros"] } + +codec = { workspace = true, features = ["derive"], default-features = true } +sp-core = { workspace = true, features = ["full_crypto", "serde"], default-features = true } +sp-keyring = { workspace = true } +sp-runtime = { workspace = true, default-features = true } +ismp = { workspace = true, default-features = true } +subxt-utils = { workspace = true, default-features = true } +sc-consensus-manual-seal = { workspace = true } +pallet-ismp = { workspace = true, default-features = true } +sp-mmr-primitives = { workspace = true, default-features = true } +mmr-primitives = { workspace = true, default-features = true } +pallet-mmr = { workspace = true, default-features = true } +pallet-ismp-rpc = { workspace = true } +merkle-mountain-range = { workspace = true } diff --git a/modules/trees/mmr/simnode-tests/src/lib.rs b/modules/trees/mmr/simnode-tests/src/lib.rs new file mode 100644 index 000000000..593c8a923 --- /dev/null +++ b/modules/trees/mmr/simnode-tests/src/lib.rs @@ -0,0 +1,357 @@ +#![cfg(test)] + +use codec::Decode; +use merkle_mountain_range::MerkleProof; +use mmr_primitives::{DataOrHash, FullLeaf}; +use pallet_ismp::{mmr::Leaf, ProofKeys}; +use pallet_ismp_rpc::MmrProof; +use pallet_mmr::mmr::Hasher as MmrHasher; +use sc_consensus_manual_seal::CreatedBlock; +use sp_core::{crypto::Ss58Codec, keccak_256, offchain::StorageKind, Bytes, H256}; +use sp_keyring::sr25519::Keyring; +use sp_mmr_primitives::{ + mmr_lib::{leaf_index_to_pos, util::MemMMR}, + utils::NodesUtils, + INDEXING_PREFIX, +}; +use sp_runtime::traits::Keccak256; +use std::{env, time::Duration}; +use subxt::{rpc_params, tx::SubmittableExtrinsic, utils::H160, OnlineClient}; +use subxt_utils::{ + gargantua, + gargantua::api::runtime_types::{ismp::host::Ethereum, pallet_ismp_demo::pallet::EvmParams}, + Hyperbridge, +}; + +#[tokio::test] +#[ignore] +async fn test_all_features() -> Result<(), anyhow::Error> { + dispatch_requests().await?; + Ok(()) +} + +async fn dispatch_requests() -> Result<(), anyhow::Error> { + let port = env::var("PORT").unwrap_or("9990".into()); + let client = OnlineClient::::from_url(format!("ws://127.0.0.1:{}", port)).await?; + + // Initialize MMR Pallet by dispatching some leaves and finalizing + let params = EvmParams { + module: H160::random(), + destination: Ethereum::ExecutionLayer, + timeout: 0, + count: 10, + }; + let call = client + .tx() + .call_data(&gargantua::api::tx().ismp_demo().dispatch_to_evm(params))?; + let extrinsic: Bytes = client + .rpc() + .request( + "simnode_authorExtrinsic", + // author an extrinsic from alice + rpc_params![Bytes::from(call), Keyring::Alice.to_account_id().to_ss58check()], + ) + .await?; + let submittable = SubmittableExtrinsic::from_bytes(client.clone(), extrinsic.0); + submittable.submit().await?; + let created_block = client + .rpc() + .request::>("engine_createBlock", rpc_params![true, false]) + .await?; + + let mut last_finalized = created_block.hash; + let _ = client + .rpc() + .request::("engine_finalizeBlock", rpc_params![last_finalized]) + .await?; + + for _ in 0..3 { + let created_block = client + .rpc() + .request::>("engine_createBlock", rpc_params![true, false]) + .await?; + last_finalized = created_block.hash; + } + + // Finalize a new block so that we are sure mmr gadget gets the notification + let _ = client + .rpc() + .request::("engine_finalizeBlock", rpc_params![last_finalized]) + .await?; + + // Wait for some seconds for the async mmr gadget to complete + tokio::time::sleep(Duration::from_secs(10)).await; + + // Get finalized leaves + let mut leaves = vec![]; + for idx in 0..10 { + let pos = leaf_index_to_pos(idx as u64); + let canon_key = NodesUtils::node_canon_offchain_key(INDEXING_PREFIX, pos); + let value = client + .rpc() + .request::>( + "offchain_localStorageGet", + rpc_params![StorageKind::PERSISTENT, Bytes::from(canon_key)], + ) + .await?; + assert!(value.is_some()); + let data = value.unwrap().0; + let leaf = DataOrHash::::decode(&mut &*data).unwrap(); + leaves.push(leaf); + } + + // Dispatch some requests on two chain forks + + let mut chain_a = vec![]; + let mut chain_b = vec![]; + + let mut chain_a_commitments = vec![]; + let mut chain_b_commitments = vec![]; + + // Fork A + { + let mut parent_hash = last_finalized; + for _ in 0..3 { + let params = EvmParams { + module: H160::random(), + destination: Ethereum::ExecutionLayer, + timeout: 0, + count: 10, + }; + let call = client + .tx() + .call_data(&gargantua::api::tx().ismp_demo().dispatch_to_evm(params))?; + let extrinsic: Bytes = client + .rpc() + .request( + "simnode_authorExtrinsic", + // author an extrinsic from alice + rpc_params![Bytes::from(call), Keyring::Alice.to_account_id().to_ss58check()], + ) + .await?; + let submittable = SubmittableExtrinsic::from_bytes(client.clone(), extrinsic.0); + submittable.submit().await?; + let created_block = client + .rpc() + .request::>( + "engine_createBlock", + rpc_params![true, false, Some(parent_hash)], + ) + .await?; + let events = client.events().at(created_block.hash).await?; + + let events = events + .iter() + .filter_map(|ev| { + ev.ok().and_then(|ev| { + ev.as_event::() + .ok() + .flatten() + .and_then(|ev| Some((parent_hash, ev.commitment))) + }) + }) + .collect::>(); + + chain_a_commitments.extend(events); + parent_hash = created_block.hash; + chain_a.push(created_block.hash); + } + } + + println!("Finished creating Fork A"); + + println!("Creating Fork B"); + + // Fork B + { + let mut parent_hash = last_finalized; + let accounts = vec![ + Keyring::Bob.to_account_id().to_ss58check(), + Keyring::Eve.to_account_id().to_ss58check(), + Keyring::Dave.to_account_id().to_ss58check(), + ]; + for i in 0..accounts.len() { + let params = EvmParams { + module: H160::random(), + destination: Ethereum::Arbitrum, + timeout: 0, + count: 10, + }; + let call = client + .tx() + .call_data(&gargantua::api::tx().ismp_demo().dispatch_to_evm(params))?; + let extrinsic: Bytes = client + .rpc() + .request( + "simnode_authorExtrinsic", + rpc_params![Bytes::from(call), accounts[i].clone()], + ) + .await?; + let submittable = SubmittableExtrinsic::from_bytes(client.clone(), extrinsic.0); + submittable.submit().await?; + let created_block = client + .rpc() + .request::>( + "engine_createBlock", + rpc_params![true, false, parent_hash], + ) + .await?; + + let events = client.events().at(created_block.hash).await?; + + let events = events + .iter() + .filter_map(|ev| { + ev.ok().and_then(|ev| { + ev.as_event::() + .ok() + .flatten() + .and_then(|ev| Some((parent_hash, ev.commitment))) + }) + }) + .collect::>(); + + chain_b_commitments.extend(events); + chain_b.push(created_block.hash); + parent_hash = created_block.hash; + } + } + + assert_eq!(chain_a_commitments.len(), 30); + assert_eq!(chain_b_commitments.len(), 30); + + println!("Finished creating Fork B"); + + // Fetch mmr leaves on Fork B pre-finality + + let initial_leaf_count = leaves.len() as u64; + for (idx, (parent_hash, _)) in chain_b_commitments.clone().into_iter().enumerate() { + let pos = leaf_index_to_pos(initial_leaf_count + idx as u64); + let non_canon_key = NodesUtils::node_temp_offchain_key::< + sp_runtime::generic::Header, + >(INDEXING_PREFIX, pos, parent_hash); + let value = client + .rpc() + .request::>( + "offchain_localStorageGet", + rpc_params![StorageKind::PERSISTENT, Bytes::from(non_canon_key)], + ) + .await?; + assert!(value.is_some()); + let data = value.unwrap().0; + let leaf = DataOrHash::::decode(&mut &*data).unwrap(); + leaves.push(leaf); + } + + // Finalize fork b + let res = client + .rpc() + .request::("engine_finalizeBlock", rpc_params![chain_b.last().cloned().unwrap()]) + .await?; + assert!(res); + + let finalized_block = client + .rpc() + .request::>( + "engine_createBlock", + rpc_params![true, false, chain_b.last().cloned().unwrap()], + ) + .await?; + + // Finalize again so stale branches can be pruned + let _ = client + .rpc() + .request::("engine_finalizeBlock", rpc_params![finalized_block.hash]) + .await?; + + // Wait for some time for the async worker to complete + tokio::time::sleep(Duration::from_secs(20)).await; + + // All Non canonical keys should no longer exist in storage as they should have been pruned + for (idx, (parent_hash, _)) in chain_a_commitments.into_iter().enumerate() { + let pos = leaf_index_to_pos(initial_leaf_count + idx as u64); + let non_canon_key = NodesUtils::node_temp_offchain_key::< + sp_runtime::generic::Header, + >(INDEXING_PREFIX, pos, parent_hash); + let value = client + .rpc() + .request::>( + "offchain_localStorageGet", + rpc_params![StorageKind::PERSISTENT, Bytes::from(non_canon_key)], + ) + .await?; + assert!(value.is_none()); + } + + // Canonical keys should exist and the commitment should match the commitments we have for chain + // B + for (idx, (parent_hash, commitment)) in chain_b_commitments.clone().into_iter().enumerate() { + let pos = leaf_index_to_pos(initial_leaf_count + idx as u64); + let non_canon_key = NodesUtils::node_temp_offchain_key::< + sp_runtime::generic::Header, + >(INDEXING_PREFIX, pos, parent_hash); + let canon_key = NodesUtils::node_canon_offchain_key(INDEXING_PREFIX, pos); + let value = client + .rpc() + .request::>( + "offchain_localStorageGet", + rpc_params![StorageKind::PERSISTENT, Bytes::from(non_canon_key)], + ) + .await?; + assert!(value.is_none()); + + let value = client + .rpc() + .request::>( + "offchain_localStorageGet", + rpc_params![StorageKind::PERSISTENT, Bytes::from(canon_key)], + ) + .await?; + + let data = value.unwrap().0; + let leaf = match DataOrHash::::decode(&mut &*data).unwrap() { + DataOrHash::Data(leaf) => leaf, + _ => unreachable!(), + }; + let request = keccak_256(&leaf.preimage()); + assert_eq!(commitment.0, request); + } + + // Construct mmr tree from pre-finalized leaves + let mut mmr = MemMMR::, MmrHasher>::default(); + for leaf in leaves.clone() { + mmr.push(leaf).unwrap(); + } + + let at = client.rpc().header(Some(finalized_block.hash)).await?.unwrap().number; + + // Fetch mmr proof from finalized branch + let keys = ProofKeys::Requests( + chain_b_commitments.into_iter().map(|(.., commitment)| commitment).collect(), + ); + let params = rpc_params![at, keys]; + let response: pallet_ismp_rpc::Proof = + client.rpc().request("ismp_queryMmrProof", params).await?; + let proof: MmrProof = Decode::decode(&mut &*response.proof)?; + + let merkle_proof = MerkleProof::, MmrHasher>::new( + mmr.mmr_size(), + proof.items.into_iter().map(DataOrHash::Hash).collect(), + ); + + let root = mmr.get_root().unwrap(); + let res = merkle_proof + .verify( + root, + leaves[10..] + .to_vec() + .into_iter() + .enumerate() + .map(|(idx, leaf)| (leaf_index_to_pos((10 + idx) as u64), leaf)) + .collect(), + ) + .unwrap(); + + assert!(res); + Ok(()) +} diff --git a/modules/trees/mmr/src/lib.rs b/modules/trees/mmr/src/lib.rs deleted file mode 100644 index d8d82b009..000000000 --- a/modules/trees/mmr/src/lib.rs +++ /dev/null @@ -1,44 +0,0 @@ -use merkle_mountain_range::helper::{get_peaks, parent_offset, pos_height_in_tree, sibling_offset}; - -/// Converts a node's mmr position, to it's k-index. The k-index is the node's index within a layer -/// of the subtree. -pub fn mmr_position_to_k_index(mut leaves: Vec, mmr_size: u64) -> Vec<(u64, usize)> { - let peaks = get_peaks(mmr_size); - let mut leaves_with_k_indices = vec![]; - - for peak in peaks { - let leaves: Vec<_> = take_while_vec(&mut leaves, |pos| *pos <= peak); - - if leaves.len() > 0 { - for pos in leaves { - let height = pos_height_in_tree(peak); - let mut index = 0; - let mut parent_pos = peak; - for height in (1..=height).rev() { - let left_child = parent_pos - parent_offset(height - 1); - let right_child = left_child + sibling_offset(height - 1); - index *= 2; - if left_child >= pos { - parent_pos = left_child; - } else { - parent_pos = right_child; - index += 1; - } - } - - leaves_with_k_indices.push((pos, index)); - } - } - } - - leaves_with_k_indices -} - -fn take_while_vec bool>(v: &mut Vec, p: P) -> Vec { - for i in 0..v.len() { - if !p(&v[i]) { - return v.drain(..i).collect(); - } - } - v.drain(..).collect() -} diff --git a/parachain/node/Cargo.toml b/parachain/node/Cargo.toml index e1b278152..995c31b6a 100644 --- a/parachain/node/Cargo.toml +++ b/parachain/node/Cargo.toml @@ -23,6 +23,9 @@ messier-runtime = { path = "../runtimes/messier" } nexus-runtime = { path = "../runtimes/nexus" } pallet-ismp-rpc = { workspace = true } pallet-ismp-runtime-api = { workspace = true } +mmr-gadget = { workspace = true } +pallet-mmr-runtime-api = { workspace = true, default-features = true } +pallet-ismp = { workspace = true, default-features = true } # Substrate frame-benchmarking = { workspace = true } @@ -60,6 +63,7 @@ sp-transaction-pool = { workspace = true } substrate-frame-rpc-system = { workspace = true } substrate-prometheus-endpoint = { workspace = true } try-runtime-cli = { workspace = true, optional = true } +sp-mmr-primitives = { workspace = true, default-features = true } # Polkadot polkadot-cli = { workspace = true } @@ -80,6 +84,12 @@ cumulus-relay-chain-interface = { workspace = true } cumulus-client-consensus-proposer = { workspace = true } cumulus-client-collator = { workspace = true } +# Simnode +sc-simnode = { workspace = true, optional = true } +frame-system = { workspace = true, optional = true } +pallet-transaction-payment = { workspace = true, optional = true } +simnode-runtime-api = { workspace = true, optional = true } + [build-dependencies] substrate-build-script-utils = { version = "11.0.0" } @@ -91,6 +101,7 @@ runtime-benchmarks = [ "messier-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks", ] + try-runtime = [ "try-runtime-cli/try-runtime", "gargantua-runtime/try-runtime", @@ -100,3 +111,13 @@ async-backing = [ "gargantua-runtime/async-backing", "messier-runtime/async-backing" ] + +simnode = [ + "sc-simnode/parachain", + "frame-system", + "pallet-transaction-payment", + "simnode-runtime-api", + "gargantua-runtime/simnode", + "nexus-runtime/simnode", + "messier-runtime/simnode" +] diff --git a/parachain/node/src/cli.rs b/parachain/node/src/cli.rs index 238616ca0..ef35352e3 100644 --- a/parachain/node/src/cli.rs +++ b/parachain/node/src/cli.rs @@ -57,6 +57,10 @@ pub enum Subcommand { /// Errors since the binary was not build with `--features try-runtime`. #[cfg(not(feature = "try-runtime"))] TryRuntime, + + /// Runs the node with signature verification override and manual seal. + #[cfg(feature = "simnode")] + Simnode(sc_simnode::cli::SimnodeCli), } #[derive(Debug, clap::Parser)] diff --git a/parachain/node/src/command.rs b/parachain/node/src/command.rs index f37bc3fd4..530217f74 100644 --- a/parachain/node/src/command.rs +++ b/parachain/node/src/command.rs @@ -372,6 +372,53 @@ pub fn run() -> Result<()> { Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \ You can enable it with `--features try-runtime`." .into()), + #[cfg(feature = "simnode")] + Some(Subcommand::Simnode(cmd)) => { + use crate::{rpc, simnode::new_partial_with_executor}; + let mut runner = cli.create_runner(&cmd.run.normalize())?; + let config = runner.config_mut(); + config.offchain_worker.indexing_enabled = true; + + match config.chain_spec.id() { + chain if chain.contains("gargantua") || chain.contains("dev") => { + let executor = sc_simnode::new_wasm_executor(config); + let components = new_partial_with_executor::( + &config, executor, + )?; + runner.run_node_until_exit(move |config| async move { + let client = components.client.clone(); + let pool = components.transaction_pool.clone(); + let backend = components.backend.clone(); + let task_manager = sc_simnode::parachain::start_simnode::< + crate::simnode::GargantuaRuntimeInfo, + _, + _, + _, + _, + _, + >(sc_simnode::SimnodeParams { + components, + config, + instant: false, + rpc_builder: Box::new(move |deny_unsafe, _| { + let client = client.clone(); + let pool = pool.clone(); + let backend = backend.clone(); + let full_deps = + rpc::FullDeps { client, pool, deny_unsafe, backend }; + let io = + rpc::create_full(full_deps).expect("Rpc to be initialized"); + + Ok(io) + }), + }) + .await?; + Ok(task_manager) + }) + }, + chain => panic!("Unknown chain with id: {}", chain), + } + }, None => { let runner = cli.create_runner(&cli.run.normalize())?; let collator_options = cli.run.collator_options(); diff --git a/parachain/node/src/main.rs b/parachain/node/src/main.rs index 2b4c4813e..06a8a8573 100644 --- a/parachain/node/src/main.rs +++ b/parachain/node/src/main.rs @@ -26,6 +26,9 @@ mod command; mod rpc; mod runtime_api; +#[cfg(feature = "simnode")] +mod simnode; + fn main() -> sc_cli::Result<()> { command::run() } diff --git a/parachain/node/src/runtime_api.rs b/parachain/node/src/runtime_api.rs index a93f3f096..2f594238c 100644 --- a/parachain/node/src/runtime_api.rs +++ b/parachain/node/src/runtime_api.rs @@ -67,6 +67,54 @@ pub mod opaque { /// The address format for describing accounts. pub type Address = MultiAddress; } + +#[cfg(not(feature = "simnode"))] +pub trait BaseHostRuntimeApis: + TaggedTransactionQueue + + ApiExt + + BlockBuilder + + AccountNonceApi + + Metadata + + AuraApi + + OffchainWorkerApi + + SessionKeys + + CollectCollationInfo + + TransactionPaymentRuntimeApi + + pallet_ismp_runtime_api::IsmpRuntimeApi + + cumulus_primitives_aura::AuraUnincludedSegmentApi + + pallet_mmr_runtime_api::MmrRuntimeApi< + opaque::Block, + H256, + opaque::BlockNumber, + pallet_ismp::mmr::Leaf, + > +{ +} + +#[cfg(not(feature = "simnode"))] +impl BaseHostRuntimeApis for Api where + Api: TaggedTransactionQueue + + ApiExt + + BlockBuilder + + AccountNonceApi + + Metadata + + AuraApi + + OffchainWorkerApi + + SessionKeys + + CollectCollationInfo + + TransactionPaymentRuntimeApi + + pallet_ismp_runtime_api::IsmpRuntimeApi + + cumulus_primitives_aura::AuraUnincludedSegmentApi + + pallet_mmr_runtime_api::MmrRuntimeApi< + opaque::Block, + H256, + opaque::BlockNumber, + pallet_ismp::mmr::Leaf, + > +{ +} + +#[cfg(feature = "simnode")] pub trait BaseHostRuntimeApis: TaggedTransactionQueue + ApiExt @@ -80,9 +128,20 @@ pub trait BaseHostRuntimeApis: + TransactionPaymentRuntimeApi + pallet_ismp_runtime_api::IsmpRuntimeApi + cumulus_primitives_aura::AuraUnincludedSegmentApi + + pallet_mmr_runtime_api::MmrRuntimeApi< + opaque::Block, + H256, + opaque::BlockNumber, + pallet_ismp::mmr::Leaf, + > + simnode_runtime_api::CreateTransactionApi< + opaque::Block, + gargantua_runtime::RuntimeCall, + opaque::AccountId, + > { } +#[cfg(feature = "simnode")] impl BaseHostRuntimeApis for Api where Api: TaggedTransactionQueue + ApiExt @@ -96,5 +155,15 @@ impl BaseHostRuntimeApis for Api where + TransactionPaymentRuntimeApi + pallet_ismp_runtime_api::IsmpRuntimeApi + cumulus_primitives_aura::AuraUnincludedSegmentApi + + pallet_mmr_runtime_api::MmrRuntimeApi< + opaque::Block, + H256, + opaque::BlockNumber, + pallet_ismp::mmr::Leaf, + > + simnode_runtime_api::CreateTransactionApi< + opaque::Block, + gargantua_runtime::RuntimeCall, + opaque::AccountId, + > { } diff --git a/parachain/node/src/service.rs b/parachain/node/src/service.rs index 3e100bccb..d442be70c 100644 --- a/parachain/node/src/service.rs +++ b/parachain/node/src/service.rs @@ -167,6 +167,17 @@ where telemetry }); + // Spawn mmr canonicalizing task + task_manager.spawn_handle().spawn( + "mmr-canonicalizing-gadget", + "mmr-gadget", + mmr_gadget::MmrGadget::start( + client.clone(), + backend.clone(), + sp_mmr_primitives::INDEXING_PREFIX.to_vec(), + ), + ); + let transaction_pool = sc_transaction_pool::BasicPool::new_full( config.transaction_pool.clone(), config.role.is_authority().into(), @@ -402,7 +413,7 @@ where } /// Build the import queue for the parachain runtime. -fn build_import_queue( +pub(crate) fn build_import_queue( client: Arc>, block_import: ParachainBlockImport, config: &Configuration, diff --git a/parachain/node/src/simnode.rs b/parachain/node/src/simnode.rs new file mode 100644 index 000000000..46d9c17ef --- /dev/null +++ b/parachain/node/src/simnode.rs @@ -0,0 +1,151 @@ +use crate::runtime_api::{opaque, BaseHostRuntimeApis}; +use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; +use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager}; +use sc_simnode::{parachain::ParachainSelectChain, Executor}; +use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorkerHandle}; +use sp_api::ConstructRuntimeApi; +use sp_runtime::traits::Keccak256; +use std::sync::Arc; + +type FullClient = TFullClient; + +type FullBackend = TFullBackend; + +type ParachainBlockImport = + TParachainBlockImport>, FullBackend>; + +pub struct GargantuaRuntimeInfo; + +impl sc_simnode::ChainInfo for GargantuaRuntimeInfo { + // make sure you pass the opaque::Block here + + type Block = gargantua_runtime::opaque::Block; + // the runtime type + type Runtime = gargantua_runtime::Runtime; + // the runtime api + type RuntimeApi = gargantua_runtime::RuntimeApi; + // [`SignedExtra`] for your runtime + type SignedExtras = gargantua_runtime::SignedExtra; + + // initialize the [`SignedExtra`] for your runtime, you'll notice I'm calling a pallet method in + // order to read from storage. This is possible becase this method is called in an externalities + // provided environment. So feel free to reasd your runtime storage. + fn signed_extras( + from: ::AccountId, + ) -> Self::SignedExtras { + use sp_runtime::generic::Era; + let nonce = frame_system::Pallet::::account_nonce(from); + ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(Era::Immortal), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ) + } +} + +/// Build the import queue for the parachain runtime. +pub(crate) fn build_import_queue( + client: Arc>, + block_import: ParachainBlockImport, + config: &Configuration, + telemetry: Option, + task_manager: &TaskManager, +) -> Result, sc_service::Error> +where + Runtime: ConstructRuntimeApi> + Send + Sync + 'static, + Runtime::RuntimeApi: BaseHostRuntimeApis, + sc_client_api::StateBackendFor: + sc_client_api::StateBackend, +{ + let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; + + Ok(cumulus_client_consensus_aura::equivocation_import_queue::fully_verifying_import_queue::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + >( + client, + block_import, + move |_, _| async move { + let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); + Ok(timestamp) + }, + slot_duration, + &task_manager.spawn_essential_handle(), + config.prometheus_registry(), + telemetry, + )) +} + +/// Starts a `ServiceBuilder` for a full service. +/// +/// Use this macro if you don't actually need the full service, but just the builder in order to +/// be able to perform chain operations. +pub fn new_partial_with_executor( + config: &Configuration, + executor: Executor, +) -> Result< + PartialComponents< + FullClient, + FullBackend, + ParachainSelectChain>, + sc_consensus::DefaultImportQueue, + sc_transaction_pool::FullPool>, + (ParachainBlockImport, Option, Option), + >, + sc_service::Error, +> +where + Runtime: ConstructRuntimeApi> + Send + Sync + 'static, + Runtime::RuntimeApi: BaseHostRuntimeApis, + sc_client_api::StateBackendFor: + sc_client_api::StateBackend, +{ + let (client, backend, keystore_container, task_manager) = + sc_service::new_full_parts::(config, None, executor)?; + let client = Arc::new(client); + + // Spawn mmr canonicalizing task + task_manager.spawn_handle().spawn( + "mmr-canonicalizing-gadget", + "mmr-gadget", + mmr_gadget::MmrGadget::start( + client.clone(), + backend.clone(), + sp_mmr_primitives::INDEXING_PREFIX.to_vec(), + ), + ); + + let transaction_pool = sc_transaction_pool::BasicPool::new_full( + config.transaction_pool.clone(), + config.role.is_authority().into(), + config.prometheus_registry(), + task_manager.spawn_essential_handle(), + client.clone(), + ); + + let block_import = ParachainBlockImport::::new(client.clone(), backend.clone()); + + let import_queue = + build_import_queue(client.clone(), block_import.clone(), config, None, &task_manager)?; + + let select_chain = ParachainSelectChain::new(client.clone()); + + Ok(PartialComponents { + backend, + client, + import_queue, + keystore_container, + task_manager, + transaction_pool, + select_chain, + other: (block_import, None, None), + }) +} diff --git a/parachain/runtimes/gargantua/Cargo.toml b/parachain/runtimes/gargantua/Cargo.toml index af7b127a2..e4196eced 100644 --- a/parachain/runtimes/gargantua/Cargo.toml +++ b/parachain/runtimes/gargantua/Cargo.toml @@ -88,6 +88,11 @@ pallet-ismp-host-executive = { workspace = true } pallet-call-decompressor = { workspace = true } pallet-asset-gateway = { workspace = true } +pallet-mmr = { workspace = true } +pallet-mmr-runtime-api = { workspace = true } +sp-mmr-primitives = { workspace = true } +simnode-runtime-api = { workspace = true, optional = true } + [features] default = [ "std", @@ -151,8 +156,11 @@ std = [ "pallet-call-decompressor/std", "pallet-asset-gateway/std", "pallet-assets/std", + "pallet-mmr/std", "orml-xcm-support/std", - "orml-traits/std" + "orml-traits/std", + "pallet-mmr-runtime-api/std", + "sp-mmr-primitives/std" ] runtime-benchmarks = [ @@ -197,9 +205,14 @@ try-runtime = [ "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-xcm/try-runtime", + "pallet-mmr/try-runtime", "parachain-info/try-runtime", "pallet-assets/runtime-benchmarks" ] async-backing = [ "pallet-aura/experimental" ] + +simnode = [ + "simnode-runtime-api" +] diff --git a/parachain/runtimes/gargantua/src/ismp.rs b/parachain/runtimes/gargantua/src/ismp.rs index 41cb6798c..66293bf9d 100644 --- a/parachain/runtimes/gargantua/src/ismp.rs +++ b/parachain/runtimes/gargantua/src/ismp.rs @@ -15,7 +15,7 @@ use crate::{ alloc::{boxed::Box, string::ToString}, - AccountId, Assets, Balance, Balances, Gateway, Ismp, ParachainInfo, Runtime, RuntimeEvent, + AccountId, Assets, Balance, Balances, Gateway, Ismp, Mmr, ParachainInfo, Runtime, RuntimeEvent, Timestamp, EXISTENTIAL_DEPOSIT, }; use frame_support::{ @@ -67,16 +67,17 @@ impl Get> for Coprocessor { } impl pallet_ismp::Config for Runtime { type RuntimeEvent = RuntimeEvent; - const INDEXING_PREFIX: &'static [u8] = b"ISMP"; type AdminOrigin = EnsureRoot; type HostStateMachine = HostStateMachine; type Coprocessor = Coprocessor; type TimeProvider = Timestamp; type Router = Router; + type ConsensusClients = ( ismp_bsc::BscClient>, ismp_sync_committee::SyncCommitteeConsensusClient, Sepolia>, ); + type Mmr = Mmr; type WeightProvider = (); } @@ -156,7 +157,8 @@ impl pallet_assets::Config for Runtime { impl IsmpModule for ProxyModule { fn on_accept(&self, request: Post) -> Result<(), Error> { if request.dest != HostStateMachine::get() { - let meta = FeeMetadata { origin: [0u8; 32].into(), fee: Default::default() }; + let meta = + FeeMetadata { origin: [0u8; 32].into(), fee: Default::default(), claimed: false }; return Ismp::dispatch_request(Request::Post(request), meta); } @@ -176,7 +178,8 @@ impl IsmpModule for ProxyModule { fn on_response(&self, response: Response) -> Result<(), Error> { if response.dest_chain() != HostStateMachine::get() { - let meta = FeeMetadata { origin: [0u8; 32].into(), fee: Default::default() }; + let meta = + FeeMetadata { origin: [0u8; 32].into(), fee: Default::default(), claimed: false }; return Ismp::dispatch_response(response, meta); } diff --git a/parachain/runtimes/gargantua/src/lib.rs b/parachain/runtimes/gargantua/src/lib.rs index b35cca2bf..75cee567f 100644 --- a/parachain/runtimes/gargantua/src/lib.rs +++ b/parachain/runtimes/gargantua/src/lib.rs @@ -68,11 +68,10 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, Phase, }; -use pallet_ismp::{ - mmr::primitives::{Leaf, LeafIndex}, - primitives::Proof, -}; + +use pallet_ismp::primitives::Proof; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use sp_mmr_primitives::{LeafIndex, INDEXING_PREFIX}; pub use sp_runtime::{MultiAddress, Perbill, Permill}; use xcm::XcmOriginToTransactDispatchOrigin; @@ -88,7 +87,7 @@ use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use ::staging_xcm::latest::prelude::BodyId; use cumulus_primitives_core::ParaId; use frame_support::{derive_impl, traits::ConstBool}; -use pallet_ismp::ProofKeys; +use pallet_ismp::{mmr::Leaf, ProofKeys}; /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = MultiSignature; @@ -534,6 +533,13 @@ impl pallet_sudo::Config for Runtime { type RuntimeCall = RuntimeCall; type WeightInfo = (); } + +impl pallet_mmr::Config for Runtime { + const INDEXING_PREFIX: &'static [u8] = INDEXING_PREFIX; + type Hashing = Keccak256; + type Leaf = Leaf; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -560,20 +566,21 @@ construct_runtime!( XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event} = 30, PolkadotXcm: pallet_xcm = 31, CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, + // ISMP stuff // Xcm messages are executed in on_initialize of the message queue, pallet ismp must come before the queue so it can // setup the mmr - Ismp: pallet_ismp = 33, - MessageQueue: pallet_message_queue = 34, - - - IsmpSyncCommittee: ismp_sync_committee::pallet = 41, - IsmpDemo: pallet_ismp_demo = 42, - Relayer: pallet_ismp_relayer = 43, - HostExecutive: pallet_ismp_host_executive = 45, - CallDecompressor: pallet_call_decompressor = 46, - Gateway: pallet_asset_gateway = 47, - Assets: pallet_assets = 48, + Mmr: pallet_mmr = 40, + Ismp: pallet_ismp = 41, + MessageQueue: pallet_message_queue = 42, + + IsmpSyncCommittee: ismp_sync_committee::pallet = 51, + IsmpDemo: pallet_ismp_demo = 52, + Relayer: pallet_ismp_relayer = 53, + HostExecutive: pallet_ismp_host_executive = 55, + CallDecompressor: pallet_call_decompressor = 56, + Gateway: pallet_asset_gateway = 57, + Assets: pallet_assets = 58, } ); @@ -740,17 +747,24 @@ impl_runtime_apis! { TransactionPayment::length_to_fee(length) } } + impl pallet_mmr_runtime_api::MmrRuntimeApi::Hash, BlockNumber, Leaf> for Runtime { + /// Return Block number where pallet-mmr was added to the runtime + fn pallet_genesis() -> Result, sp_mmr_primitives::Error> { + Ok(Mmr::initial_height()) + } - impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { /// Return the number of MMR leaves. - fn mmr_leaf_count() -> Result { - Ok(Ismp::mmr_leaf_count()) + fn mmr_leaf_count() -> Result { + Ok(Mmr::mmr_leaves()) } /// Return the on-chain MMR root hash. - fn mmr_root() -> Result<::Hash, pallet_ismp::primitives::Error> { - Ok(Ismp::mmr_root()) + fn mmr_root() -> Result { + Ok(Mmr::mmr_root_hash()) } + } + + impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { fn challenge_period(consensus_state_id: [u8; 4]) -> Option { Ismp::get_challenge_period(consensus_state_id) @@ -759,7 +773,7 @@ impl_runtime_apis! { /// Generate a proof for the provided leaf indices fn generate_proof( keys: ProofKeys - ) -> Result<(Vec, Proof<::Hash>), pallet_ismp::primitives::Error> { + ) -> Result<(Vec, Proof<::Hash>), sp_mmr_primitives::Error> { Ismp::generate_proof(keys) } @@ -909,7 +923,7 @@ impl_runtime_apis! { } } - impl sp_genesis_builder::GenesisBuilder for Runtime { + impl sp_genesis_builder::GenesisBuilder for Runtime { fn create_default_config() -> Vec { create_default_config::() } @@ -918,6 +932,46 @@ impl_runtime_apis! { build_config::(config) } } + + #[cfg(feature = "simnode")] + impl simnode_runtime_api::CreateTransactionApi for Runtime + where + RuntimeCall: codec::Codec, + Block: sp_runtime::traits::Block, + AccountId: codec::Codec + codec::EncodeLike + + Into + Clone + PartialEq + + scale_info::TypeInfo + core::fmt::Debug, + { + fn create_transaction(account: AccountId, call: RuntimeCall) -> Vec { + use sp_runtime::{ + generic::Era, MultiSignature, + traits::StaticLookup, + }; + use codec::Encode; + use sp_core::sr25519; + let nonce = frame_system::Pallet::::account_nonce(account.clone()); + let extra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(Era::Immortal), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ); + let signature = MultiSignature::from(sr25519::Signature([0_u8;64])); + let address = sp_runtime::traits::AccountIdLookup::unlookup(account.into()); + let ext = generic::UncheckedExtrinsic::::new_signed( + call, + address, + signature, + extra, + ); + ext.encode() + } + } + } cumulus_pallet_parachain_system::register_validate_block! { diff --git a/parachain/runtimes/messier/Cargo.toml b/parachain/runtimes/messier/Cargo.toml index 6d21da045..26a260528 100644 --- a/parachain/runtimes/messier/Cargo.toml +++ b/parachain/runtimes/messier/Cargo.toml @@ -88,6 +88,12 @@ pallet-ismp-host-executive = { workspace = true } pallet-call-decompressor = { workspace = true } pallet-asset-gateway = { workspace = true } + +pallet-mmr = { workspace = true } +pallet-mmr-runtime-api = { workspace = true } +sp-mmr-primitives = { workspace = true } +simnode-runtime-api = { workspace = true, optional = true } + [features] default = [ "std", @@ -151,8 +157,11 @@ std = [ "pallet-call-decompressor/std", "pallet-asset-gateway/std", "pallet-assets/std", + "pallet-mmr/std", "orml-xcm-support/std", - "orml-traits/std" + "orml-traits/std", + "pallet-mmr-runtime-api/std", + "sp-mmr-primitives/std" ] runtime-benchmarks = [ @@ -201,4 +210,8 @@ try-runtime = [ ] async-backing = [ "pallet-aura/experimental" +] + +simnode = [ + "simnode-runtime-api" ] \ No newline at end of file diff --git a/parachain/runtimes/messier/src/ismp.rs b/parachain/runtimes/messier/src/ismp.rs index d4544c050..e11e0d2fd 100644 --- a/parachain/runtimes/messier/src/ismp.rs +++ b/parachain/runtimes/messier/src/ismp.rs @@ -15,7 +15,7 @@ use crate::{ alloc::{boxed::Box, string::ToString}, - AccountId, Assets, Balance, Balances, Gateway, Ismp, ParachainInfo, Runtime, RuntimeEvent, + AccountId, Assets, Balance, Balances, Gateway, Ismp, Mmr, ParachainInfo, Runtime, RuntimeEvent, Timestamp, EXISTENTIAL_DEPOSIT, }; use frame_support::{ @@ -68,7 +68,6 @@ impl Get> for Coprocessor { impl pallet_ismp::Config for Runtime { type RuntimeEvent = RuntimeEvent; - const INDEXING_PREFIX: &'static [u8] = b"ISMP"; type AdminOrigin = EnsureRoot; type HostStateMachine = HostStateMachine; type TimeProvider = Timestamp; @@ -78,6 +77,8 @@ impl pallet_ismp::Config for Runtime { ismp_bsc::BscClient>, ismp_sync_committee::SyncCommitteeConsensusClient, Mainnet>, ); + + type Mmr = Mmr; type WeightProvider = (); } @@ -150,7 +151,8 @@ impl pallet_assets::Config for Runtime { impl IsmpModule for ProxyModule { fn on_accept(&self, request: Post) -> Result<(), Error> { if request.dest != HostStateMachine::get() { - let meta = FeeMetadata { origin: [0u8; 32].into(), fee: Default::default() }; + let meta = + FeeMetadata { origin: [0u8; 32].into(), fee: Default::default(), claimed: false }; return Ismp::dispatch_request(Request::Post(request), meta); } @@ -168,7 +170,8 @@ impl IsmpModule for ProxyModule { fn on_response(&self, response: Response) -> Result<(), Error> { if response.dest_chain() != HostStateMachine::get() { - let meta = FeeMetadata { origin: [0u8; 32].into(), fee: Default::default() }; + let meta = + FeeMetadata { origin: [0u8; 32].into(), fee: Default::default(), claimed: false }; return Ismp::dispatch_response(response, meta); } diff --git a/parachain/runtimes/messier/src/lib.rs b/parachain/runtimes/messier/src/lib.rs index cc5796035..6a4511273 100644 --- a/parachain/runtimes/messier/src/lib.rs +++ b/parachain/runtimes/messier/src/lib.rs @@ -69,12 +69,9 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, }; -use pallet_ismp::{ - mmr::primitives::{Leaf, LeafIndex}, - primitives::Proof, - ProofKeys, -}; +use pallet_ismp::{primitives::Proof, ProofKeys}; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use sp_mmr_primitives::{LeafIndex, INDEXING_PREFIX}; pub use sp_runtime::{MultiAddress, Perbill, Permill}; use xcm::XcmOriginToTransactDispatchOrigin; @@ -308,6 +305,7 @@ parameter_types! { // Configure FRAME pallets to include in runtime. use frame_support::derive_impl; +use pallet_ismp::mmr::Leaf; #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] impl frame_system::Config for Runtime { @@ -550,6 +548,12 @@ impl pallet_sudo::Config for Runtime { type WeightInfo = (); } +impl pallet_mmr::Config for Runtime { + const INDEXING_PREFIX: &'static [u8] = INDEXING_PREFIX; + type Hashing = Keccak256; + type Leaf = Leaf; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -580,8 +584,9 @@ construct_runtime!( // ISMP stuff // Xcm messages are executed in on_initialize of the message queue, pallet ismp must come before the queue so it can // setup the mmr - Ismp: pallet_ismp = 33, - MessageQueue: pallet_message_queue = 34, + Mmr: pallet_mmr = 33, + Ismp: pallet_ismp = 34, + MessageQueue: pallet_message_queue = 35, IsmpSyncCommittee: ismp_sync_committee::pallet::{Pallet, Call} = 41, @@ -767,17 +772,24 @@ impl_runtime_apis! { } } - impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { + impl pallet_mmr_runtime_api::MmrRuntimeApi::Hash, BlockNumber, Leaf> for Runtime { + /// Return Block number where pallet-mmr was added to the runtime + fn pallet_genesis() -> Result, sp_mmr_primitives::Error> { + Ok(Mmr::initial_height()) + } + /// Return the number of MMR leaves. - fn mmr_leaf_count() -> Result { - Ok(Ismp::mmr_leaf_count()) + fn mmr_leaf_count() -> Result { + Ok(Mmr::mmr_leaves()) } /// Return the on-chain MMR root hash. - fn mmr_root() -> Result<::Hash, pallet_ismp::primitives::Error> { - Ok(Ismp::mmr_root()) + fn mmr_root() -> Result { + Ok(Mmr::mmr_root_hash()) } + } + impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { fn challenge_period(consensus_state_id: [u8; 4]) -> Option { Ismp::get_challenge_period(consensus_state_id) } @@ -785,7 +797,7 @@ impl_runtime_apis! { /// Generate a proof for the provided leaf indices fn generate_proof( keys: ProofKeys - ) -> Result<(Vec, Proof<::Hash>), pallet_ismp::primitives::Error> { + ) -> Result<(Vec, Proof<::Hash>), sp_mmr_primitives::Error> { Ismp::generate_proof(keys) } @@ -932,6 +944,45 @@ impl_runtime_apis! { Ok(batches) } } + + #[cfg(feature = "simnode")] + impl simnode_runtime_api::CreateTransactionApi for Runtime + where + RuntimeCall: codec::Codec, + Block: sp_runtime::traits::Block, + AccountId: codec::Codec + codec::EncodeLike + + Into + Clone + PartialEq + + scale_info::TypeInfo + core::fmt::Debug, + { + fn create_transaction(account: AccountId, call: RuntimeCall) -> Vec { + use sp_runtime::{ + generic::Era, MultiSignature, + traits::StaticLookup, + }; + use codec::Encode; + use sp_core::sr25519; + let nonce = frame_system::Pallet::::account_nonce(account.clone()); + let extra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(Era::Immortal), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ); + let signature = MultiSignature::from(sr25519::Signature([0_u8;64])); + let address = sp_runtime::traits::AccountIdLookup::unlookup(account.into()); + let ext = generic::UncheckedExtrinsic::::new_signed( + call, + address, + signature, + extra, + ); + ext.encode() + } + } } cumulus_pallet_parachain_system::register_validate_block! { diff --git a/parachain/runtimes/nexus/Cargo.toml b/parachain/runtimes/nexus/Cargo.toml index 376dabff8..72a82072a 100644 --- a/parachain/runtimes/nexus/Cargo.toml +++ b/parachain/runtimes/nexus/Cargo.toml @@ -89,6 +89,13 @@ pallet-ismp-host-executive = { workspace = true } pallet-call-decompressor = { workspace = true } pallet-asset-gateway = { workspace = true } + +pallet-mmr = { workspace = true } +pallet-mmr-runtime-api = { workspace = true } +sp-mmr-primitives = { workspace = true } + +simnode-runtime-api = { workspace = true, optional = true } + [features] default = [ "std", @@ -152,8 +159,11 @@ std = [ "pallet-call-decompressor/std", "pallet-asset-gateway/std", "pallet-assets/std", + "pallet-mmr/std", "orml-xcm-support/std", - "orml-traits/std" + "orml-traits/std", + "pallet-mmr-runtime-api/std", + "sp-mmr-primitives/std" ] runtime-benchmarks = [ @@ -202,4 +212,8 @@ try-runtime = [ ] async-backing = [ "pallet-aura/experimental" +] + +simnode = [ + "simnode-runtime-api" ] \ No newline at end of file diff --git a/parachain/runtimes/nexus/src/ismp.rs b/parachain/runtimes/nexus/src/ismp.rs index 32ede2ab1..10c12d94f 100644 --- a/parachain/runtimes/nexus/src/ismp.rs +++ b/parachain/runtimes/nexus/src/ismp.rs @@ -15,7 +15,7 @@ use crate::{ alloc::{boxed::Box, string::ToString}, - AccountId, Assets, Balance, Balances, Gateway, Ismp, ParachainInfo, Runtime, RuntimeEvent, + AccountId, Assets, Balance, Balances, Gateway, Ismp, Mmr, ParachainInfo, Runtime, RuntimeEvent, Timestamp, EXISTENTIAL_DEPOSIT, }; use frame_support::{ @@ -68,7 +68,6 @@ impl Get> for Coprocessor { impl pallet_ismp::Config for Runtime { type RuntimeEvent = RuntimeEvent; - const INDEXING_PREFIX: &'static [u8] = b"ISMP"; type AdminOrigin = EnsureRoot; type HostStateMachine = HostStateMachine; type TimeProvider = Timestamp; @@ -78,6 +77,8 @@ impl pallet_ismp::Config for Runtime { ismp_bsc::BscClient>, ismp_sync_committee::SyncCommitteeConsensusClient, Mainnet>, ); + + type Mmr = Mmr; type WeightProvider = (); } @@ -150,7 +151,8 @@ impl pallet_assets::Config for Runtime { impl IsmpModule for ProxyModule { fn on_accept(&self, request: Post) -> Result<(), Error> { if request.dest != HostStateMachine::get() { - let meta = FeeMetadata { origin: [0u8; 32].into(), fee: Default::default() }; + let meta = + FeeMetadata { origin: [0u8; 32].into(), fee: Default::default(), claimed: false }; return Ismp::dispatch_request(Request::Post(request), meta); } @@ -168,7 +170,8 @@ impl IsmpModule for ProxyModule { fn on_response(&self, response: Response) -> Result<(), Error> { if response.dest_chain() != HostStateMachine::get() { - let meta = FeeMetadata { origin: [0u8; 32].into(), fee: Default::default() }; + let meta = + FeeMetadata { origin: [0u8; 32].into(), fee: Default::default(), claimed: false }; return Ismp::dispatch_response(response, meta); } diff --git a/parachain/runtimes/nexus/src/lib.rs b/parachain/runtimes/nexus/src/lib.rs index 4e2acc425..272d3b99f 100644 --- a/parachain/runtimes/nexus/src/lib.rs +++ b/parachain/runtimes/nexus/src/lib.rs @@ -69,12 +69,9 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, Phase, }; -use pallet_ismp::{ - mmr::primitives::{Leaf, LeafIndex}, - primitives::Proof, - ProofKeys, -}; +use pallet_ismp::{primitives::Proof, ProofKeys}; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; +use sp_mmr_primitives::{LeafIndex, INDEXING_PREFIX}; pub use sp_runtime::{MultiAddress, Perbill, Permill}; use xcm::XcmOriginToTransactDispatchOrigin; @@ -308,6 +305,7 @@ parameter_types! { // Configure FRAME pallets to include in runtime. use frame_support::derive_impl; +use pallet_ismp::mmr::Leaf; #[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)] impl frame_system::Config for Runtime { @@ -511,7 +509,7 @@ impl pallet_aura::Config for Runtime { type AuthorityId = AuraId; type DisabledValidators = (); type MaxAuthorities = ConstU32<100_000>; - type AllowMultipleBlocksPerSlot = ConstBool; + type AllowMultipleBlocksPerSlot = ConstBool; #[cfg(feature = "async-backing")] type SlotDuration = ConstU64; } @@ -550,6 +548,12 @@ impl pallet_sudo::Config for Runtime { type WeightInfo = (); } +impl pallet_mmr::Config for Runtime { + const INDEXING_PREFIX: &'static [u8] = INDEXING_PREFIX; + type Hashing = Keccak256; + type Leaf = Leaf; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -579,8 +583,9 @@ construct_runtime!( // ISMP stuff // Xcm messages are executed in on_initialize of the message queue, pallet ismp must come before the queue so it can // setup the mmr - Ismp: pallet_ismp = 33, - MessageQueue: pallet_message_queue = 34, + Mmr: pallet_mmr = 33, + Ismp: pallet_ismp = 34, + MessageQueue: pallet_message_queue = 35, IsmpSyncCommittee: ismp_sync_committee::pallet::{Pallet, Call} = 41, Relayer: pallet_ismp_relayer = 42, @@ -765,17 +770,24 @@ impl_runtime_apis! { } } - impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { + impl pallet_mmr_runtime_api::MmrRuntimeApi::Hash, BlockNumber, Leaf> for Runtime { + /// Return Block number where pallet-mmr was added to the runtime + fn pallet_genesis() -> Result, sp_mmr_primitives::Error> { + Ok(Mmr::initial_height()) + } + /// Return the number of MMR leaves. - fn mmr_leaf_count() -> Result { - Ok(Ismp::mmr_leaf_count()) + fn mmr_leaf_count() -> Result { + Ok(Mmr::mmr_leaves()) } /// Return the on-chain MMR root hash. - fn mmr_root() -> Result<::Hash, pallet_ismp::primitives::Error> { - Ok(Ismp::mmr_root()) + fn mmr_root() -> Result { + Ok(Mmr::mmr_root_hash()) } + } + impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { fn challenge_period(consensus_state_id: [u8; 4]) -> Option { Ismp::get_challenge_period(consensus_state_id) } @@ -783,7 +795,7 @@ impl_runtime_apis! { /// Generate a proof for the provided leaf indices fn generate_proof( keys: ProofKeys - ) -> Result<(Vec, Proof<::Hash>), pallet_ismp::primitives::Error> { + ) -> Result<(Vec, Proof<::Hash>), sp_mmr_primitives::Error> { Ismp::generate_proof(keys) } @@ -930,6 +942,45 @@ impl_runtime_apis! { Ok(batches) } } + + #[cfg(feature = "simnode")] + impl simnode_runtime_api::CreateTransactionApi for Runtime + where + RuntimeCall: codec::Codec, + Block: sp_runtime::traits::Block, + AccountId: codec::Codec + codec::EncodeLike + + Into + Clone + PartialEq + + scale_info::TypeInfo + core::fmt::Debug, + { + fn create_transaction(account: AccountId, call: RuntimeCall) -> Vec { + use sp_runtime::{ + generic::Era, MultiSignature, + traits::StaticLookup, + }; + use codec::Encode; + use sp_core::sr25519; + let nonce = frame_system::Pallet::::account_nonce(account.clone()); + let extra = ( + frame_system::CheckNonZeroSender::::new(), + frame_system::CheckSpecVersion::::new(), + frame_system::CheckTxVersion::::new(), + frame_system::CheckGenesis::::new(), + frame_system::CheckEra::::from(Era::Immortal), + frame_system::CheckNonce::::from(nonce), + frame_system::CheckWeight::::new(), + pallet_transaction_payment::ChargeTransactionPayment::::from(0), + ); + let signature = MultiSignature::from(sr25519::Signature([0_u8;64])); + let address = sp_runtime::traits::AccountIdLookup::unlookup(account.into()); + let ext = generic::UncheckedExtrinsic::::new_signed( + call, + address, + signature, + extra, + ); + ext.encode() + } + } } cumulus_pallet_parachain_system::register_validate_block! {