From a031bef0d5eca8c469e85a439ca5a0127de0a849 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 17 Apr 2023 13:44:12 +0200 Subject: [PATCH 01/79] patch cumulus to xcmp queue version with defer filter --- Cargo.lock | 176 +++++++++++++++++++++++++---- Cargo.toml | 54 ++++++++- integration-tests/Cargo.toml | 24 ++-- node/Cargo.toml | 24 ++-- runtime/common/Cargo.toml | 4 +- runtime/hydradx/Cargo.toml | 22 ++-- runtime/hydradx/src/xcm.rs | 4 + runtime/testing-hydradx/Cargo.toml | 22 ++-- runtime/testing-hydradx/src/xcm.rs | 4 + 9 files changed, 260 insertions(+), 74 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d31f89304..b0625d975 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "clap 4.2.1", "parity-scale-codec", @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1592,7 +1592,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1615,7 +1615,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-support", "frame-system", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1745,7 +1745,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1812,6 +1812,7 @@ dependencies = [ "polkadot-runtime-common", "rand_chacha 0.3.1", "scale-info", + "sp-core", "sp-io", "sp-runtime", "sp-std", @@ -1822,7 +1823,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1838,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1861,7 +1862,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "futures", @@ -1874,7 +1875,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1892,7 +1893,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1917,7 +1918,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1936,7 +1937,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -1976,7 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2005,7 +2006,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6349,7 +6350,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-benchmarking", "frame-support", @@ -7352,7 +7353,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/paritytech/cumulus?branch=polkadot-v0.9.38#9b4e0247137f158d1a35118197d34adfa58858b7" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14739,3 +14740,128 @@ dependencies = [ "libc", "pkg-config", ] + +[[patch.unused]] +name = "asset-test-utils" +version = "1.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "bridge-hub-kusama-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "bridge-hub-polkadot-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "bridge-hub-rococo-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "collectives-polkadot-runtime" +version = "1.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "contracts-rococo-runtime" +version = "0.2.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-pallet-session-benchmarking" +version = "3.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-pallet-solo-to-para" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-ping" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-test-client" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-test-relay-validation-worker-provider" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-test-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "cumulus-test-service" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "pallet-template" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "parachain-template-node" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "parachain-template-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "parachains-common" +version = "1.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "penpal-runtime" +version = "0.9.27" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "polkadot-parachain-bin" +version = "0.9.380" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "rococo-parachain-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "seedling-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "shell-runtime" +version = "0.1.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "statemine-runtime" +version = "2.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "statemint-runtime" +version = "1.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" + +[[patch.unused]] +name = "westmint-runtime" +version = "1.0.0" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" diff --git a/Cargo.toml b/Cargo.toml index be42d7f66..7327cb038 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,4 +39,56 @@ rococo-runtime = { git = "https://github.com/paritytech//polkadot", branch = "re westend-runtime = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.38" } xcm = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.38" } xcm-builder = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.38" } -xcm-executor = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.38" } \ No newline at end of file +xcm-executor = { git = "https://github.com/paritytech//polkadot", branch = "release-v0.9.38" } + +[patch."https://github.com/paritytech/cumulus"] +cumulus-client-cli = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-consensus-aura = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-consensus-common = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-pov-recovery = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-primitives-core = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-interface = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-test-service = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-consensus-relay-chain = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-network = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-service = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-collator = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-test-client = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-test-relay-sproof-builder = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-test-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-parachain-system = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-primitives-timestamp = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-minimal-node = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-test-relay-validation-worker-provider = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +parachains-common = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-primitives-utility = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +pallet-collator-selection = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-aura-ext = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-dmp-queue = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-session-benchmarking = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-solo-to-para = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-xcm = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +parachain-template-node = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +parachain-template-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +pallet-template = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +parachain-info = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +polkadot-parachain-bin = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +bridge-hub-kusama-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +bridge-hub-polkadot-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +bridge-hub-rococo-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +collectives-polkadot-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +contracts-rococo-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +penpal-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +rococo-parachain-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-ping = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +seedling-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +shell-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +statemine-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +asset-test-utils = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +statemint-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } +westmint-runtime = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38" } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 4dd1709e3..8bfeb47e2 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -36,7 +36,7 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # collator support -pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +pallet-collator-selection = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # ORML dependencies @@ -51,17 +51,17 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # Cumulus dependencies -cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-test-relay-sproof-builder = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +cumulus-pallet-aura-ext = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-parachain-system = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcm = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-dmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-core = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-utility = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-parachain-inherent = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-timestamp = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +parachain-info = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-test-relay-sproof-builder = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } # Polkadot dependencies polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false, features = ["wasm-api"] } diff --git a/node/Cargo.toml b/node/Cargo.toml index cecd5599e..7f599211b 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -82,18 +82,18 @@ frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", optional = true } # Cumulus dependencies -cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-client-collator = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } -cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38" } +cumulus-client-cli = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-collator = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-consensus-aura = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-consensus-relay-chain = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-consensus-common = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-network = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-client-service = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-primitives-core = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-primitives-parachain-inherent = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-interface = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-inprocess-interface = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } +cumulus-relay-chain-minimal-node = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38" } # Polkadot dependencies polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38" } diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 58c161ea3..44687cca6 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -56,8 +56,8 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false } # Cumulus dependencies -pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +pallet-collator-selection = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } [features] default = ["std"] diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 5c039cdd3..4a7150b16 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -76,20 +76,20 @@ orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-m orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # collator support -pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +pallet-collator-selection = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # Cumulus dependencies -cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +cumulus-pallet-aura-ext = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-parachain-system = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcm = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-dmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-core = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-utility = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-parachain-inherent = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-timestamp = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +parachain-info = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } # Polkadot dependencies polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false, features = ["wasm-api"] } diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index dd61a3cff..eaf166fb3 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -140,6 +140,10 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOriginConverter = XcmOriginToCallOrigin; type PriceForSiblingDelivery = (); type WeightInfo = weights::xcmp_queue::HydraWeight; + type ExecuteDeferredOrigin = EnsureRoot; + type MaxDeferredMessages = ConstU32<100>; + type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; + type XcmDeferFilter = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { diff --git a/runtime/testing-hydradx/Cargo.toml b/runtime/testing-hydradx/Cargo.toml index fd5509fc2..369aca530 100644 --- a/runtime/testing-hydradx/Cargo.toml +++ b/runtime/testing-hydradx/Cargo.toml @@ -77,20 +77,20 @@ orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-m orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # collator support -pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +pallet-collator-selection = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # Cumulus dependencies -cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-xcmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -cumulus-primitives-timestamp = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } -parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.38", default-features = false } +cumulus-pallet-aura-ext = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-parachain-system = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcm = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-dmp-queue = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-core = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-utility = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-parachain-inherent = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-primitives-timestamp = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +parachain-info = { git = "https://github.com/galacticcouncil/cumulus", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } # Polkadot dependencies polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.38", default-features = false, features = ["wasm-api"] } diff --git a/runtime/testing-hydradx/src/xcm.rs b/runtime/testing-hydradx/src/xcm.rs index dd61a3cff..eaf166fb3 100644 --- a/runtime/testing-hydradx/src/xcm.rs +++ b/runtime/testing-hydradx/src/xcm.rs @@ -140,6 +140,10 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ControllerOriginConverter = XcmOriginToCallOrigin; type PriceForSiblingDelivery = (); type WeightInfo = weights::xcmp_queue::HydraWeight; + type ExecuteDeferredOrigin = EnsureRoot; + type MaxDeferredMessages = ConstU32<100>; + type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; + type XcmDeferFilter = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { From cb67a62d53e583b2976d55a94c5c7f62bab23c9f Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 17 Apr 2023 13:45:38 +0200 Subject: [PATCH 02/79] cargo lock changes --- Cargo.lock | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b0625d975..947e6bbff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "clap 4.2.1", "parity-scale-codec", @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1592,7 +1592,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1615,7 +1615,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-support", "frame-system", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1745,7 +1745,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "futures", @@ -1875,7 +1875,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1893,7 +1893,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2006,7 +2006,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6350,7 +6350,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-benchmarking", "frame-support", @@ -7353,7 +7353,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14744,124 +14744,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" From c5a52caf38a2936435eb7ace7cf3a2e0e1d4aaa1 Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 17 Apr 2023 14:02:33 +0200 Subject: [PATCH 03/79] add xcm-rate-limiter pallet base --- Cargo.lock | 25 + Cargo.toml | 1 + pallets/xcm-rate-limiter/Cargo.toml | 56 +++ pallets/xcm-rate-limiter/README.md | 3 + pallets/xcm-rate-limiter/src/benchmarking.rs | 37 ++ pallets/xcm-rate-limiter/src/lib.rs | 110 +++++ pallets/xcm-rate-limiter/src/tests/mock.rs | 493 +++++++++++++++++++ pallets/xcm-rate-limiter/src/tests/mod.rs | 1 + pallets/xcm-rate-limiter/src/weights.rs | 92 ++++ 9 files changed, 818 insertions(+) create mode 100644 pallets/xcm-rate-limiter/Cargo.toml create mode 100644 pallets/xcm-rate-limiter/README.md create mode 100644 pallets/xcm-rate-limiter/src/benchmarking.rs create mode 100644 pallets/xcm-rate-limiter/src/lib.rs create mode 100644 pallets/xcm-rate-limiter/src/tests/mock.rs create mode 100644 pallets/xcm-rate-limiter/src/tests/mod.rs create mode 100644 pallets/xcm-rate-limiter/src/weights.rs diff --git a/Cargo.lock b/Cargo.lock index 947e6bbff..afb7fe40b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7350,6 +7350,31 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "pallet-xcm-rate-limiter" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "hydra-dx-math", + "hydradx-traits", + "orml-tokens", + "orml-traits", + "pallet-balances", + "pallet-omnipool", + "parity-scale-codec", + "pretty_assertions", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "test-case", + "test-utils", +] + [[package]] name = "parachain-info" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 7327cb038..97a20ded2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ 'utils/build-script-utils', 'integration-tests', 'pallets/circuit-breaker', + 'pallets/xcm-rate-limiter', 'pallets/omnipool-liquidity-mining', 'scraper', ] diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml new file mode 100644 index 000000000..0bb85e250 --- /dev/null +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -0,0 +1,56 @@ +[package] +name = "pallet-xcm-rate-limiter" +version = "0.1.0" +authors = ["GalacticCouncil "] +edition = "2021" +license = "Apache-2.0" +homepage = 'https://github.com/galacticcouncil/hydradx-node' +repository = 'https://github.com/galacticcouncil/hydradx-node' +description = "Circuit breakers for AMMs" + +[package.metadata.docs.rs] +targets = ['x86_64-unknown-linux-gnu'] + +[dependencies] +serde = { features = ["derive"], optional = true, version = "1.0.136" } +codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.4.0" } +scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } + +# Substrate dependencies +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false , optional = true} +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } +frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } +sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } +sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } +sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } + +pallet-omnipool = { path = "../omnipool", default-features = false } + +# Warehouse +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } + +[dev-dependencies] +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } +orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } +hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +pretty_assertions = "1.2.1" +test-case = "3.0.0" + +[features] +default = ['std'] +std = [ + 'codec/std', + 'frame-support/std', + 'frame-system/std', + 'serde/std', + 'scale-info/std', +] +runtime-benchmarks = [ + "frame-benchmarking", + "frame-support/runtime-benchmarks", + "frame-system/runtime-benchmarks", +] +try-runtime = [ "frame-support/try-runtime" ] diff --git a/pallets/xcm-rate-limiter/README.md b/pallets/xcm-rate-limiter/README.md new file mode 100644 index 000000000..89ea88d35 --- /dev/null +++ b/pallets/xcm-rate-limiter/README.md @@ -0,0 +1,3 @@ +### XCM Rate Limiter + +TODO: Add readme \ No newline at end of file diff --git a/pallets/xcm-rate-limiter/src/benchmarking.rs b/pallets/xcm-rate-limiter/src/benchmarking.rs new file mode 100644 index 000000000..033619c5b --- /dev/null +++ b/pallets/xcm-rate-limiter/src/benchmarking.rs @@ -0,0 +1,37 @@ +// This file is part of Basilisk-node. + +// Copyright (C) 2022 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. + +#![cfg(feature = "runtime-benchmarks")] + +use super::*; + +use frame_benchmarking::{account, benchmarks}; +use frame_support::traits::Hooks; +use frame_system::RawOrigin; +use sp_std::prelude::*; + +benchmarks! { + + asd { + + }: { + } + verify { + } + + impl_benchmark_test_suite!(Pallet, crate::tests::mock::ExtBuilder::default().build(), crate::tests::mock::Test); +} diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs new file mode 100644 index 000000000..482f90194 --- /dev/null +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -0,0 +1,110 @@ +// This file is part of HydraDX. + +// Copyright (C) 2020-2022 Intergalactic, Limited (GIB). +// 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. + +#![cfg_attr(not(feature = "std"), no_std)] + +use codec::{Decode, Encode}; +use frame_support::dispatch::Weight; +use frame_support::traits::{Contains, EnsureOrigin}; +use frame_support::{ensure, pallet_prelude::DispatchResult, traits::Get}; +use frame_system::ensure_signed_or_root; +use frame_system::pallet_prelude::OriginFor; +use scale_info::TypeInfo; +use sp_core::MaxEncodedLen; +use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; +use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug}; + +pub mod weights; + +#[cfg(any(feature = "runtime-benchmarks", test))] +mod benchmarking; + +#[cfg(test)] +mod tests; + +// Re-export pallet items so that they can be accessed from the crate namespace. +pub use pallet::*; +pub use weights::WeightInfo; + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use codec::HasCompact; + use frame_support::pallet_prelude::*; + use frame_support::traits::Contains; + + #[pallet::hooks] + impl Hooks for Pallet {} + + #[pallet::config] + pub trait Config: frame_system::Config { + /// The overarching event type. + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + + /// Identifier for the class of asset. + type AssetId: Member + + Parameter + + Default + + Copy + + HasCompact + + MaybeSerializeDeserialize + + MaxEncodedLen + + TypeInfo + + AtLeast32BitUnsigned; + + /// Weight information for extrinsics in this pallet. + type WeightInfo: WeightInfo; + } + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + pub struct Pallet(_); + + /* + #[pallet::storage] + /// Liquidity limits of assets for removing liquidity. + #[pallet::getter(fn remove_liquidity_limit_per_asset)] + pub type LiquidityRemoveLimitPerAsset = + StorageMap<_, Blake2_128Concat, T::AssetId, Option<(u32, u32)>, ValueQuery, DefaultRemoveLiquidityLimit>; + + */ + + #[pallet::event] + #[pallet::generate_deposit(pub(crate) fn deposit_event)] + pub enum Event { + Event1 {}, + } + + #[pallet::error] + #[cfg_attr(test, derive(PartialEq, Eq))] + pub enum Error { + /// Invalid value for a limit. Limit must be non-zero. + Error1, + } + + #[pallet::call] + impl Pallet { + /// Set trade volume limit for an asset. + #[pallet::call_index(0)] + #[pallet::weight(::WeightInfo::set_trade_volume_limit())] + pub fn asd(origin: OriginFor, asset_id: T::AssetId, trade_volume_limit: (u32, u32)) -> DispatchResult { + Ok(()) + } + } +} + +impl Pallet {} diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs new file mode 100644 index 000000000..f2087e552 --- /dev/null +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -0,0 +1,493 @@ +// This file is part of HydraDX. + +// Copyright (C) 2020-2022 Intergalactic, Limited (GIB). +// 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. + +pub use crate as pallet_circuit_breaker; +use frame_support::traits::{Contains, GenesisBuild}; +pub use frame_support::traits::{Everything, OnFinalize}; +pub use frame_support::{assert_noop, assert_ok, parameter_types}; + +use frame_system::EnsureRoot; +use hydra_dx_math::omnipool::types::BalanceUpdate; +use orml_traits::parameter_type_with_key; +use sp_core::H256; +use sp_runtime::traits::{ConstU128, ConstU32}; +use sp_runtime::DispatchResult; +use sp_runtime::FixedU128; +use sp_runtime::Permill; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, IdentityLookup}, + DispatchError, +}; +use std::cell::RefCell; +use std::collections::HashMap; +use std::marker::PhantomData; +type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; +type Block = frame_system::mocking::MockBlock; + +pub type AccountId = u64; +pub type AssetId = u32; +pub type Balance = u128; + +pub const ALICE: u64 = 1; +pub const WHITELISTED_ACCCOUNT: u64 = 2; + +pub const LP1: u64 = 1; +pub const LP2: u64 = 2; +pub const TRADER: u64 = 4; + +pub const HDX: AssetId = 100; +pub const DOT: AssetId = 200; +pub const DAI: AssetId = 2; +pub const LRNA: AssetId = 300; +pub const ACA: AssetId = 4; + +pub const ONE: Balance = 1_000_000_000_000; + +pub const INITIAL_LIQUIDITY: Balance = 1_000_000; +pub const REGISTERED_ASSET: AssetId = 1000; +pub const NATIVE_AMOUNT: Balance = 10_000 * ONE; + +pub const FIVE_PERCENT: (u32, u32) = (500, 10_000); +pub const TEN_PERCENT: (u32, u32) = (1_000, 10_000); + +thread_local! { + pub static POSITIONS: RefCell> = RefCell::new(HashMap::default()); + pub static REGISTERED_ASSETS: RefCell> = RefCell::new(HashMap::default()); + pub static ASSET_WEIGHT_CAP: RefCell = RefCell::new(Permill::from_percent(100)); + pub static ASSET_FEE: RefCell = RefCell::new(Permill::from_percent(0)); + pub static PROTOCOL_FEE: RefCell = RefCell::new(Permill::from_percent(0)); + pub static MIN_ADDED_LIQUDIITY: RefCell = RefCell::new(1000u128); + pub static MIN_TRADE_AMOUNT: RefCell = RefCell::new(1000u128); + pub static MAX_IN_RATIO: RefCell = RefCell::new(1u128); + pub static MAX_OUT_RATIO: RefCell = RefCell::new(1u128); + pub static MAX_NET_TRADE_VOLUME_LIMIT_PER_BLOCK: RefCell<(u32, u32)> = RefCell::new((2_000, 10_000)); // 20% + pub static MAX_ADD_LIQUIDITY_LIMIT_PER_BLOCK: RefCell> = RefCell::new(Some((4_000, 10_000))); // 40% + pub static MAX_REMOVE_LIQUIDITY_LIMIT_PER_BLOCK: RefCell> = RefCell::new(Some((2_000, 10_000))); // 20% +} + +frame_support::construct_runtime!( + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system, + Balances: pallet_balances, + Omnipool: pallet_omnipool, + Tokens: orml_tokens, + CircuitBreaker: pallet_circuit_breaker, + } +); + +parameter_types! { + pub const BlockHashCount: u64 = 250; + pub const SS58Prefix: u8 = 42; +} + +impl frame_system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = (); + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = SS58Prefix; + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; +} + +parameter_types! { + pub DefaultMaxNetTradeVolumeLimitPerBlock: (u32, u32) = MAX_NET_TRADE_VOLUME_LIMIT_PER_BLOCK.with(|v| *v.borrow()); + pub DefaultMaxAddLiquidityLimitPerBlock: Option<(u32, u32)> = MAX_ADD_LIQUIDITY_LIMIT_PER_BLOCK.with(|v| *v.borrow()); + pub DefaultMaxRemoveLiquidityLimitPerBlock: Option<(u32, u32)> = MAX_REMOVE_LIQUIDITY_LIMIT_PER_BLOCK.with(|v| *v.borrow()); + pub const OmnipoolHubAsset: AssetId = LRNA; +} + +impl pallet_circuit_breaker::Config for Test { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type WeightInfo = (); +} + +pub struct CircuitBreakerWhitelist; + +impl Contains for CircuitBreakerWhitelist { + fn contains(a: &AccountId) -> bool { + WHITELISTED_ACCCOUNT == *a + } +} + +impl pallet_balances::Config for Test { + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ConstU128<1>; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = ConstU32<50>; + type ReserveIdentifier = [u8; 8]; +} + +parameter_type_with_key! { + pub ExistentialDeposits: |_currency_id: AssetId| -> Balance { + 0 + }; +} + +impl orml_tokens::Config for Test { + type RuntimeEvent = RuntimeEvent; + type Balance = Balance; + type Amount = i128; + type CurrencyId = AssetId; + type WeightInfo = (); + type ExistentialDeposits = ExistentialDeposits; + type MaxLocks = (); + type DustRemovalWhitelist = Everything; + type MaxReserves = (); + type ReserveIdentifier = (); + type CurrencyHooks = (); +} + +parameter_types! { + pub const HDXAssetId: AssetId = HDX; + pub const LRNAAssetId: AssetId = LRNA; + pub const DAIAssetId: AssetId = DAI; + pub const PosiitionCollectionId: u32= 1000; + + pub ProtocolFee: Permill = PROTOCOL_FEE.with(|v| *v.borrow()); + pub AssetFee: Permill = ASSET_FEE.with(|v| *v.borrow()); + pub AssetWeightCap: Permill =ASSET_WEIGHT_CAP.with(|v| *v.borrow()); + pub MinAddedLiquidity: Balance = MIN_ADDED_LIQUDIITY.with(|v| *v.borrow()); + pub MinTradeAmount: Balance = MIN_TRADE_AMOUNT.with(|v| *v.borrow()); + pub MaxInRatio: Balance = MAX_IN_RATIO.with(|v| *v.borrow()); + pub MaxOutRatio: Balance = MAX_OUT_RATIO.with(|v| *v.borrow()); + pub const TVLCap: Balance = Balance::MAX; +} + +impl pallet_omnipool::Config for Test { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type PositionItemId = u32; + type Currency = Tokens; + type AuthorityOrigin = EnsureRoot; + type HubAssetId = LRNAAssetId; + type ProtocolFee = ProtocolFee; + type AssetFee = AssetFee; + type StableCoinAssetId = DAIAssetId; + type WeightInfo = (); + type HdxAssetId = HDXAssetId; + type NFTCollectionId = PosiitionCollectionId; + type NFTHandler = DummyNFT; + type AssetRegistry = DummyRegistry; + type MinimumTradingLimit = MinTradeAmount; + type MinimumPoolLiquidity = MinAddedLiquidity; + type TechnicalOrigin = EnsureRoot; + type MaxInRatio = MaxInRatio; + type MaxOutRatio = MaxOutRatio; + type CollectionId = u32; + type OmnipoolHooks = (); + type PriceBarrier = (); +} +use frame_support::traits::tokens::nonfungibles::{Create, Inspect, Mutate}; +use frame_support::weights::Weight; +use hydra_dx_math::ema::EmaPrice; + +pub struct DummyNFT; + +impl> Inspect for DummyNFT { + type ItemId = u32; + type CollectionId = u32; + + fn owner(_class: &Self::CollectionId, instance: &Self::ItemId) -> Option { + let mut owner: Option = None; + + POSITIONS.with(|v| { + if let Some(o) = v.borrow().get(instance) { + owner = Some((*o).into()); + } + }); + owner + } +} + +impl> Create for DummyNFT { + fn create_collection(_class: &Self::CollectionId, _who: &AccountId, _admin: &AccountId) -> DispatchResult { + Ok(()) + } +} + +impl + Into + Copy> Mutate for DummyNFT { + fn mint_into(_class: &Self::CollectionId, _instance: &Self::ItemId, _who: &AccountId) -> DispatchResult { + POSITIONS.with(|v| { + let mut m = v.borrow_mut(); + m.insert(*_instance, (*_who).into()); + }); + Ok(()) + } + + fn burn( + _class: &Self::CollectionId, + instance: &Self::ItemId, + _maybe_check_owner: Option<&AccountId>, + ) -> DispatchResult { + POSITIONS.with(|v| { + let mut m = v.borrow_mut(); + m.remove(instance); + }); + Ok(()) + } +} + +use crate::Config; +use hydradx_traits::Registry; +use pallet_omnipool::traits::{AssetInfo, ExternalPriceProvider, OmnipoolHooks}; + +pub struct DummyRegistry(sp_std::marker::PhantomData); + +impl Registry, Balance, DispatchError> for DummyRegistry +where + T::AssetId: Into + From, +{ + fn exists(asset_id: T::AssetId) -> bool { + let asset = REGISTERED_ASSETS.with(|v| v.borrow().get(&(asset_id.into())).copied()); + matches!(asset, Some(_)) + } + + fn retrieve_asset(_name: &Vec) -> Result { + Ok(T::AssetId::default()) + } + + fn create_asset(_name: &Vec, _existential_deposit: Balance) -> Result { + let assigned = REGISTERED_ASSETS.with(|v| { + let l = v.borrow().len(); + v.borrow_mut().insert(l as u32, l as u32); + l as u32 + }); + Ok(T::AssetId::from(assigned)) + } +} + +pub struct ExtBuilder { + endowed_accounts: Vec<(u64, AssetId, Balance)>, + registered_assets: Vec, + asset_fee: Permill, + protocol_fee: Permill, + asset_weight_cap: Permill, + min_liquidity: u128, + min_trade_limit: u128, + register_stable_asset: bool, + max_in_ratio: Balance, + max_out_ratio: Balance, + tvl_cap: Balance, + init_pool: Option<(FixedU128, FixedU128)>, + pool_tokens: Vec<(AssetId, FixedU128, AccountId, Balance)>, +} + +impl Default for ExtBuilder { + fn default() -> Self { + // If eg. tests running on one thread only, this thread local is shared. + // let's make sure that it is empty for each test case + // or set to original default value + REGISTERED_ASSETS.with(|v| { + v.borrow_mut().clear(); + }); + POSITIONS.with(|v| { + v.borrow_mut().clear(); + }); + ASSET_WEIGHT_CAP.with(|v| { + *v.borrow_mut() = Permill::from_percent(100); + }); + ASSET_FEE.with(|v| { + *v.borrow_mut() = Permill::from_percent(0); + }); + PROTOCOL_FEE.with(|v| { + *v.borrow_mut() = Permill::from_percent(0); + }); + MIN_ADDED_LIQUDIITY.with(|v| { + *v.borrow_mut() = 1000u128; + }); + MIN_TRADE_AMOUNT.with(|v| { + *v.borrow_mut() = 1000u128; + }); + MAX_IN_RATIO.with(|v| { + *v.borrow_mut() = 1u128; + }); + MAX_OUT_RATIO.with(|v| { + *v.borrow_mut() = 1u128; + }); + + Self { + endowed_accounts: vec![ + (Omnipool::protocol_account(), DAI, 1000 * ONE), + (Omnipool::protocol_account(), HDX, NATIVE_AMOUNT), + ], + asset_fee: Permill::from_percent(0), + protocol_fee: Permill::from_percent(0), + asset_weight_cap: Permill::from_percent(100), + min_liquidity: 0, + registered_assets: vec![], + min_trade_limit: 0, + init_pool: None, + register_stable_asset: true, + pool_tokens: vec![], + max_in_ratio: 1u128, + max_out_ratio: 1u128, + tvl_cap: u128::MAX, + } + } +} + +impl ExtBuilder { + pub fn with_endowed_accounts(mut self, accounts: Vec<(u64, AssetId, Balance)>) -> Self { + self.endowed_accounts = accounts; + self + } + pub fn add_endowed_accounts(mut self, account: (u64, AssetId, Balance)) -> Self { + self.endowed_accounts.push(account); + self + } + pub fn with_registered_asset(mut self, asset: AssetId) -> Self { + self.registered_assets.push(asset); + self + } + + pub fn with_initial_pool(mut self, stable_price: FixedU128, native_price: FixedU128) -> Self { + self.init_pool = Some((stable_price, native_price)); + self + } + + pub fn with_token( + mut self, + asset_id: AssetId, + price: FixedU128, + position_owner: AccountId, + amount: Balance, + ) -> Self { + self.pool_tokens.push((asset_id, price, position_owner, amount)); + self + } + + pub fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + // Add DAi and HDX as pre-registered assets + REGISTERED_ASSETS.with(|v| { + if self.register_stable_asset { + v.borrow_mut().insert(DAI, DAI); + } + v.borrow_mut().insert(HDX, HDX); + v.borrow_mut().insert(REGISTERED_ASSET, REGISTERED_ASSET); + self.registered_assets.iter().for_each(|asset| { + v.borrow_mut().insert(*asset, *asset); + }); + }); + + ASSET_FEE.with(|v| { + *v.borrow_mut() = self.asset_fee; + }); + ASSET_WEIGHT_CAP.with(|v| { + *v.borrow_mut() = self.asset_weight_cap; + }); + + PROTOCOL_FEE.with(|v| { + *v.borrow_mut() = self.protocol_fee; + }); + + MIN_ADDED_LIQUDIITY.with(|v| { + *v.borrow_mut() = self.min_liquidity; + }); + + MIN_TRADE_AMOUNT.with(|v| { + *v.borrow_mut() = self.min_trade_limit; + }); + MAX_IN_RATIO.with(|v| { + *v.borrow_mut() = self.max_in_ratio; + }); + MAX_OUT_RATIO.with(|v| { + *v.borrow_mut() = self.max_out_ratio; + }); + + orml_tokens::GenesisConfig:: { + balances: self + .endowed_accounts + .iter() + .flat_map(|(x, asset, amount)| vec![(*x, *asset, *amount)]) + .collect(), + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut r: sp_io::TestExternalities = t.into(); + + r.execute_with(|| { + assert_ok!(Omnipool::set_tvl_cap(RuntimeOrigin::root(), self.tvl_cap,)); + }); + + if let Some((stable_price, native_price)) = self.init_pool { + r.execute_with(|| { + assert_ok!(Omnipool::initialize_pool( + RuntimeOrigin::root(), + stable_price, + native_price, + Permill::from_percent(100), + Permill::from_percent(100) + )); + + for (asset_id, price, owner, amount) in self.pool_tokens { + assert_ok!(Tokens::transfer( + RuntimeOrigin::signed(owner), + Omnipool::protocol_account(), + asset_id, + amount + )); + assert_ok!(Omnipool::add_token( + RuntimeOrigin::root(), + asset_id, + price, + self.asset_weight_cap, + owner + )); + } + }); + } + + r.execute_with(|| System::set_block_number(1)); + + r + } +} + +pub fn expect_events(e: Vec) { + test_utils::expect_events::(e); +} diff --git a/pallets/xcm-rate-limiter/src/tests/mod.rs b/pallets/xcm-rate-limiter/src/tests/mod.rs new file mode 100644 index 000000000..5c8ab1288 --- /dev/null +++ b/pallets/xcm-rate-limiter/src/tests/mod.rs @@ -0,0 +1 @@ +pub(crate) mod mock; diff --git a/pallets/xcm-rate-limiter/src/weights.rs b/pallets/xcm-rate-limiter/src/weights.rs new file mode 100644 index 000000000..341b16208 --- /dev/null +++ b/pallets/xcm-rate-limiter/src/weights.rs @@ -0,0 +1,92 @@ +// This file is part of HydraDX. + +// Copyright (C) 2020-2021 Intergalactic, Limited (GIB). +// 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. + +//! Autogenerated weights for pallet_circuit_breaker +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2022-10-26, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 + +// Executed Command: +// target/release/hydradx +// benchmark +// pallet +// --pallet=pallet-circuit-breaker +// --chain=local +// --steps=5 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output +// weights.rs +// --template +// .maintain/pallet-weight-template.hbs +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] + +use frame_support::{ + traits::Get, + weights::{constants::RocksDbWeight, Weight}, +}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_omnipool. +pub trait WeightInfo { + fn on_finalize(m: u32, n: u32) -> Weight; + fn on_finalize_single() -> Weight; + fn on_finalize_empty() -> Weight; + fn set_trade_volume_limit() -> Weight; + fn set_add_liquidity_limit() -> Weight; + fn set_remove_liquidity_limit() -> Weight; + fn ensure_pool_state_change_limit() -> Weight; + fn ensure_add_liquidity_limit() -> Weight; + fn ensure_remove_liquidity_limit() -> Weight; +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn on_finalize(_m: u32, _n: u32) -> Weight { + Weight::zero() + } + fn on_finalize_single() -> Weight { + Weight::zero() + } + fn on_finalize_empty() -> Weight { + Weight::zero() + } + fn set_trade_volume_limit() -> Weight { + Weight::zero() + } + fn set_add_liquidity_limit() -> Weight { + Weight::zero() + } + fn set_remove_liquidity_limit() -> Weight { + Weight::zero() + } + fn ensure_pool_state_change_limit() -> Weight { + Weight::zero() + } + fn ensure_add_liquidity_limit() -> Weight { + Weight::zero() + } + fn ensure_remove_liquidity_limit() -> Weight { + Weight::zero() + } +} From 9dd226411d22b253be762c32b6702ecdff0261b3 Mon Sep 17 00:00:00 2001 From: dmoka Date: Mon, 17 Apr 2023 14:31:30 +0200 Subject: [PATCH 04/79] add first failing test for tracking incoming asset liquidity --- Cargo.lock | 4 ++ pallets/xcm-rate-limiter/Cargo.toml | 9 ++++ pallets/xcm-rate-limiter/src/lib.rs | 20 +++++--- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 46 +++++++++++++++++++ pallets/xcm-rate-limiter/src/tests/mock.rs | 6 +-- pallets/xcm-rate-limiter/src/tests/mod.rs | 1 + 6 files changed, 77 insertions(+), 9 deletions(-) create mode 100644 pallets/xcm-rate-limiter/src/tests/defer_xcm.rs diff --git a/Cargo.lock b/Cargo.lock index afb7fe40b..3c8b68449 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7354,6 +7354,7 @@ dependencies = [ name = "pallet-xcm-rate-limiter" version = "0.1.0" dependencies = [ + "cumulus-pallet-xcmp-queue", "frame-benchmarking", "frame-support", "frame-system", @@ -7364,6 +7365,8 @@ dependencies = [ "pallet-balances", "pallet-omnipool", "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", "pretty_assertions", "scale-info", "serde", @@ -7373,6 +7376,7 @@ dependencies = [ "sp-std", "test-case", "test-utils", + "xcm", ] [[package]] diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index 0bb85e250..e65f6dcc1 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -25,6 +25,14 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } +#Polkadot +xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.38" } +polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.38" } +polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.38" } + +# Cumulus +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } + pallet-omnipool = { path = "../omnipool", default-features = false } # Warehouse @@ -47,6 +55,7 @@ std = [ 'frame-system/std', 'serde/std', 'scale-info/std', + 'cumulus-pallet-xcmp-queue/std' ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 482f90194..d67efb429 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -18,6 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; +use cumulus_pallet_xcmp_queue::XcmDeferFilter; use frame_support::dispatch::Weight; use frame_support::traits::{Contains, EnsureOrigin}; use frame_support::{ensure, pallet_prelude::DispatchResult, traits::Get}; @@ -27,6 +28,7 @@ use scale_info::TypeInfo; use sp_core::MaxEncodedLen; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug}; +use xcm::VersionedXcm; pub mod weights; @@ -74,14 +76,10 @@ pub mod pallet { #[pallet::generate_store(pub(super) trait Store)] pub struct Pallet(_); - /* #[pallet::storage] - /// Liquidity limits of assets for removing liquidity. + /// TODO: #[pallet::getter(fn remove_liquidity_limit_per_asset)] - pub type LiquidityRemoveLimitPerAsset = - StorageMap<_, Blake2_128Concat, T::AssetId, Option<(u32, u32)>, ValueQuery, DefaultRemoveLiquidityLimit>; - - */ + pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, T::AssetId, u128, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] @@ -108,3 +106,13 @@ pub mod pallet { } impl Pallet {} + +impl XcmDeferFilter for Pallet { + fn deferred_by( + para: polkadot_parachain::primitives::Id, + sent_at: polkadot_core_primitives::BlockNumber, + xcm: &VersionedXcm, + ) -> Option { + todo!() + } +} diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs new file mode 100644 index 000000000..6604f148f --- /dev/null +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -0,0 +1,46 @@ +// This file is part of HydraDX. + +// Copyright (C) 2020-2022 Intergalactic, Limited (GIB). +// 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::tests::mock::RuntimeCall; +use crate::tests::mock::*; +use crate::*; +use cumulus_pallet_xcmp_queue::XcmDeferFilter; +use frame_support::assert_storage_noop; +pub use pretty_assertions::{assert_eq, assert_ne}; +use xcm::latest::prelude::*; +use xcm::VersionedXcm; + +#[test] +fn deferred_by_should_track_incoming_asset_liquidity() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_reserve_asset_deposited(); + let para_id = 999.into(); + + //Act + XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + //Assert + }); +} +pub fn create_versioned_reserve_asset_deposited() -> VersionedXcm { + //TODO: pass an asset with volume then assert it in the test + let multi_asset = MultiAssets::from_sorted_and_deduplicated(vec![]).unwrap(); + VersionedXcm::from(Xcm::(vec![ + Instruction::::ReserveAssetDeposited(multi_asset), + ])) +} diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index f2087e552..e2d973e83 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -15,7 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -pub use crate as pallet_circuit_breaker; +pub use crate as pallet_xcm_rate_limiter; use frame_support::traits::{Contains, GenesisBuild}; pub use frame_support::traits::{Everything, OnFinalize}; pub use frame_support::{assert_noop, assert_ok, parameter_types}; @@ -90,7 +90,7 @@ frame_support::construct_runtime!( Balances: pallet_balances, Omnipool: pallet_omnipool, Tokens: orml_tokens, - CircuitBreaker: pallet_circuit_breaker, + XcmRateLimiter: pallet_xcm_rate_limiter, } ); @@ -133,7 +133,7 @@ parameter_types! { pub const OmnipoolHubAsset: AssetId = LRNA; } -impl pallet_circuit_breaker::Config for Test { +impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; type WeightInfo = (); diff --git a/pallets/xcm-rate-limiter/src/tests/mod.rs b/pallets/xcm-rate-limiter/src/tests/mod.rs index 5c8ab1288..1221969df 100644 --- a/pallets/xcm-rate-limiter/src/tests/mod.rs +++ b/pallets/xcm-rate-limiter/src/tests/mod.rs @@ -1 +1,2 @@ +pub(crate) mod defer_xcm; pub(crate) mod mock; From 821a30fc0fbea7a0f7af1e44ee6666fc67b93992 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 18 Apr 2023 10:32:24 +0200 Subject: [PATCH 05/79] add first implementation for tracking asset volume --- pallets/xcm-rate-limiter/src/lib.rs | 32 +++++++++++++++++-- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 8 +++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index d67efb429..7da91aa60 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -28,7 +28,9 @@ use scale_info::TypeInfo; use sp_core::MaxEncodedLen; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug}; +use xcm::latest::{AssetId, Fungibility, Instruction}; use xcm::VersionedXcm; +use xcm::VersionedXcm::V3; pub mod weights; @@ -48,6 +50,7 @@ pub mod pallet { use codec::HasCompact; use frame_support::pallet_prelude::*; use frame_support::traits::Contains; + use xcm::lts::MultiLocation; #[pallet::hooks] impl Hooks for Pallet {} @@ -78,8 +81,8 @@ pub mod pallet { #[pallet::storage] /// TODO: - #[pallet::getter(fn remove_liquidity_limit_per_asset)] - pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, T::AssetId, u128, ValueQuery>; + #[pallet::getter(fn liquidity_per_asset)] + pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, MultiLocation, u128, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] @@ -113,6 +116,29 @@ impl XcmDeferFilter for Pallet { sent_at: polkadot_core_primitives::BlockNumber, xcm: &VersionedXcm, ) -> Option { - todo!() + if let V3(xcm) = xcm { + if let Some(instruction) = xcm.first() { + match instruction { + Instruction::ReserveAssetDeposited(multi_assets) => { + for asset in multi_assets.inner() { + match asset.id { + AssetId::Concrete(location) => match asset.fun { + Fungibility::Fungible(amount) => { + let mut liquidity_per_asset = LiquidityPerAsset::::get(location); + liquidity_per_asset += amount; + LiquidityPerAsset::::insert(location, liquidity_per_asset); + } + Fungibility::NonFungible(_) => {} + }, + AssetId::Abstract(_) => {} + } + } + } + _ => {} + } + } + } + + None } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 6604f148f..9e7e9d381 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -21,7 +21,7 @@ use crate::*; use cumulus_pallet_xcmp_queue::XcmDeferFilter; use frame_support::assert_storage_noop; pub use pretty_assertions::{assert_eq, assert_ne}; -use xcm::latest::prelude::*; +use xcm::lts::prelude::*; use xcm::VersionedXcm; #[test] @@ -35,12 +35,14 @@ fn deferred_by_should_track_incoming_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(volume, 5); }); } pub fn create_versioned_reserve_asset_deposited() -> VersionedXcm { //TODO: pass an asset with volume then assert it in the test - let multi_asset = MultiAssets::from_sorted_and_deduplicated(vec![]).unwrap(); + let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(MultiLocation::parent(), 5).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ - Instruction::::ReserveAssetDeposited(multi_asset), + Instruction::::ReserveAssetDeposited(multi_assets), ])) } From 45383d8e7b7f1b5853f4489236686278af16313a Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 18 Apr 2023 11:00:07 +0200 Subject: [PATCH 06/79] refactor rate limiter and test, add teleported asset case --- pallets/xcm-rate-limiter/src/lib.rs | 47 +++++++++++-------- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 33 +++++++++++-- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 7da91aa60..218b58a3c 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -28,7 +28,7 @@ use scale_info::TypeInfo; use sp_core::MaxEncodedLen; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug}; -use xcm::latest::{AssetId, Fungibility, Instruction}; +use xcm::lts::prelude::*; use xcm::VersionedXcm; use xcm::VersionedXcm::V3; @@ -108,7 +108,29 @@ pub mod pallet { } } -impl Pallet {} +fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { + match m.id { + AssetId::Concrete(location) => match m.fun { + Fungibility::Fungible(amount) => Some((location, amount)), + _ => None, + }, + _ => None, + } +} + +impl Pallet { + fn get_locations_and_amounts(instruction: &Instruction) -> Vec<(MultiLocation, u128)> { + use Instruction::*; + match instruction { + ReserveAssetDeposited(multi_assets) | ReceiveTeleportedAsset(multi_assets) => multi_assets + .inner() + .iter() + .flat_map(|asset| get_loc_and_amount(asset)) + .collect(), + _ => Vec::new(), + } + } +} impl XcmDeferFilter for Pallet { fn deferred_by( @@ -118,23 +140,10 @@ impl XcmDeferFilter for Pallet { ) -> Option { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { - match instruction { - Instruction::ReserveAssetDeposited(multi_assets) => { - for asset in multi_assets.inner() { - match asset.id { - AssetId::Concrete(location) => match asset.fun { - Fungibility::Fungible(amount) => { - let mut liquidity_per_asset = LiquidityPerAsset::::get(location); - liquidity_per_asset += amount; - LiquidityPerAsset::::insert(location, liquidity_per_asset); - } - Fungibility::NonFungible(_) => {} - }, - AssetId::Abstract(_) => {} - } - } - } - _ => {} + for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { + let mut liquidity_per_asset = LiquidityPerAsset::::get(location); + liquidity_per_asset += amount; + LiquidityPerAsset::::insert(location, liquidity_per_asset); } } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 9e7e9d381..a3cbc0d85 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -25,10 +25,10 @@ use xcm::lts::prelude::*; use xcm::VersionedXcm; #[test] -fn deferred_by_should_track_incoming_asset_liquidity() { +fn deferred_by_should_track_incoming_deposited_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 5); let para_id = 999.into(); //Act @@ -39,10 +39,33 @@ fn deferred_by_should_track_incoming_asset_liquidity() { assert_eq!(volume, 5); }); } -pub fn create_versioned_reserve_asset_deposited() -> VersionedXcm { - //TODO: pass an asset with volume then assert it in the test - let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(MultiLocation::parent(), 5).into()]).unwrap(); + +#[test] +fn deferred_by_should_track_incoming_teleported_asset_liquidity() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_receive_teleported_asset(MultiLocation::parent(), 5); + let para_id = 999.into(); + + //Act + XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + //Assert + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(volume, 5); + }); +} + +pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { + let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ Instruction::::ReserveAssetDeposited(multi_assets), ])) } + +pub fn create_versioned_receive_teleported_asset(loc: MultiLocation, amount: u128) -> VersionedXcm { + let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); + VersionedXcm::from(Xcm::(vec![ + Instruction::::ReceiveTeleportedAsset(multi_assets), + ])) +} From 29c5a1bff09475c81bebf21a830433102b2f082a Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Tue, 18 Apr 2023 11:09:04 +0200 Subject: [PATCH 07/79] adjust runtime-benchmark feature in cargo toml --- Cargo.lock | 100 ++++++++++++++--------------- runtime/hydradx/Cargo.toml | 1 - runtime/testing-hydradx/Cargo.toml | 1 + 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c8b68449..4245e55ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "clap 4.2.1", "parity-scale-codec", @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1592,7 +1592,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1615,7 +1615,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-support", "frame-system", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1745,7 +1745,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "futures", @@ -1875,7 +1875,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1893,7 +1893,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2006,7 +2006,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6350,7 +6350,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-benchmarking", "frame-support", @@ -7382,7 +7382,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14773,124 +14773,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 4a7150b16..cce26f0d6 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -152,7 +152,6 @@ runtime-benchmarks = [ "cumulus-pallet-xcmp-queue/runtime-benchmarks", "pallet-uniques/runtime-benchmarks", "pallet-omnipool/runtime-benchmarks", - "pallet-transaction-pause/runtime-benchmarks", "pallet-circuit-breaker/runtime-benchmarks", "pallet-ema-oracle/runtime-benchmarks", "pallet-duster/runtime-benchmarks", diff --git a/runtime/testing-hydradx/Cargo.toml b/runtime/testing-hydradx/Cargo.toml index 369aca530..41e47cbce 100644 --- a/runtime/testing-hydradx/Cargo.toml +++ b/runtime/testing-hydradx/Cargo.toml @@ -150,6 +150,7 @@ runtime-benchmarks = [ "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "pallet-uniques/runtime-benchmarks", + "pallet-transaction-pause/runtime-benchmarks", ] std = [ "codec/std", From c5bc3f0b626ce61774da461917dbc772e22ab82a Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 18 Apr 2023 11:32:44 +0200 Subject: [PATCH 08/79] defer xcm with duration when rate limit exceeded --- Cargo.lock | 100 +++++++++--------- pallets/xcm-rate-limiter/src/lib.rs | 9 ++ .../xcm-rate-limiter/src/tests/defer_xcm.rs | 17 +++ pallets/xcm-rate-limiter/src/tests/mock.rs | 1 + 4 files changed, 77 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4245e55ba..3c8b68449 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "clap 4.2.1", "parity-scale-codec", @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1592,7 +1592,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1615,7 +1615,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-support", "frame-system", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1745,7 +1745,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "futures", @@ -1875,7 +1875,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1893,7 +1893,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2006,7 +2006,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6350,7 +6350,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "frame-benchmarking", "frame-support", @@ -7382,7 +7382,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14773,124 +14773,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 218b58a3c..c889abf18 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -50,6 +50,7 @@ pub mod pallet { use codec::HasCompact; use frame_support::pallet_prelude::*; use frame_support::traits::Contains; + use polkadot_parachain::primitives::RelayChainBlockNumber; use xcm::lts::MultiLocation; #[pallet::hooks] @@ -71,6 +72,9 @@ pub mod pallet { + TypeInfo + AtLeast32BitUnsigned; + #[pallet::constant] + type DeferDuration: Get; + /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; } @@ -143,7 +147,12 @@ impl XcmDeferFilter for Pallet { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { let mut liquidity_per_asset = LiquidityPerAsset::::get(location); liquidity_per_asset += amount; + LiquidityPerAsset::::insert(location, liquidity_per_asset); + + if liquidity_per_asset >= 1000 * 1_000_000_000_000 { + return Some(T::DeferDuration::get()); + } } } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index a3cbc0d85..a29d528f9 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -56,6 +56,23 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { }); } +#[test] +fn deferred_by_should_defer_xcm_when_limit_exceeded() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 1000 * ONE); + let para_id = 999.into(); + + //Act + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + //Assert + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(volume, 1000 * ONE); + assert_eq!(deferred_block_number, Some(::DeferDuration::get())); + }); +} + pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index e2d973e83..c6e0fc115 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -136,6 +136,7 @@ parameter_types! { impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; + type DeferDuration = ConstU32<20>; type WeightInfo = (); } From fa936243c0ca42dea86afb24bd5ac48325114713 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 18 Apr 2023 11:45:26 +0200 Subject: [PATCH 09/79] add logic for setting rate limit per asset --- pallets/xcm-rate-limiter/src/lib.rs | 10 ++++++++-- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index c889abf18..52f74b99d 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -84,10 +84,15 @@ pub mod pallet { pub struct Pallet(_); #[pallet::storage] - /// TODO: + /// TODO: document #[pallet::getter(fn liquidity_per_asset)] pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, MultiLocation, u128, ValueQuery>; + #[pallet::storage] + /// TODO: document + #[pallet::getter(fn rate_limit)] + pub type RateLimits = StorageMap<_, Blake2_128Concat, MultiLocation, u128, OptionQuery>; + #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] pub enum Event { @@ -106,7 +111,8 @@ pub mod pallet { /// Set trade volume limit for an asset. #[pallet::call_index(0)] #[pallet::weight(::WeightInfo::set_trade_volume_limit())] - pub fn asd(origin: OriginFor, asset_id: T::AssetId, trade_volume_limit: (u32, u32)) -> DispatchResult { + pub fn set_limit(origin: OriginFor, multi_location: MultiLocation, limit: u128) -> DispatchResult { + RateLimits::::insert(multi_location, limit); Ok(()) } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index a29d528f9..13512d042 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -73,6 +73,22 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { }); } +#[test] +fn set_limit_per_asset_should_work() { + ExtBuilder::default().build().execute_with(|| { + //Act + assert_ok!(XcmRateLimiter::set_limit( + RuntimeOrigin::root(), + MultiLocation::parent(), + 1000 * ONE + )); + + //Assert + let limit = XcmRateLimiter::rate_limit(MultiLocation::parent()); + assert_eq!(limit, Some(1000 * ONE)); + }); +} + pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ From b2fe0d008eaf288a29262e6af1a05982c200e5ca Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 18 Apr 2023 11:46:48 +0200 Subject: [PATCH 10/79] add todos --- pallets/xcm-rate-limiter/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 52f74b99d..cc3e14c63 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -108,10 +108,12 @@ pub mod pallet { #[pallet::call] impl Pallet { - /// Set trade volume limit for an asset. + /// TODO: document + // TODO: benchmark #[pallet::call_index(0)] #[pallet::weight(::WeightInfo::set_trade_volume_limit())] pub fn set_limit(origin: OriginFor, multi_location: MultiLocation, limit: u128) -> DispatchResult { + //TODO: add root checking RateLimits::::insert(multi_location, limit); Ok(()) } @@ -156,6 +158,7 @@ impl XcmDeferFilter for Pallet { LiquidityPerAsset::::insert(location, liquidity_per_asset); + //TODO: use config for the limit if liquidity_per_asset >= 1000 * 1_000_000_000_000 { return Some(T::DeferDuration::get()); } From bbda095534ad72ad1d1d133a95e10054df2759c5 Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 18 Apr 2023 13:30:46 +0200 Subject: [PATCH 11/79] add root check for set limit --- pallets/xcm-rate-limiter/src/lib.rs | 5 ++++- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 12 ++++++++++++ pallets/xcm-rate-limiter/src/tests/mock.rs | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index cc3e14c63..c9525ef9e 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -72,6 +72,8 @@ pub mod pallet { + TypeInfo + AtLeast32BitUnsigned; + type TechnicalOrigin: EnsureOrigin; + #[pallet::constant] type DeferDuration: Get; @@ -113,7 +115,8 @@ pub mod pallet { #[pallet::call_index(0)] #[pallet::weight(::WeightInfo::set_trade_volume_limit())] pub fn set_limit(origin: OriginFor, multi_location: MultiLocation, limit: u128) -> DispatchResult { - //TODO: add root checking + T::TechnicalOrigin::ensure_origin(origin)?; + RateLimits::::insert(multi_location, limit); Ok(()) } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 13512d042..076f37264 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -21,6 +21,7 @@ use crate::*; use cumulus_pallet_xcmp_queue::XcmDeferFilter; use frame_support::assert_storage_noop; pub use pretty_assertions::{assert_eq, assert_ne}; +use sp_runtime::DispatchError::BadOrigin; use xcm::lts::prelude::*; use xcm::VersionedXcm; @@ -89,6 +90,17 @@ fn set_limit_per_asset_should_work() { }); } +#[test] +fn set_limit_per_asset_should_fail_when_called_by_non_root() { + ExtBuilder::default().build().execute_with(|| { + //Act + assert_noop!( + XcmRateLimiter::set_limit(RuntimeOrigin::signed(ALICE), MultiLocation::parent(), 1000 * ONE), + BadOrigin + ); + }); +} + pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index c6e0fc115..579b7b387 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -137,6 +137,7 @@ impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; type DeferDuration = ConstU32<20>; + type TechnicalOrigin = EnsureRoot; type WeightInfo = (); } From aba2538e2c1edfb2e4f86edc6a7a0b5bb0c00c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20P=C3=A1nik?= Date: Tue, 18 Apr 2023 15:05:15 +0200 Subject: [PATCH 12/79] started building a deffered message queue logic --- pallets/xcm-rate-limiter/src/lib.rs | 53 ++++++++++++++++--- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 43 +++++++++++++-- pallets/xcm-rate-limiter/src/tests/mock.rs | 3 +- 3 files changed, 87 insertions(+), 12 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index c9525ef9e..de0e1a249 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -77,6 +77,9 @@ pub mod pallet { #[pallet::constant] type DeferDuration: Get; + #[pallet::constant] + type MaxDeferDuration: Get; + /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; } @@ -156,14 +159,48 @@ impl XcmDeferFilter for Pallet { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - let mut liquidity_per_asset = LiquidityPerAsset::::get(location); - liquidity_per_asset += amount; - - LiquidityPerAsset::::insert(location, liquidity_per_asset); - - //TODO: use config for the limit - if liquidity_per_asset >= 1000 * 1_000_000_000_000 { - return Some(T::DeferDuration::get()); + // let mut liquidity_per_asset = LiquidityPerAsset::::get(location); + // liquidity_per_asset += amount; + + //LiquidityPerAsset::::insert(location, liquidity_per_asset); + + // TODO: use config for the limit + // We need to defer the messages that are above the set limit + // by the ratio of the size of the transaction to the defer duration i.e. + // If the transaction is 10x the limit, we defer it for 10x the defer duration + // If the transaction is 0.5x the limit, we defer it for 0.5x the defer duration + // As such we need to store last transaction size and the last update time + // to calculate the ratio. i.e. + // defer_duration = 10 + + // limit_per_asset = 1000 + + // last_update_time = 0 + // last_filled_volume = ((defer_duration - (current_time - last_update_time)) / defer_duration) * last_filled_volume + + // current_time = 5 + // last_transaction_size = 1000 + // current_transaction_size = 1000 + // volume_left = limit_per_asset - last_filled_volume + // defer_ratio = volume_left / current_transaction_size + // defer_duration = defer_duration * defer_ratio + // last_update_time = current_time + // last_transaction_size = current_transaction_size + // + // last_filled_volume = ((10 - (5 - 0)) / 10) * 1000 = 500 + // volume_left = 1000 - 500 = 500 + // defer_ratio = 500 / 1000 = 0.5 + // defer_duration = 10 * 0.5 = 5 + + + + let limit_per_duration:u128 = 1000 * 1_000_000_000_000; + let defer_duration:u128 = T::DeferDuration::get().into(); + let deferred_by: u128 = (amount - limit_per_duration) / limit_per_duration * defer_duration; + + if amount >= limit_per_duration { + // convert deferred u128 to u32 safely + return Some(deferred_by.try_into().unwrap_or(T::MaxDeferDuration::get())); } } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 076f37264..db08d66da 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -26,6 +26,7 @@ use xcm::lts::prelude::*; use xcm::VersionedXcm; #[test] +#[ignore] fn deferred_by_should_track_incoming_deposited_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { //Arrange @@ -42,6 +43,7 @@ fn deferred_by_should_track_incoming_deposited_asset_liquidity() { } #[test] +#[ignore] fn deferred_by_should_track_incoming_teleported_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { //Arrange @@ -61,7 +63,7 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { fn deferred_by_should_defer_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 1000 * ONE); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 2000 * ONE); let para_id = 999.into(); //Act @@ -69,8 +71,43 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { //Assert let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); - assert_eq!(volume, 1000 * ONE); - assert_eq!(deferred_block_number, Some(::DeferDuration::get())); + assert_eq!(deferred_block_number, Some(10)); + }); +} + +#[test] +fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 3000 * ONE); + let para_id = 999.into(); + + //Act + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + //Assert + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(deferred_block_number, Some(20)); + }); +} + +#[test] +fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 2000 * ONE); + let para_id = 999.into(); + + //Act + let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + // Transaction should be deffered by 10 blocks because it exceeds the limit by 1000 (1x the limit) + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(first_deferred_block_number, Some(10)); + + // Second transaction should be put behind the first one by 20 blocks (2x the limit) + let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + assert_eq!(second_deferred_block_number, Some(30)); }); } diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 579b7b387..c32b32fe7 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -136,7 +136,8 @@ parameter_types! { impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; - type DeferDuration = ConstU32<20>; + type DeferDuration = ConstU32<10>; + type MaxDeferDuration = ConstU32<1000>; type TechnicalOrigin = EnsureRoot; type WeightInfo = (); } From d52784d2359a50539541b871302b0101c0c2502e Mon Sep 17 00:00:00 2001 From: dmoka Date: Tue, 18 Apr 2023 15:58:10 +0200 Subject: [PATCH 13/79] WIP - add calculation for deferred by, based on block time difference --- pallets/xcm-rate-limiter/src/lib.rs | 48 ++++++++++++++----- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 26 +++++++++- pallets/xcm-rate-limiter/src/tests/mock.rs | 3 +- 3 files changed, 61 insertions(+), 16 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index de0e1a249..47da9df76 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -24,14 +24,16 @@ use frame_support::traits::{Contains, EnsureOrigin}; use frame_support::{ensure, pallet_prelude::DispatchResult, traits::Get}; use frame_system::ensure_signed_or_root; use frame_system::pallet_prelude::OriginFor; +use polkadot_core_primitives::BlockNumber; +use polkadot_parachain::primitives::RelayChainBlockNumber; use scale_info::TypeInfo; use sp_core::MaxEncodedLen; +use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug}; use xcm::lts::prelude::*; use xcm::VersionedXcm; use xcm::VersionedXcm::V3; - pub mod weights; #[cfg(any(feature = "runtime-benchmarks", test))] @@ -51,6 +53,7 @@ pub mod pallet { use frame_support::pallet_prelude::*; use frame_support::traits::Contains; use polkadot_parachain::primitives::RelayChainBlockNumber; + use sp_runtime::traits::BlockNumberProvider; use xcm::lts::MultiLocation; #[pallet::hooks] @@ -75,10 +78,12 @@ pub mod pallet { type TechnicalOrigin: EnsureOrigin; #[pallet::constant] - type DeferDuration: Get; + type DeferDuration: Get; #[pallet::constant] - type MaxDeferDuration: Get; + type MaxDeferDuration: Get; + + type BlockNumberProvider: BlockNumberProvider; /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -91,7 +96,8 @@ pub mod pallet { #[pallet::storage] /// TODO: document #[pallet::getter(fn liquidity_per_asset)] - pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, MultiLocation, u128, ValueQuery>; + pub type LiquidityPerAsset = + StorageMap<_, Blake2_128Concat, MultiLocation, (u128, RelayChainBlockNumber), ValueQuery>; #[pallet::storage] /// TODO: document @@ -165,19 +171,19 @@ impl XcmDeferFilter for Pallet { //LiquidityPerAsset::::insert(location, liquidity_per_asset); // TODO: use config for the limit - // We need to defer the messages that are above the set limit + // We need to defer the messages that are above the set limit // by the ratio of the size of the transaction to the defer duration i.e. // If the transaction is 10x the limit, we defer it for 10x the defer duration // If the transaction is 0.5x the limit, we defer it for 0.5x the defer duration // As such we need to store last transaction size and the last update time // to calculate the ratio. i.e. // defer_duration = 10 - + // limit_per_asset = 1000 - + // last_update_time = 0 // last_filled_volume = ((defer_duration - (current_time - last_update_time)) / defer_duration) * last_filled_volume - + // current_time = 5 // last_transaction_size = 1000 // current_transaction_size = 1000 @@ -186,18 +192,34 @@ impl XcmDeferFilter for Pallet { // defer_duration = defer_duration * defer_ratio // last_update_time = current_time // last_transaction_size = current_transaction_size - // + // // last_filled_volume = ((10 - (5 - 0)) / 10) * 1000 = 500 // volume_left = 1000 - 500 = 500 // defer_ratio = 500 / 1000 = 0.5 // defer_duration = 10 * 0.5 = 5 - - - let limit_per_duration:u128 = 1000 * 1_000_000_000_000; - let defer_duration:u128 = T::DeferDuration::get().into(); + let mut liquidity_per_asset = LiquidityPerAsset::::get(location); + + let limit_per_duration: u128 = 1000 * 1_000_000_000_000; + let defer_duration: u128 = T::DeferDuration::get().into(); let deferred_by: u128 = (amount - limit_per_duration) / limit_per_duration * defer_duration; + let current_time = T::BlockNumberProvider::current_block_number(); + let last_update_time = liquidity_per_asset.1; + + let time_difference: u128 = + TryInto::::try_into(current_time - last_update_time.into()).ok()?; + //let b: u128 = defer_duration - a.into(); + + //TODO: CONTINUE FROM HERE - we need to use last_filled_volume instead of amount, maybe + let last_filled_volume: u128 = + (defer_duration - time_difference) * liquidity_per_asset.0 / defer_duration; + + liquidity_per_asset.0 += amount; + liquidity_per_asset.1 = TryInto::::try_into(current_time).ok()?; + + LiquidityPerAsset::::insert(location, liquidity_per_asset); + if amount >= limit_per_duration { // convert deferred u128 to u32 safely return Some(deferred_by.try_into().unwrap_or(T::MaxDeferDuration::get())); diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index db08d66da..1b5a3eaf0 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -25,6 +25,7 @@ use sp_runtime::DispatchError::BadOrigin; use xcm::lts::prelude::*; use xcm::VersionedXcm; +/* #[test] #[ignore] fn deferred_by_should_track_incoming_deposited_asset_liquidity() { @@ -41,7 +42,9 @@ fn deferred_by_should_track_incoming_deposited_asset_liquidity() { assert_eq!(volume, 5); }); } +*/ +/* #[test] #[ignore] fn deferred_by_should_track_incoming_teleported_asset_liquidity() { @@ -58,7 +61,7 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { assert_eq!(volume, 5); }); } - +*/ #[test] fn deferred_by_should_defer_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { @@ -111,6 +114,27 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { }); } +#[test] +fn deferred_by_should_defer_successive_xcm_when_time_passes() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 2000 * ONE); + let para_id = 999.into(); + + //Act + let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + //Assert + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(first_deferred_block_number, Some(10)); + + System::set_block_number(5); + + let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + assert_eq!(second_deferred_block_number, Some(15)); + }); +} + #[test] fn set_limit_per_asset_should_work() { ExtBuilder::default().build().execute_with(|| { diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index c32b32fe7..505b2bd06 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -140,6 +140,7 @@ impl pallet_xcm_rate_limiter::Config for Test { type MaxDeferDuration = ConstU32<1000>; type TechnicalOrigin = EnsureRoot; type WeightInfo = (); + type BlockNumberProvider = System; } pub struct CircuitBreakerWhitelist; @@ -485,8 +486,6 @@ impl ExtBuilder { }); } - r.execute_with(|| System::set_block_number(1)); - r } } From dbe3ad6955722b0959b12e577f72af51486258a8 Mon Sep 17 00:00:00 2001 From: dmoka Date: Wed, 19 Apr 2023 10:44:47 +0200 Subject: [PATCH 14/79] add first implementation for calculatin deferred duration --- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 1b5a3eaf0..87289cf83 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -22,6 +22,7 @@ use cumulus_pallet_xcmp_queue::XcmDeferFilter; use frame_support::assert_storage_noop; pub use pretty_assertions::{assert_eq, assert_ne}; use sp_runtime::DispatchError::BadOrigin; +use sp_runtime::SaturatedConversion; use xcm::lts::prelude::*; use xcm::VersionedXcm; @@ -95,6 +96,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { } #[test] +#[ignore] fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { //Arrange @@ -115,6 +117,7 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { } #[test] +#[ignore] fn deferred_by_should_defer_successive_xcm_when_time_passes() { ExtBuilder::default().build().execute_with(|| { //Arrange @@ -162,6 +165,42 @@ fn set_limit_per_asset_should_fail_when_called_by_non_root() { }); } +#[test] +fn deferred_duration_should_be_calculated_based_on_limit_and_incoming_amounts() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 1500 * ONE; + let accumulated_amount = 400 * ONE; + let blocks_since_last_update = 0; + let duration = calculate_deferred_duration( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(duration, 9); +} + +fn calculate_deferred_duration( + global_duration: BlockNumber, + rate_limit: u128, + incoming_amount: u128, + accumulated_amount: u128, + blocks_since_last_update: BlockNumber, +) -> BlockNumber { + let global_duration: u128 = global_duration.saturated_into(); + + let deferred_duration = global_duration.saturating_mul( + incoming_amount + .saturating_add(accumulated_amount) + .saturating_sub(rate_limit), + ) / rate_limit.max(1); + + deferred_duration.saturated_into() +} + pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ From 47db0b285873b06ead3b3ef40355d8fcb64ee4d2 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 19 Apr 2023 11:26:04 +0200 Subject: [PATCH 15/79] implement decay of accumulated amounts --- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 137 +++++++++++++++++- 1 file changed, 130 insertions(+), 7 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 87289cf83..30f645fcc 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -183,6 +183,96 @@ fn deferred_duration_should_be_calculated_based_on_limit_and_incoming_amounts() assert_eq!(duration, 9); } +#[test] +fn deferred_duration_should_return_zero_when_limit_not_reached() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 900 * ONE; + let accumulated_amount = 0; + let blocks_since_last_update = 0; + let duration = calculate_deferred_duration( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(duration, 0); +} + +#[test] +fn accumulated_amount_for_deferred_duration_should_decay() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 1100 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 12; + let duration = calculate_deferred_duration( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(duration, 1); +} + +#[test] +fn defer_duration_should_incorporate_decay_amounts_and_incoming() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 1100 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 6; + let duration = calculate_deferred_duration( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(duration, 7); +} + +#[test] +fn long_time_since_update_should_reset_rate_limit() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 700 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 20; + let duration = calculate_deferred_duration( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(duration, 0); +} + +#[test] +fn calculate_new_accumulated_amount_should_decay_old_amounts_and_sum() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 700 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 6; + let total_accumulated = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(total_accumulated, 700 * ONE + 600 * ONE); +} + fn calculate_deferred_duration( global_duration: BlockNumber, rate_limit: u128, @@ -190,17 +280,50 @@ fn calculate_deferred_duration( accumulated_amount: u128, blocks_since_last_update: BlockNumber, ) -> BlockNumber { - let global_duration: u128 = global_duration.saturated_into(); - - let deferred_duration = global_duration.saturating_mul( - incoming_amount - .saturating_add(accumulated_amount) - .saturating_sub(rate_limit), - ) / rate_limit.max(1); + let total_accumulated = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + let global_duration: u128 = global_duration.max(1).saturated_into(); + // duration * (incoming + decayed - rate_limit) + let deferred_duration = + global_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); deferred_duration.saturated_into() } +fn calculate_new_accumulated_amount( + global_duration: BlockNumber, + rate_limit: u128, + incoming_amount: u128, + accumulated_amount: u128, + blocks_since_last_update: BlockNumber, +) -> u128 { + incoming_amount.saturating_add(decay( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + )) +} + +fn decay( + global_duration: BlockNumber, + rate_limit: u128, + incoming_amount: u128, + accumulated_amount: u128, + blocks_since_last_update: BlockNumber, +) -> u128 { + let global_duration: u128 = global_duration.max(1).saturated_into(); + // acc - rate_limit * blocks / duration + accumulated_amount + .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / global_duration) +} + pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ From 87d99012434a17b413a0c949cd3f2330f5483237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20P=C3=A1nik?= Date: Wed, 19 Apr 2023 12:10:33 +0200 Subject: [PATCH 16/79] added deferring logic to XCMDeferFilter --- pallets/xcm-rate-limiter/src/lib.rs | 130 +++++++++++------- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 65 ++------- pallets/xcm-rate-limiter/src/tests/mock.rs | 10 +- 3 files changed, 93 insertions(+), 112 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 47da9df76..87214cee2 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -30,7 +30,8 @@ use scale_info::TypeInfo; use sp_core::MaxEncodedLen; use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; -use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug}; +use sp_runtime::SaturatedConversion; +use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug, Saturating}; use xcm::lts::prelude::*; use xcm::VersionedXcm; use xcm::VersionedXcm::V3; @@ -78,10 +79,10 @@ pub mod pallet { type TechnicalOrigin: EnsureOrigin; #[pallet::constant] - type DeferDuration: Get; + type DeferDuration: Get; #[pallet::constant] - type MaxDeferDuration: Get; + type MaxDeferDuration: Get; type BlockNumberProvider: BlockNumberProvider; @@ -97,7 +98,7 @@ pub mod pallet { /// TODO: document #[pallet::getter(fn liquidity_per_asset)] pub type LiquidityPerAsset = - StorageMap<_, Blake2_128Concat, MultiLocation, (u128, RelayChainBlockNumber), ValueQuery>; + StorageMap<_, Blake2_128Concat, MultiLocation, (u128, T::BlockNumber), ValueQuery>; #[pallet::storage] /// TODO: document @@ -142,6 +143,55 @@ fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { } } +pub fn calculate_deferred_duration( + global_duration: BlockNumber, + rate_limit: u128, + incoming_amount: u128, + accumulated_amount: u128, + blocks_since_last_update: BlockNumber, +) -> BlockNumber { + let total_accumulated = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + let global_duration: u128 = global_duration.max(1).saturated_into(); + // duration * (incoming + decayed - rate_limit) + let deferred_duration = + global_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); + + deferred_duration.saturated_into() +} + +pub fn calculate_new_accumulated_amount( + global_duration: BlockNumber, + rate_limit: u128, + incoming_amount: u128, + accumulated_amount: u128, + blocks_since_last_update: BlockNumber, +) -> u128 { + incoming_amount.saturating_add(decay( + global_duration, + rate_limit, + accumulated_amount, + blocks_since_last_update, + )) +} + +pub fn decay( + global_duration: BlockNumber, + rate_limit: u128, + accumulated_amount: u128, + blocks_since_last_update: BlockNumber, +) -> u128 { + let global_duration: u128 = global_duration.max(1).saturated_into(); + // acc - rate_limit * blocks / duration + accumulated_amount + .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / global_duration) +} + impl Pallet { fn get_locations_and_amounts(instruction: &Instruction) -> Vec<(MultiLocation, u128)> { use Instruction::*; @@ -165,64 +215,40 @@ impl XcmDeferFilter for Pallet { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - // let mut liquidity_per_asset = LiquidityPerAsset::::get(location); - // liquidity_per_asset += amount; - - //LiquidityPerAsset::::insert(location, liquidity_per_asset); - - // TODO: use config for the limit - // We need to defer the messages that are above the set limit - // by the ratio of the size of the transaction to the defer duration i.e. - // If the transaction is 10x the limit, we defer it for 10x the defer duration - // If the transaction is 0.5x the limit, we defer it for 0.5x the defer duration - // As such we need to store last transaction size and the last update time - // to calculate the ratio. i.e. - // defer_duration = 10 - - // limit_per_asset = 1000 - - // last_update_time = 0 - // last_filled_volume = ((defer_duration - (current_time - last_update_time)) / defer_duration) * last_filled_volume - - // current_time = 5 - // last_transaction_size = 1000 - // current_transaction_size = 1000 - // volume_left = limit_per_asset - last_filled_volume - // defer_ratio = volume_left / current_transaction_size - // defer_duration = defer_duration * defer_ratio - // last_update_time = current_time - // last_transaction_size = current_transaction_size - // - // last_filled_volume = ((10 - (5 - 0)) / 10) * 1000 = 500 - // volume_left = 1000 - 500 = 500 - // defer_ratio = 500 / 1000 = 0.5 - // defer_duration = 10 * 0.5 = 5 - let mut liquidity_per_asset = LiquidityPerAsset::::get(location); let limit_per_duration: u128 = 1000 * 1_000_000_000_000; - let defer_duration: u128 = T::DeferDuration::get().into(); - let deferred_by: u128 = (amount - limit_per_duration) / limit_per_duration * defer_duration; + let defer_duration = T::DeferDuration::get(); let current_time = T::BlockNumberProvider::current_block_number(); let last_update_time = liquidity_per_asset.1; - let time_difference: u128 = - TryInto::::try_into(current_time - last_update_time.into()).ok()?; - //let b: u128 = defer_duration - a.into(); - - //TODO: CONTINUE FROM HERE - we need to use last_filled_volume instead of amount, maybe - let last_filled_volume: u128 = - (defer_duration - time_difference) * liquidity_per_asset.0 / defer_duration; - - liquidity_per_asset.0 += amount; - liquidity_per_asset.1 = TryInto::::try_into(current_time).ok()?; + let time_difference = current_time.saturating_sub(last_update_time); + + let accumulated_amount = calculate_new_accumulated_amount( + defer_duration.saturated_into(), + limit_per_duration, + amount, + liquidity_per_asset.0, + time_difference.saturated_into(), + ); + let deferred_by = calculate_deferred_duration( + defer_duration.saturated_into(), + limit_per_duration, + amount, + liquidity_per_asset.0, + time_difference.saturated_into(), + ); + + liquidity_per_asset.0 = accumulated_amount; + liquidity_per_asset.1 = current_time; LiquidityPerAsset::::insert(location, liquidity_per_asset); - if amount >= limit_per_duration { - // convert deferred u128 to u32 safely - return Some(deferred_by.try_into().unwrap_or(T::MaxDeferDuration::get())); + if deferred_by > 0 { + return Some(deferred_by); + } else { + return None; } } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 30f645fcc..b4d3553bd 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -96,7 +96,6 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { } #[test] -#[ignore] fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { //Arrange @@ -117,7 +116,6 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { } #[test] -#[ignore] fn deferred_by_should_defer_successive_xcm_when_time_passes() { ExtBuilder::default().build().execute_with(|| { //Arrange @@ -128,13 +126,19 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + + assert_eq!(accumulated_amount, 2000 * ONE); + assert_eq!(last_update, 1); assert_eq!(first_deferred_block_number, Some(10)); - System::set_block_number(5); + System::set_block_number(6); let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - assert_eq!(second_deferred_block_number, Some(15)); + let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + assert_eq!(accumulated_amount, 3500 * ONE); + assert_eq!(last_update, 6); + assert_eq!(second_deferred_block_number, Some(25)); }); } @@ -273,57 +277,6 @@ fn calculate_new_accumulated_amount_should_decay_old_amounts_and_sum() { assert_eq!(total_accumulated, 700 * ONE + 600 * ONE); } -fn calculate_deferred_duration( - global_duration: BlockNumber, - rate_limit: u128, - incoming_amount: u128, - accumulated_amount: u128, - blocks_since_last_update: BlockNumber, -) -> BlockNumber { - let total_accumulated = calculate_new_accumulated_amount( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); - let global_duration: u128 = global_duration.max(1).saturated_into(); - // duration * (incoming + decayed - rate_limit) - let deferred_duration = - global_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); - - deferred_duration.saturated_into() -} - -fn calculate_new_accumulated_amount( - global_duration: BlockNumber, - rate_limit: u128, - incoming_amount: u128, - accumulated_amount: u128, - blocks_since_last_update: BlockNumber, -) -> u128 { - incoming_amount.saturating_add(decay( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - )) -} - -fn decay( - global_duration: BlockNumber, - rate_limit: u128, - incoming_amount: u128, - accumulated_amount: u128, - blocks_since_last_update: BlockNumber, -) -> u128 { - let global_duration: u128 = global_duration.max(1).saturated_into(); - // acc - rate_limit * blocks / duration - accumulated_amount - .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / global_duration) -} - pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 505b2bd06..ec83b2cac 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -24,7 +24,7 @@ use frame_system::EnsureRoot; use hydra_dx_math::omnipool::types::BalanceUpdate; use orml_traits::parameter_type_with_key; use sp_core::H256; -use sp_runtime::traits::{ConstU128, ConstU32}; +use sp_runtime::traits::{ConstU128, ConstU32, ConstU64}; use sp_runtime::DispatchResult; use sp_runtime::FixedU128; use sp_runtime::Permill; @@ -136,11 +136,11 @@ parameter_types! { impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; - type DeferDuration = ConstU32<10>; - type MaxDeferDuration = ConstU32<1000>; + type DeferDuration = ConstU64<10>; + type MaxDeferDuration = ConstU64<1000>; type TechnicalOrigin = EnsureRoot; - type WeightInfo = (); type BlockNumberProvider = System; + type WeightInfo = (); } pub struct CircuitBreakerWhitelist; @@ -486,6 +486,8 @@ impl ExtBuilder { }); } + r.execute_with(|| System::set_block_number(1)); + r } } From 1919aa09b2f935ce81b8d9a7a612b458d702b40b Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 19 Apr 2023 15:11:39 +0200 Subject: [PATCH 17/79] use associated types to get rate limit per asset --- Cargo.lock | 26 +++++++-------- integration-tests/Cargo.toml | 18 +++++------ pallets/circuit-breaker/Cargo.toml | 4 +-- pallets/omnipool-liquidity-mining/Cargo.toml | 6 ++-- pallets/omnipool/Cargo.toml | 2 +- pallets/xcm-rate-limiter/Cargo.toml | 17 ++++++---- pallets/xcm-rate-limiter/src/lib.rs | 11 ++++++- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 32 +++++++++---------- pallets/xcm-rate-limiter/src/tests/mock.rs | 28 ++++++++++++++++ runtime/common/Cargo.toml | 14 ++++---- runtime/hydradx/Cargo.toml | 24 +++++++------- runtime/testing-hydradx/Cargo.toml | 24 +++++++------- 12 files changed, 123 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c8b68449..be6dee802 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3709,7 +3709,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" version = "0.2.3" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-support", "hydradx-traits", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "hydradx-traits" version = "2.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6078,7 +6078,7 @@ dependencies = [ [[package]] name = "pallet-asset-registry" version = "2.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6331,7 +6331,7 @@ dependencies = [ [[package]] name = "pallet-collator-rewards" version = "1.0.4" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-support", "frame-system", @@ -6403,7 +6403,7 @@ dependencies = [ [[package]] name = "pallet-currencies" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-support", "frame-system", @@ -6438,7 +6438,7 @@ dependencies = [ [[package]] name = "pallet-duster" version = "3.2.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6509,7 +6509,7 @@ dependencies = [ [[package]] name = "pallet-ema-oracle" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6639,7 +6639,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining" version = "3.1.0" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-support", "frame-system", @@ -6865,7 +6865,7 @@ dependencies = [ [[package]] name = "pallet-otc" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-benchmarking", "frame-support", @@ -6966,7 +6966,7 @@ dependencies = [ [[package]] name = "pallet-relaychain-info" version = "0.3.3" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -7160,7 +7160,7 @@ dependencies = [ [[package]] name = "pallet-transaction-multi-payment" version = "8.0.5" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-support", "frame-system", @@ -7178,7 +7178,7 @@ dependencies = [ [[package]] name = "pallet-transaction-pause" version = "0.1.3" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-benchmarking", "frame-support", @@ -12628,7 +12628,7 @@ dependencies = [ [[package]] name = "test-utils" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=2eeb98d3d9755dc714cf474bb445a5fdac865352#2eeb98d3d9755dc714cf474bb445a5fdac865352" +source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" dependencies = [ "frame-system", "pretty_assertions", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 8bfeb47e2..68e01d6ff 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -20,14 +20,14 @@ pallet-circuit-breaker = { path = "../pallets/circuit-breaker",default-features pallet-omnipool-liquidity-mining = { path = "../pallets/omnipool-liquidity-mining", default-features = true} # HydraDX dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-duster = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-duster = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } @@ -110,7 +110,7 @@ polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "r [dev-dependencies] hex-literal = "0.3.1" pretty_assertions = "1.2.1" -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352" } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1" } xcm-emulator = { git = "https://github.com/shaunxw/xcm-simulator", rev = "754f3b90ecc65af735a6c9a2e1792c5253926ff6" } [features] diff --git a/pallets/circuit-breaker/Cargo.toml b/pallets/circuit-breaker/Cargo.toml index 45996ca0a..31803d26e 100644 --- a/pallets/circuit-breaker/Cargo.toml +++ b/pallets/circuit-breaker/Cargo.toml @@ -28,14 +28,14 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot- pallet-omnipool = { path = "../omnipool", default-features = false } # Warehouse -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } [dev-dependencies] pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } -test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } pretty_assertions = "1.2.1" test-case = "3.0.0" diff --git a/pallets/omnipool-liquidity-mining/Cargo.toml b/pallets/omnipool-liquidity-mining/Cargo.toml index ad7189dfe..3cf0f7395 100644 --- a/pallets/omnipool-liquidity-mining/Cargo.toml +++ b/pallets/omnipool-liquidity-mining/Cargo.toml @@ -32,8 +32,8 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "polk orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # Warehouse -pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } @@ -53,7 +53,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot- orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } proptest = "1.0.0" pretty_assertions = "1.2.1" -test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } [features] default = ["std"] diff --git a/pallets/omnipool/Cargo.toml b/pallets/omnipool/Cargo.toml index e0315107e..a0b587994 100644 --- a/pallets/omnipool/Cargo.toml +++ b/pallets/omnipool/Cargo.toml @@ -29,7 +29,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "polk orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # Warehouse -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index e65f6dcc1..14f3d02fa 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -17,7 +17,7 @@ codec = { default-features = false, features = ["derive"], package = "parity-sca scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } # Substrate dependencies -frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false , optional = true} +frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false, optional = true} frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } @@ -25,25 +25,27 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } -#Polkadot +# Polkadot xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.38" } polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.38" } polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.38" } # Cumulus -cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus.git" , branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } +cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus.git", branch = "feat/xcmp-defer-xcm-v9-38", default-features = false } pallet-omnipool = { path = "../omnipool", default-features = false } # Warehouse -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } + +# orml +orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } [dev-dependencies] pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } -orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } -test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } pretty_assertions = "1.2.1" test-case = "3.0.0" @@ -55,7 +57,8 @@ std = [ 'frame-system/std', 'serde/std', 'scale-info/std', - 'cumulus-pallet-xcmp-queue/std' + 'cumulus-pallet-xcmp-queue/std', + 'orml-traits/std', ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 87214cee2..04fa497d4 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -24,11 +24,13 @@ use frame_support::traits::{Contains, EnsureOrigin}; use frame_support::{ensure, pallet_prelude::DispatchResult, traits::Get}; use frame_system::ensure_signed_or_root; use frame_system::pallet_prelude::OriginFor; +use orml_traits::GetByKey; use polkadot_core_primitives::BlockNumber; use polkadot_parachain::primitives::RelayChainBlockNumber; use scale_info::TypeInfo; use sp_core::MaxEncodedLen; use sp_runtime::traits::BlockNumberProvider; +use sp_runtime::traits::Convert; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; use sp_runtime::SaturatedConversion; use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug, Saturating}; @@ -81,11 +83,17 @@ pub mod pallet { #[pallet::constant] type DeferDuration: Get; + // TODO: implement or remove #[pallet::constant] type MaxDeferDuration: Get; type BlockNumberProvider: BlockNumberProvider; + type CurrencyIdConvert: Convert>; + + // TODO: Which type to use to define the rate limit here? + type RateLimitFor: GetByKey>; + /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; } @@ -217,7 +225,8 @@ impl XcmDeferFilter for Pallet { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { let mut liquidity_per_asset = LiquidityPerAsset::::get(location); - let limit_per_duration: u128 = 1000 * 1_000_000_000_000; + let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; + let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; let defer_duration = T::DeferDuration::get(); let current_time = T::BlockNumberProvider::current_block_number(); diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index b4d3553bd..b351c6476 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -32,14 +32,14 @@ use xcm::VersionedXcm; fn deferred_by_should_track_incoming_deposited_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 5); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 5); let para_id = 999.into(); //Act XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -51,14 +51,14 @@ fn deferred_by_should_track_incoming_deposited_asset_liquidity() { fn deferred_by_should_track_incoming_teleported_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_receive_teleported_asset(MultiLocation::parent(), 5); + let versioned_xcm = create_versioned_receive_teleported_asset(MultiLocation::here(), 5); let para_id = 999.into(); //Act XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -67,14 +67,14 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { fn deferred_by_should_defer_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 2000 * ONE); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 2000 * ONE); let para_id = 999.into(); //Act let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(deferred_block_number, Some(10)); }); } @@ -83,14 +83,14 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 3000 * ONE); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 3000 * ONE); let para_id = 999.into(); //Act let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(deferred_block_number, Some(20)); }); } @@ -99,14 +99,14 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 2000 * ONE); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 2000 * ONE); let para_id = 999.into(); //Act let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); // Transaction should be deffered by 10 blocks because it exceeds the limit by 1000 (1x the limit) - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(first_deferred_block_number, Some(10)); // Second transaction should be put behind the first one by 20 blocks (2x the limit) @@ -119,14 +119,14 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { fn deferred_by_should_defer_successive_xcm_when_time_passes() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::parent(), 2000 * ONE); + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 2000 * ONE); let para_id = 999.into(); //Act let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(accumulated_amount, 2000 * ONE); assert_eq!(last_update, 1); @@ -135,7 +135,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { System::set_block_number(6); let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::parent()); + let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); assert_eq!(accumulated_amount, 3500 * ONE); assert_eq!(last_update, 6); assert_eq!(second_deferred_block_number, Some(25)); @@ -148,12 +148,12 @@ fn set_limit_per_asset_should_work() { //Act assert_ok!(XcmRateLimiter::set_limit( RuntimeOrigin::root(), - MultiLocation::parent(), + MultiLocation::here(), 1000 * ONE )); //Assert - let limit = XcmRateLimiter::rate_limit(MultiLocation::parent()); + let limit = XcmRateLimiter::rate_limit(MultiLocation::here()); assert_eq!(limit, Some(1000 * ONE)); }); } @@ -163,7 +163,7 @@ fn set_limit_per_asset_should_fail_when_called_by_non_root() { ExtBuilder::default().build().execute_with(|| { //Act assert_noop!( - XcmRateLimiter::set_limit(RuntimeOrigin::signed(ALICE), MultiLocation::parent(), 1000 * ONE), + XcmRateLimiter::set_limit(RuntimeOrigin::signed(ALICE), MultiLocation::here(), 1000 * ONE), BadOrigin ); }); diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index ec83b2cac..ffba76a82 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -24,6 +24,7 @@ use frame_system::EnsureRoot; use hydra_dx_math::omnipool::types::BalanceUpdate; use orml_traits::parameter_type_with_key; use sp_core::H256; +use sp_runtime::traits::Convert; use sp_runtime::traits::{ConstU128, ConstU32, ConstU64}; use sp_runtime::DispatchResult; use sp_runtime::FixedU128; @@ -36,6 +37,8 @@ use sp_runtime::{ use std::cell::RefCell; use std::collections::HashMap; use std::marker::PhantomData; +use xcm::lts::prelude::*; + type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -133,6 +136,17 @@ parameter_types! { pub const OmnipoolHubAsset: AssetId = LRNA; } +pub struct ConvertIdMock; +impl Convert> for ConvertIdMock { + fn convert(location: MultiLocation) -> Option { + if location == MultiLocation::here() { + Some(HDX) + } else { + None + } + } +} + impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; @@ -140,6 +154,8 @@ impl pallet_xcm_rate_limiter::Config for Test { type MaxDeferDuration = ConstU64<1000>; type TechnicalOrigin = EnsureRoot; type BlockNumberProvider = System; + type RateLimitFor = XcmRateLimitFor; + type CurrencyIdConvert = ConvertIdMock; type WeightInfo = (); } @@ -168,6 +184,18 @@ parameter_type_with_key! { 0 }; } +parameter_type_with_key! { + pub XcmRateLimitFor: |asset_id: AssetId| -> Option { + match *asset_id { + HDX => Some(1000 * ONE), + DOT => Some(1000 * ONE), + DAI => Some(1000 * ONE), + LRNA => Some(1000 * ONE), + ACA => Some(1000 * ONE), + _ => None + } + }; +} impl orml_tokens::Config for Test { type RuntimeEvent = RuntimeEvent; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 44687cca6..0a951e2e8 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -20,7 +20,7 @@ pallet-omnipool = {path = '../../pallets/omnipool', default-features = false} pallet-circuit-breaker = {path = '../../pallets/circuit-breaker', default-features = false} hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } # Substrate dependencies sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } @@ -42,12 +42,12 @@ pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = " pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } pallet-claims = { path = '../../pallets/claims', default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index cce26f0d6..7daffcca6 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -50,18 +50,18 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # Warehouse dependencies -hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } # ORML dependencies orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } diff --git a/runtime/testing-hydradx/Cargo.toml b/runtime/testing-hydradx/Cargo.toml index 41e47cbce..e55f59a9c 100644 --- a/runtime/testing-hydradx/Cargo.toml +++ b/runtime/testing-hydradx/Cargo.toml @@ -51,18 +51,18 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # Warehouse dependencies -hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false} -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "2eeb98d3d9755dc714cf474bb445a5fdac865352", default-features = false } +hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } # ORML dependencies orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } From baa873dcd3628b0e3eda26d1ad7c8f2a0f9b9cf0 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 19 Apr 2023 15:29:45 +0200 Subject: [PATCH 18/79] add notes and todos + slight refactor --- pallets/xcm-rate-limiter/src/lib.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 04fa497d4..cc60659a4 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -80,6 +80,7 @@ pub mod pallet { type TechnicalOrigin: EnsureOrigin; + // TODO: document #[pallet::constant] type DeferDuration: Get; @@ -116,6 +117,7 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] pub enum Event { + // TODO: remove? Event1 {}, } @@ -123,12 +125,13 @@ pub mod pallet { #[cfg_attr(test, derive(PartialEq, Eq))] pub enum Error { /// Invalid value for a limit. Limit must be non-zero. + // TODO: remove? Error1, } #[pallet::call] impl Pallet { - /// TODO: document + // TODO: document // TODO: benchmark #[pallet::call_index(0)] #[pallet::weight(::WeightInfo::set_trade_volume_limit())] @@ -151,6 +154,7 @@ fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { } } +// TODO: pull out into hdx-math pub fn calculate_deferred_duration( global_duration: BlockNumber, rate_limit: u128, @@ -204,6 +208,7 @@ impl Pallet { fn get_locations_and_amounts(instruction: &Instruction) -> Vec<(MultiLocation, u128)> { use Instruction::*; match instruction { + // NOTE: This does not address the native asset "coming back" from other chains. ReserveAssetDeposited(multi_assets) | ReceiveTeleportedAsset(multi_assets) => multi_assets .inner() .iter() @@ -223,36 +228,32 @@ impl XcmDeferFilter for Pallet { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - let mut liquidity_per_asset = LiquidityPerAsset::::get(location); + let (old_accumulated, last_update_time) = LiquidityPerAsset::::get(location); let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; let defer_duration = T::DeferDuration::get(); let current_time = T::BlockNumberProvider::current_block_number(); - let last_update_time = liquidity_per_asset.1; - let time_difference = current_time.saturating_sub(last_update_time); let accumulated_amount = calculate_new_accumulated_amount( defer_duration.saturated_into(), limit_per_duration, amount, - liquidity_per_asset.0, + old_accumulated, time_difference.saturated_into(), ); + // TODO: avoid redoing computation? let deferred_by = calculate_deferred_duration( defer_duration.saturated_into(), limit_per_duration, amount, - liquidity_per_asset.0, + old_accumulated, time_difference.saturated_into(), ); - liquidity_per_asset.0 = accumulated_amount; - liquidity_per_asset.1 = current_time; - - LiquidityPerAsset::::insert(location, liquidity_per_asset); + LiquidityPerAsset::::insert(location, (accumulated_amount, current_time)); if deferred_by > 0 { return Some(deferred_by); From 40339efc833424b8a95a3b15b07632fe31320b53 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 11:06:40 +0200 Subject: [PATCH 19/79] add todo --- pallets/xcm-rate-limiter/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index cc60659a4..1d226fbff 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -105,6 +105,7 @@ pub mod pallet { #[pallet::storage] /// TODO: document + /// TODO: Use better naming and possible a struct for the value - LiquidtyAccumulation?! #[pallet::getter(fn liquidity_per_asset)] pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, MultiLocation, (u128, T::BlockNumber), ValueQuery>; From 0209bedbb323592d6c433caecdf1214331f1aead Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 11:09:02 +0200 Subject: [PATCH 20/79] remove rate limits managing as the rate limits are stored in asset registry --- pallets/xcm-rate-limiter/src/lib.rs | 18 +------------ .../xcm-rate-limiter/src/tests/defer_xcm.rs | 27 ------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 1d226fbff..3c5007fd0 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -110,11 +110,6 @@ pub mod pallet { pub type LiquidityPerAsset = StorageMap<_, Blake2_128Concat, MultiLocation, (u128, T::BlockNumber), ValueQuery>; - #[pallet::storage] - /// TODO: document - #[pallet::getter(fn rate_limit)] - pub type RateLimits = StorageMap<_, Blake2_128Concat, MultiLocation, u128, OptionQuery>; - #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] pub enum Event { @@ -131,18 +126,7 @@ pub mod pallet { } #[pallet::call] - impl Pallet { - // TODO: document - // TODO: benchmark - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::set_trade_volume_limit())] - pub fn set_limit(origin: OriginFor, multi_location: MultiLocation, limit: u128) -> DispatchResult { - T::TechnicalOrigin::ensure_origin(origin)?; - - RateLimits::::insert(multi_location, limit); - Ok(()) - } - } + impl Pallet {} } fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index b351c6476..695bcc497 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -142,33 +142,6 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { }); } -#[test] -fn set_limit_per_asset_should_work() { - ExtBuilder::default().build().execute_with(|| { - //Act - assert_ok!(XcmRateLimiter::set_limit( - RuntimeOrigin::root(), - MultiLocation::here(), - 1000 * ONE - )); - - //Assert - let limit = XcmRateLimiter::rate_limit(MultiLocation::here()); - assert_eq!(limit, Some(1000 * ONE)); - }); -} - -#[test] -fn set_limit_per_asset_should_fail_when_called_by_non_root() { - ExtBuilder::default().build().execute_with(|| { - //Act - assert_noop!( - XcmRateLimiter::set_limit(RuntimeOrigin::signed(ALICE), MultiLocation::here(), 1000 * ONE), - BadOrigin - ); - }); -} - #[test] fn deferred_duration_should_be_calculated_based_on_limit_and_incoming_amounts() { let global_duration = 10; From 7fdd1884fe037b7b8ed837145fda6f4f1af1e897 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 11:09:50 +0200 Subject: [PATCH 21/79] remove unused events and error specs --- pallets/xcm-rate-limiter/src/lib.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 3c5007fd0..b54bc841a 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -112,18 +112,11 @@ pub mod pallet { #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] - pub enum Event { - // TODO: remove? - Event1 {}, - } + pub enum Event {} #[pallet::error] #[cfg_attr(test, derive(PartialEq, Eq))] - pub enum Error { - /// Invalid value for a limit. Limit must be non-zero. - // TODO: remove? - Error1, - } + pub enum Error {} #[pallet::call] impl Pallet {} From 12d0dd3962dc4dc454562cf226ff291458d5e2fe Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 11:10:47 +0200 Subject: [PATCH 22/79] add doc for storage --- pallets/xcm-rate-limiter/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index b54bc841a..42805846a 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -104,7 +104,7 @@ pub mod pallet { pub struct Pallet(_); #[pallet::storage] - /// TODO: document + /// Accumulated liquidity and last update time per asset /// TODO: Use better naming and possible a struct for the value - LiquidtyAccumulation?! #[pallet::getter(fn liquidity_per_asset)] pub type LiquidityPerAsset = From fe0b7ad39729399993598b2ba1d6c681e3cbbe97 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 11:29:05 +0200 Subject: [PATCH 23/79] add dedicated type for storing accumulated liquidity --- pallets/xcm-rate-limiter/src/lib.rs | 31 +++++++++++++------ .../xcm-rate-limiter/src/tests/defer_xcm.rs | 22 ++++++------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 42805846a..4b6cc44d7 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -49,6 +49,12 @@ mod tests; pub use pallet::*; pub use weights::WeightInfo; +#[derive(Clone, Default, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo, Eq, PartialEq)] +pub struct AccumulatedLiquidity { + pub amount: u128, + pub last_updated: BlockNumber, +} + #[frame_support::pallet] pub mod pallet { use super::*; @@ -105,10 +111,9 @@ pub mod pallet { #[pallet::storage] /// Accumulated liquidity and last update time per asset - /// TODO: Use better naming and possible a struct for the value - LiquidtyAccumulation?! - #[pallet::getter(fn liquidity_per_asset)] - pub type LiquidityPerAsset = - StorageMap<_, Blake2_128Concat, MultiLocation, (u128, T::BlockNumber), ValueQuery>; + #[pallet::getter(fn accumulated_liquidity_per_asset)] + pub type AccumulatedLiquidityPerAsset = + StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedLiquidity, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] @@ -206,20 +211,20 @@ impl XcmDeferFilter for Pallet { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - let (old_accumulated, last_update_time) = LiquidityPerAsset::::get(location); + let accumulated_liquidity = AccumulatedLiquidityPerAsset::::get(location); let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; let defer_duration = T::DeferDuration::get(); let current_time = T::BlockNumberProvider::current_block_number(); - let time_difference = current_time.saturating_sub(last_update_time); + let time_difference = current_time.saturating_sub(accumulated_liquidity.last_updated); - let accumulated_amount = calculate_new_accumulated_amount( + let new_accumulated_amount = calculate_new_accumulated_amount( defer_duration.saturated_into(), limit_per_duration, amount, - old_accumulated, + accumulated_liquidity.amount, time_difference.saturated_into(), ); // TODO: avoid redoing computation? @@ -227,11 +232,17 @@ impl XcmDeferFilter for Pallet { defer_duration.saturated_into(), limit_per_duration, amount, - old_accumulated, + accumulated_liquidity.amount, time_difference.saturated_into(), ); - LiquidityPerAsset::::insert(location, (accumulated_amount, current_time)); + AccumulatedLiquidityPerAsset::::insert( + location, + AccumulatedLiquidity { + amount: new_accumulated_amount, + last_updated: current_time, + }, + ); if deferred_by > 0 { return Some(deferred_by); diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 695bcc497..28d9cd74d 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -39,7 +39,7 @@ fn deferred_by_should_track_incoming_deposited_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -58,7 +58,7 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -74,7 +74,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); assert_eq!(deferred_block_number, Some(10)); }); } @@ -90,7 +90,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); assert_eq!(deferred_block_number, Some(20)); }); } @@ -106,7 +106,7 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); // Transaction should be deffered by 10 blocks because it exceeds the limit by 1000 (1x the limit) - let volume = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); assert_eq!(first_deferred_block_number, Some(10)); // Second transaction should be put behind the first one by 20 blocks (2x the limit) @@ -126,18 +126,18 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); + let accumulated_liquidity = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); - assert_eq!(accumulated_amount, 2000 * ONE); - assert_eq!(last_update, 1); + assert_eq!(accumulated_liquidity.amount, 2000 * ONE); + assert_eq!(accumulated_liquidity.last_updated, 1); assert_eq!(first_deferred_block_number, Some(10)); System::set_block_number(6); let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - let (accumulated_amount, last_update) = XcmRateLimiter::liquidity_per_asset(MultiLocation::here()); - assert_eq!(accumulated_amount, 3500 * ONE); - assert_eq!(last_update, 6); + let accumulated_liquidity = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + assert_eq!(accumulated_liquidity.amount, 3500 * ONE); + assert_eq!(accumulated_liquidity.last_updated, 6); assert_eq!(second_deferred_block_number, Some(25)); }); } From 56949fb885e37990b8ad37eaa77fd572de7dcbdd Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 11:35:39 +0200 Subject: [PATCH 24/79] add missing doc --- pallets/xcm-rate-limiter/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 4b6cc44d7..13d72ca70 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -86,7 +86,7 @@ pub mod pallet { type TechnicalOrigin: EnsureOrigin; - // TODO: document + /// Defer duration base to be used for calculating the specific defer duration for any asset #[pallet::constant] type DeferDuration: Get; From d0f86da64aa7ba446a6e02fb75f5836fe2303c91 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 13:59:28 +0200 Subject: [PATCH 25/79] renaming --- pallets/xcm-rate-limiter/src/lib.rs | 17 +++++++++-------- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 14 +++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 13d72ca70..19b4dc36f 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -50,7 +50,7 @@ pub use pallet::*; pub use weights::WeightInfo; #[derive(Clone, Default, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo, Eq, PartialEq)] -pub struct AccumulatedLiquidity { +pub struct AccumulatedDeferredAmount { pub amount: u128, pub last_updated: BlockNumber, } @@ -110,10 +110,10 @@ pub mod pallet { pub struct Pallet(_); #[pallet::storage] - /// Accumulated liquidity and last update time per asset - #[pallet::getter(fn accumulated_liquidity_per_asset)] - pub type AccumulatedLiquidityPerAsset = - StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedLiquidity, ValueQuery>; + /// Accumulated deferred amounts for each asset + #[pallet::getter(fn accumulated_deferred_amount)] + pub type AccumulatedDeferredAmounts = + StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedDeferredAmount, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] @@ -202,6 +202,7 @@ impl Pallet { } } +//TODO: what to do with para and snet at? impl XcmDeferFilter for Pallet { fn deferred_by( para: polkadot_parachain::primitives::Id, @@ -211,7 +212,7 @@ impl XcmDeferFilter for Pallet { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - let accumulated_liquidity = AccumulatedLiquidityPerAsset::::get(location); + let accumulated_liquidity = AccumulatedDeferredAmounts::::get(location); let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; @@ -236,9 +237,9 @@ impl XcmDeferFilter for Pallet { time_difference.saturated_into(), ); - AccumulatedLiquidityPerAsset::::insert( + AccumulatedDeferredAmounts::::insert( location, - AccumulatedLiquidity { + AccumulatedDeferredAmount { amount: new_accumulated_amount, last_updated: current_time, }, diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 28d9cd74d..9040a96d5 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -39,7 +39,7 @@ fn deferred_by_should_track_incoming_deposited_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -58,7 +58,7 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -74,7 +74,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(deferred_block_number, Some(10)); }); } @@ -90,7 +90,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(deferred_block_number, Some(20)); }); } @@ -106,7 +106,7 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); // Transaction should be deffered by 10 blocks because it exceeds the limit by 1000 (1x the limit) - let volume = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(first_deferred_block_number, Some(10)); // Second transaction should be put behind the first one by 20 blocks (2x the limit) @@ -126,7 +126,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let accumulated_liquidity = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let accumulated_liquidity = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(accumulated_liquidity.amount, 2000 * ONE); assert_eq!(accumulated_liquidity.last_updated, 1); @@ -135,7 +135,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { System::set_block_number(6); let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - let accumulated_liquidity = XcmRateLimiter::accumulated_liquidity_per_asset(MultiLocation::here()); + let accumulated_liquidity = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); assert_eq!(accumulated_liquidity.amount, 3500 * ONE); assert_eq!(accumulated_liquidity.last_updated, 6); assert_eq!(second_deferred_block_number, Some(25)); From d60f624472aa402dd75e8a94be17aefbd4d01561 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 14:02:05 +0200 Subject: [PATCH 26/79] renaming --- pallets/xcm-rate-limiter/src/lib.rs | 16 ++++++++-------- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 16 +++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 19b4dc36f..7a8b21fa7 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -50,7 +50,7 @@ pub use pallet::*; pub use weights::WeightInfo; #[derive(Clone, Default, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo, Eq, PartialEq)] -pub struct AccumulatedDeferredAmount { +pub struct AccumulatedAmount { pub amount: u128, pub last_updated: BlockNumber, } @@ -110,10 +110,10 @@ pub mod pallet { pub struct Pallet(_); #[pallet::storage] - /// Accumulated deferred amounts for each asset - #[pallet::getter(fn accumulated_deferred_amount)] - pub type AccumulatedDeferredAmounts = - StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedDeferredAmount, ValueQuery>; + /// Accumulated amounts for each asset + #[pallet::getter(fn accumulated_amount)] + pub type AccumulatedAmounts = + StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedAmount, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] @@ -212,7 +212,7 @@ impl XcmDeferFilter for Pallet { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - let accumulated_liquidity = AccumulatedDeferredAmounts::::get(location); + let accumulated_liquidity = AccumulatedAmounts::::get(location); let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; @@ -237,9 +237,9 @@ impl XcmDeferFilter for Pallet { time_difference.saturated_into(), ); - AccumulatedDeferredAmounts::::insert( + AccumulatedAmounts::::insert( location, - AccumulatedDeferredAmount { + AccumulatedAmount { amount: new_accumulated_amount, last_updated: current_time, }, diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 9040a96d5..331ea9122 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -39,7 +39,7 @@ fn deferred_by_should_track_incoming_deposited_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -58,7 +58,7 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(volume, 5); }); } @@ -74,7 +74,9 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let deferred_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(deferred_amount.amount, 2000 * ONE); + assert_eq!(deferred_amount.last_updated, 1); assert_eq!(deferred_block_number, Some(10)); }); } @@ -90,7 +92,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(deferred_block_number, Some(20)); }); } @@ -106,7 +108,7 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); // Transaction should be deffered by 10 blocks because it exceeds the limit by 1000 (1x the limit) - let volume = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(first_deferred_block_number, Some(10)); // Second transaction should be put behind the first one by 20 blocks (2x the limit) @@ -126,7 +128,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let accumulated_liquidity = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let accumulated_liquidity = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(accumulated_liquidity.amount, 2000 * ONE); assert_eq!(accumulated_liquidity.last_updated, 1); @@ -135,7 +137,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { System::set_block_number(6); let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - let accumulated_liquidity = XcmRateLimiter::accumulated_deferred_amount(MultiLocation::here()); + let accumulated_liquidity = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(accumulated_liquidity.amount, 3500 * ONE); assert_eq!(accumulated_liquidity.last_updated, 6); assert_eq!(second_deferred_block_number, Some(25)); From 783c545b915853f341cba77b52ccdb51bc255471 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 14:04:20 +0200 Subject: [PATCH 27/79] add missing assertions --- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 331ea9122..acc4ac095 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -74,9 +74,9 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let deferred_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); - assert_eq!(deferred_amount.amount, 2000 * ONE); - assert_eq!(deferred_amount.last_updated, 1); + let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_amount.amount, 2000 * ONE); + assert_eq!(accumulated_amount.last_updated, 1); assert_eq!(deferred_block_number, Some(10)); }); } @@ -92,7 +92,9 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_amount.amount, 3000 * ONE); + assert_eq!(accumulated_amount.last_updated, 1); assert_eq!(deferred_block_number, Some(20)); }); } @@ -107,12 +109,17 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { //Act let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - // Transaction should be deffered by 10 blocks because it exceeds the limit by 1000 (1x the limit) - let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + // Transaction should be deferred by 10 blocks because it exceeds the limit by 1000 (1x the limit) + let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_amount.amount, 2000 * ONE); + assert_eq!(accumulated_amount.last_updated, 1); assert_eq!(first_deferred_block_number, Some(10)); // Second transaction should be put behind the first one by 20 blocks (2x the limit) let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_amount.amount, 4000 * ONE); + assert_eq!(accumulated_amount.last_updated, 1); assert_eq!(second_deferred_block_number, Some(30)); }); } From db2da9c438bc45944cfebf8417b720450cb38b12 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 14:06:22 +0200 Subject: [PATCH 28/79] ignore not used params --- pallets/xcm-rate-limiter/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 7a8b21fa7..a489cb64a 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -202,11 +202,10 @@ impl Pallet { } } -//TODO: what to do with para and snet at? impl XcmDeferFilter for Pallet { fn deferred_by( - para: polkadot_parachain::primitives::Id, - sent_at: polkadot_core_primitives::BlockNumber, + _para: polkadot_parachain::primitives::Id, + _sent_at: polkadot_core_primitives::BlockNumber, xcm: &VersionedXcm, ) -> Option { if let V3(xcm) = xcm { From d3ac7b15ed8cadfe0b2edefdca46448da8f77bea Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 14:19:34 +0200 Subject: [PATCH 29/79] avoid redoing computation when calculating deferred duration --- pallets/xcm-rate-limiter/src/lib.rs | 19 +++-------- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 33 +++++++------------ 2 files changed, 15 insertions(+), 37 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index a489cb64a..1276af712 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -137,21 +137,12 @@ fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { } } -// TODO: pull out into hdx-math +// TODO: pull out into hdx-math + add property based tests pub fn calculate_deferred_duration( global_duration: BlockNumber, rate_limit: u128, - incoming_amount: u128, - accumulated_amount: u128, - blocks_since_last_update: BlockNumber, + total_accumulated: u128, ) -> BlockNumber { - let total_accumulated = calculate_new_accumulated_amount( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); let global_duration: u128 = global_duration.max(1).saturated_into(); // duration * (incoming + decayed - rate_limit) let deferred_duration = @@ -227,13 +218,11 @@ impl XcmDeferFilter for Pallet { accumulated_liquidity.amount, time_difference.saturated_into(), ); - // TODO: avoid redoing computation? + let deferred_by = calculate_deferred_duration( defer_duration.saturated_into(), limit_per_duration, - amount, - accumulated_liquidity.amount, - time_difference.saturated_into(), + new_accumulated_amount, ); AccumulatedAmounts::::insert( diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index acc4ac095..bf936b06f 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -157,14 +157,8 @@ fn deferred_duration_should_be_calculated_based_on_limit_and_incoming_amounts() let rate_limit = 1000 * ONE; let incoming_amount = 1500 * ONE; let accumulated_amount = 400 * ONE; - let blocks_since_last_update = 0; - let duration = calculate_deferred_duration( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); + let total_accumulated_amount = accumulated_amount + incoming_amount; + let duration = calculate_deferred_duration(global_duration, rate_limit, total_accumulated_amount); assert_eq!(duration, 9); } @@ -175,14 +169,9 @@ fn deferred_duration_should_return_zero_when_limit_not_reached() { let rate_limit = 1000 * ONE; let incoming_amount = 900 * ONE; let accumulated_amount = 0; - let blocks_since_last_update = 0; - let duration = calculate_deferred_duration( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); + let total_accumulated_amount = accumulated_amount + incoming_amount; + + let duration = calculate_deferred_duration(global_duration, rate_limit, total_accumulated_amount); assert_eq!(duration, 0); } @@ -194,7 +183,7 @@ fn accumulated_amount_for_deferred_duration_should_decay() { let incoming_amount = 1100 * ONE; let accumulated_amount = 1200 * ONE; let blocks_since_last_update = 12; - let duration = calculate_deferred_duration( + let accumulated_amount = calculate_new_accumulated_amount( global_duration, rate_limit, incoming_amount, @@ -202,7 +191,7 @@ fn accumulated_amount_for_deferred_duration_should_decay() { blocks_since_last_update, ); - assert_eq!(duration, 1); + assert_eq!(accumulated_amount, 1100 * ONE); } #[test] @@ -212,7 +201,7 @@ fn defer_duration_should_incorporate_decay_amounts_and_incoming() { let incoming_amount = 1100 * ONE; let accumulated_amount = 1200 * ONE; let blocks_since_last_update = 6; - let duration = calculate_deferred_duration( + let accumulated_amount = calculate_new_accumulated_amount( global_duration, rate_limit, incoming_amount, @@ -220,7 +209,7 @@ fn defer_duration_should_incorporate_decay_amounts_and_incoming() { blocks_since_last_update, ); - assert_eq!(duration, 7); + assert_eq!(accumulated_amount, 1700 * ONE); } #[test] @@ -230,7 +219,7 @@ fn long_time_since_update_should_reset_rate_limit() { let incoming_amount = 700 * ONE; let accumulated_amount = 1200 * ONE; let blocks_since_last_update = 20; - let duration = calculate_deferred_duration( + let accumulated_amount = calculate_new_accumulated_amount( global_duration, rate_limit, incoming_amount, @@ -238,7 +227,7 @@ fn long_time_since_update_should_reset_rate_limit() { blocks_since_last_update, ); - assert_eq!(duration, 0); + assert_eq!(accumulated_amount, 700 * ONE); } #[test] From 0c1fb6727c8bc40b9377f44f3a58db0de603001e Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 14:40:42 +0200 Subject: [PATCH 30/79] implement MaxDeferDuration --- pallets/xcm-rate-limiter/src/lib.rs | 2 +- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 15 +++++++++++++++ pallets/xcm-rate-limiter/src/tests/mock.rs | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 1276af712..c312afead 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -234,7 +234,7 @@ impl XcmDeferFilter for Pallet { ); if deferred_by > 0 { - return Some(deferred_by); + return Some(deferred_by.min(T::MaxDeferDuration::get().saturated_into())); } else { return None; } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index bf936b06f..b42e72a04 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -124,6 +124,21 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { }); } +#[test] +fn deferred_by_should_defer_by_max_duration_when_it_is_reached() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 20_000 * ONE); + let para_id = 999.into(); + + //Act + let deferred_by: u64 = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).unwrap().into(); + let max_defer: u64 = ::MaxDeferDuration::get(); + //Assert + assert_eq!(deferred_by, max_defer); + }); +} + #[test] fn deferred_by_should_defer_successive_xcm_when_time_passes() { ExtBuilder::default().build().execute_with(|| { diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index ffba76a82..e3b2ee22c 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -151,7 +151,7 @@ impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; type DeferDuration = ConstU64<10>; - type MaxDeferDuration = ConstU64<1000>; + type MaxDeferDuration = ConstU64<100>; type TechnicalOrigin = EnsureRoot; type BlockNumberProvider = System; type RateLimitFor = XcmRateLimitFor; From bc37735c6a5b803030ab8fafb7fe872a442ac983 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 15:04:46 +0200 Subject: [PATCH 31/79] use RelayChainBlockNumber for durations everywhere --- pallets/xcm-rate-limiter/src/lib.rs | 41 ++++++++----------- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 4 +- pallets/xcm-rate-limiter/src/tests/mock.rs | 19 +++++++-- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index c312afead..9b7dfd534 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -25,7 +25,6 @@ use frame_support::{ensure, pallet_prelude::DispatchResult, traits::Get}; use frame_system::ensure_signed_or_root; use frame_system::pallet_prelude::OriginFor; use orml_traits::GetByKey; -use polkadot_core_primitives::BlockNumber; use polkadot_parachain::primitives::RelayChainBlockNumber; use scale_info::TypeInfo; use sp_core::MaxEncodedLen; @@ -37,6 +36,7 @@ use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug, Saturating}; use xcm::lts::prelude::*; use xcm::VersionedXcm; use xcm::VersionedXcm::V3; + pub mod weights; #[cfg(any(feature = "runtime-benchmarks", test))] @@ -50,9 +50,9 @@ pub use pallet::*; pub use weights::WeightInfo; #[derive(Clone, Default, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo, Eq, PartialEq)] -pub struct AccumulatedAmount { +pub struct AccumulatedAmount { pub amount: u128, - pub last_updated: BlockNumber, + pub last_updated: RelayChainBlockNumber, } #[frame_support::pallet] @@ -88,14 +88,16 @@ pub mod pallet { /// Defer duration base to be used for calculating the specific defer duration for any asset #[pallet::constant] - type DeferDuration: Get; + type DeferDuration: Get; - // TODO: implement or remove + /// The maximum number of blocks to defer XCMs by. #[pallet::constant] - type MaxDeferDuration: Get; + type MaxDeferDuration: Get; - type BlockNumberProvider: BlockNumberProvider; + /// Relay chain block number provider + type RelayBlockNumberProvider: BlockNumberProvider; + /// Convert from `MultiLocation` to local `AssetId` type CurrencyIdConvert: Convert>; // TODO: Which type to use to define the rate limit here? @@ -113,7 +115,7 @@ pub mod pallet { /// Accumulated amounts for each asset #[pallet::getter(fn accumulated_amount)] pub type AccumulatedAmounts = - StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedAmount, ValueQuery>; + StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedAmount, ValueQuery>; #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] @@ -138,11 +140,7 @@ fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { } // TODO: pull out into hdx-math + add property based tests -pub fn calculate_deferred_duration( - global_duration: BlockNumber, - rate_limit: u128, - total_accumulated: u128, -) -> BlockNumber { +pub fn calculate_deferred_duration(global_duration: u32, rate_limit: u128, total_accumulated: u128) -> u32 { let global_duration: u128 = global_duration.max(1).saturated_into(); // duration * (incoming + decayed - rate_limit) let deferred_duration = @@ -152,11 +150,11 @@ pub fn calculate_deferred_duration( } pub fn calculate_new_accumulated_amount( - global_duration: BlockNumber, + global_duration: u32, rate_limit: u128, incoming_amount: u128, accumulated_amount: u128, - blocks_since_last_update: BlockNumber, + blocks_since_last_update: u32, ) -> u128 { incoming_amount.saturating_add(decay( global_duration, @@ -166,12 +164,7 @@ pub fn calculate_new_accumulated_amount( )) } -pub fn decay( - global_duration: BlockNumber, - rate_limit: u128, - accumulated_amount: u128, - blocks_since_last_update: BlockNumber, -) -> u128 { +pub fn decay(global_duration: u32, rate_limit: u128, accumulated_amount: u128, blocks_since_last_update: u32) -> u128 { let global_duration: u128 = global_duration.max(1).saturated_into(); // acc - rate_limit * blocks / duration accumulated_amount @@ -196,9 +189,9 @@ impl Pallet { impl XcmDeferFilter for Pallet { fn deferred_by( _para: polkadot_parachain::primitives::Id, - _sent_at: polkadot_core_primitives::BlockNumber, + _sent_at: RelayChainBlockNumber, xcm: &VersionedXcm, - ) -> Option { + ) -> Option { if let V3(xcm) = xcm { if let Some(instruction) = xcm.first() { for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { @@ -208,7 +201,7 @@ impl XcmDeferFilter for Pallet { let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; let defer_duration = T::DeferDuration::get(); - let current_time = T::BlockNumberProvider::current_block_number(); + let current_time = T::RelayBlockNumberProvider::current_block_number(); let time_difference = current_time.saturating_sub(accumulated_liquidity.last_updated); let new_accumulated_amount = calculate_new_accumulated_amount( diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index b42e72a04..b3c0b2535 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -132,8 +132,8 @@ fn deferred_by_should_defer_by_max_duration_when_it_is_reached() { let para_id = 999.into(); //Act - let deferred_by: u64 = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).unwrap().into(); - let max_defer: u64 = ::MaxDeferDuration::get(); + let deferred_by = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).unwrap(); + let max_defer: u32 = ::MaxDeferDuration::get(); //Assert assert_eq!(deferred_by, max_defer); }); diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index e3b2ee22c..c2c73534d 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -23,7 +23,9 @@ pub use frame_support::{assert_noop, assert_ok, parameter_types}; use frame_system::EnsureRoot; use hydra_dx_math::omnipool::types::BalanceUpdate; use orml_traits::parameter_type_with_key; +use polkadot_parachain::primitives::RelayChainBlockNumber; use sp_core::H256; +use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::Convert; use sp_runtime::traits::{ConstU128, ConstU32, ConstU64}; use sp_runtime::DispatchResult; @@ -147,13 +149,24 @@ impl Convert> for ConvertIdMock { } } +pub struct TreatSystemAsRelayBlockNumberProvider; +impl BlockNumberProvider for TreatSystemAsRelayBlockNumberProvider { + type BlockNumber = RelayChainBlockNumber; + + fn current_block_number() -> Self::BlockNumber { + use sp_runtime::SaturatedConversion; + System::current_block_number().saturated_into() + } +} + impl pallet_xcm_rate_limiter::Config for Test { type RuntimeEvent = RuntimeEvent; type AssetId = AssetId; - type DeferDuration = ConstU64<10>; - type MaxDeferDuration = ConstU64<100>; + type DeferDuration = ConstU32<10>; + type MaxDeferDuration = ConstU32<100>; type TechnicalOrigin = EnsureRoot; - type BlockNumberProvider = System; + // dirty trick: we use System as a relay block number provider here + type RelayBlockNumberProvider = TreatSystemAsRelayBlockNumberProvider; type RateLimitFor = XcmRateLimitFor; type CurrencyIdConvert = ConvertIdMock; type WeightInfo = (); From 7f8978722eb343ce677eb6f22a82dc1bfbfe9046 Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 15:23:36 +0200 Subject: [PATCH 32/79] add missing doc comment --- pallets/xcm-rate-limiter/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 9b7dfd534..168831f3b 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -100,7 +100,7 @@ pub mod pallet { /// Convert from `MultiLocation` to local `AssetId` type CurrencyIdConvert: Convert>; - // TODO: Which type to use to define the rate limit here? + /// Xcm rate limit getter for each asset type RateLimitFor: GetByKey>; /// Weight information for extrinsics in this pallet. From 66d7e32013f94b33fea46ad63f6c89540d5cdc6f Mon Sep 17 00:00:00 2001 From: dmoka Date: Thu, 20 Apr 2023 15:49:15 +0200 Subject: [PATCH 33/79] implement xcm rate limiter for runtime --- Cargo.lock | 27 ++++++++++---------- integration-tests/Cargo.toml | 18 ++++++------- pallets/circuit-breaker/Cargo.toml | 4 +-- pallets/omnipool-liquidity-mining/Cargo.toml | 6 ++--- pallets/omnipool/Cargo.toml | 2 +- pallets/xcm-rate-limiter/Cargo.toml | 9 ++++--- pallets/xcm-rate-limiter/src/lib.rs | 3 +-- pallets/xcm-rate-limiter/src/tests/mock.rs | 1 - runtime/common/Cargo.toml | 14 +++++----- runtime/hydradx/Cargo.toml | 27 +++++++++++--------- runtime/hydradx/src/lib.rs | 1 + runtime/hydradx/src/xcm.rs | 18 ++++++++++++- runtime/testing-hydradx/Cargo.toml | 24 ++++++++--------- 13 files changed, 88 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be6dee802..1a8b48a1c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3709,7 +3709,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" version = "0.2.3" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-support", "hydradx-traits", @@ -3791,6 +3791,7 @@ dependencies = [ "pallet-uniques", "pallet-utility", "pallet-xcm", + "pallet-xcm-rate-limiter", "parachain-info", "parity-scale-codec", "polkadot-parachain", @@ -3822,7 +3823,7 @@ dependencies = [ [[package]] name = "hydradx-traits" version = "2.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-support", "impl-trait-for-tuples", @@ -6078,7 +6079,7 @@ dependencies = [ [[package]] name = "pallet-asset-registry" version = "2.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-benchmarking", "frame-support", @@ -6331,7 +6332,7 @@ dependencies = [ [[package]] name = "pallet-collator-rewards" version = "1.0.4" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-support", "frame-system", @@ -6403,7 +6404,7 @@ dependencies = [ [[package]] name = "pallet-currencies" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-support", "frame-system", @@ -6438,7 +6439,7 @@ dependencies = [ [[package]] name = "pallet-duster" version = "3.2.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-benchmarking", "frame-support", @@ -6509,7 +6510,7 @@ dependencies = [ [[package]] name = "pallet-ema-oracle" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-benchmarking", "frame-support", @@ -6639,7 +6640,7 @@ dependencies = [ [[package]] name = "pallet-liquidity-mining" version = "3.1.0" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-support", "frame-system", @@ -6865,7 +6866,7 @@ dependencies = [ [[package]] name = "pallet-otc" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-benchmarking", "frame-support", @@ -6966,7 +6967,7 @@ dependencies = [ [[package]] name = "pallet-relaychain-info" version = "0.3.3" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -7160,7 +7161,7 @@ dependencies = [ [[package]] name = "pallet-transaction-multi-payment" version = "8.0.5" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-support", "frame-system", @@ -7178,7 +7179,7 @@ dependencies = [ [[package]] name = "pallet-transaction-pause" version = "0.1.3" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-benchmarking", "frame-support", @@ -12628,7 +12629,7 @@ dependencies = [ [[package]] name = "test-utils" version = "1.1.1" -source = "git+https://github.com/galacticcouncil/warehouse?rev=c407b7b6128b0be562068063bf65812d2e1a56b1#c407b7b6128b0be562068063bf65812d2e1a56b1" +source = "git+https://github.com/galacticcouncil/warehouse?rev=cc5f2abd167171ea32ce5eb63203fd37c2fa6943#cc5f2abd167171ea32ce5eb63203fd37c2fa6943" dependencies = [ "frame-system", "pretty_assertions", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 68e01d6ff..783f69116 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -20,14 +20,14 @@ pallet-circuit-breaker = { path = "../pallets/circuit-breaker",default-features pallet-omnipool-liquidity-mining = { path = "../pallets/omnipool-liquidity-mining", default-features = true} # HydraDX dependencies -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-duster = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-duster = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } @@ -110,7 +110,7 @@ polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "r [dev-dependencies] hex-literal = "0.3.1" pretty_assertions = "1.2.1" -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1" } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943" } xcm-emulator = { git = "https://github.com/shaunxw/xcm-simulator", rev = "754f3b90ecc65af735a6c9a2e1792c5253926ff6" } [features] diff --git a/pallets/circuit-breaker/Cargo.toml b/pallets/circuit-breaker/Cargo.toml index 31803d26e..0120598b6 100644 --- a/pallets/circuit-breaker/Cargo.toml +++ b/pallets/circuit-breaker/Cargo.toml @@ -28,14 +28,14 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot- pallet-omnipool = { path = "../omnipool", default-features = false } # Warehouse -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } [dev-dependencies] pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } -test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } pretty_assertions = "1.2.1" test-case = "3.0.0" diff --git a/pallets/omnipool-liquidity-mining/Cargo.toml b/pallets/omnipool-liquidity-mining/Cargo.toml index 3cf0f7395..9d93d0ac4 100644 --- a/pallets/omnipool-liquidity-mining/Cargo.toml +++ b/pallets/omnipool-liquidity-mining/Cargo.toml @@ -32,8 +32,8 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "polk orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # Warehouse -pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-liquidity-mining = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } @@ -53,7 +53,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot- orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } proptest = "1.0.0" pretty_assertions = "1.2.1" -test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } [features] default = ["std"] diff --git a/pallets/omnipool/Cargo.toml b/pallets/omnipool/Cargo.toml index a0b587994..16efbf0bc 100644 --- a/pallets/omnipool/Cargo.toml +++ b/pallets/omnipool/Cargo.toml @@ -29,7 +29,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "polk orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } # Warehouse -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index 14f3d02fa..53c0fe9d9 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -14,7 +14,7 @@ targets = ['x86_64-unknown-linux-gnu'] [dependencies] serde = { features = ["derive"], optional = true, version = "1.0.136" } codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.4.0" } -scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } +scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } # Substrate dependencies frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false, optional = true} @@ -36,7 +36,7 @@ cumulus-pallet-xcmp-queue = { git = "https://github.com/galacticcouncil/cumulus. pallet-omnipool = { path = "../omnipool", default-features = false } # Warehouse -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } # orml orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } @@ -45,13 +45,16 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38" } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38" } hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } -test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +test-utils = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } pretty_assertions = "1.2.1" test-case = "3.0.0" [features] default = ['std'] std = [ + 'sp-std/std', + 'sp-core/std', + 'sp-runtime/std', 'codec/std', 'frame-support/std', 'frame-system/std', diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 168831f3b..405be83ae 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -33,6 +33,7 @@ use sp_runtime::traits::Convert; use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; use sp_runtime::SaturatedConversion; use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug, Saturating}; +use sp_std::vec::Vec; use xcm::lts::prelude::*; use xcm::VersionedXcm; use xcm::VersionedXcm::V3; @@ -84,8 +85,6 @@ pub mod pallet { + TypeInfo + AtLeast32BitUnsigned; - type TechnicalOrigin: EnsureOrigin; - /// Defer duration base to be used for calculating the specific defer duration for any asset #[pallet::constant] type DeferDuration: Get; diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index c2c73534d..87dc5e2c7 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -164,7 +164,6 @@ impl pallet_xcm_rate_limiter::Config for Test { type AssetId = AssetId; type DeferDuration = ConstU32<10>; type MaxDeferDuration = ConstU32<100>; - type TechnicalOrigin = EnsureRoot; // dirty trick: we use System as a relay block number provider here type RelayBlockNumberProvider = TreatSystemAsRelayBlockNumberProvider; type RateLimitFor = XcmRateLimitFor; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 0a951e2e8..5b3ac2f6c 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -20,7 +20,7 @@ pallet-omnipool = {path = '../../pallets/omnipool', default-features = false} pallet-circuit-breaker = {path = '../../pallets/circuit-breaker', default-features = false} hydra-dx-math = { git = "https://github.com/galacticcouncil/HydraDX-math", rev = "3da7fffa4c2f27b4166bfeb4a494cb4e995b700e", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } # Substrate dependencies sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } @@ -42,12 +42,12 @@ pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = " pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } pallet-claims = { path = '../../pallets/claims', default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 7daffcca6..1b90efd27 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -28,6 +28,7 @@ pallet-genesis-history = {path = '../../pallets/genesis-history', default-featur pallet-omnipool = {path = '../../pallets/omnipool', default-features = false} pallet-circuit-breaker = {path = '../../pallets/circuit-breaker', default-features = false} pallet-omnipool-liquidity-mining = {path = '../../pallets/omnipool-liquidity-mining', default-features = false} +pallet-xcm-rate-limiter = {path = '../../pallets/xcm-rate-limiter', default-features = false} # pallets pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } @@ -50,18 +51,18 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # Warehouse dependencies -hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } # ORML dependencies orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } @@ -215,6 +216,7 @@ std = [ "pallet-currencies/std", "pallet-omnipool/std", "pallet-circuit-breaker/std", + "pallet-xcm-rate-limiter/std", "pallet-transaction-pause/std", "pallet-ema-oracle/std", "pallet-otc/std", @@ -286,6 +288,7 @@ try-runtime= [ "warehouse-liquidity-mining/try-runtime", "pallet-omnipool-liquidity-mining/try-runtime", "pallet-circuit-breaker/try-runtime", + "pallet-xcm-rate-limiter/try-runtime", "pallet-ema-oracle/try-runtime", "pallet-otc/try-runtime", ] diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 01075bbb3..8d6e63c95 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -1018,6 +1018,7 @@ construct_runtime!( OmnipoolLiquidityMining: pallet_omnipool_liquidity_mining = 63, OTC: pallet_otc = 64, CircuitBreaker: pallet_circuit_breaker = 65, + XcmRateLimiter: pallet_xcm_rate_limiter = 66, // ORML related modules Tokens: orml_tokens = 77, diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index eaf166fb3..c29caeb28 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -9,7 +9,7 @@ use hydradx_adapters::{MultiCurrencyTrader, ToFeeReceiver}; use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key}; pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; +use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; use polkadot_xcm::v3::prelude::*; use polkadot_xcm::v3::Weight as XcmWeight; use primitives::Price; @@ -214,6 +214,22 @@ impl pallet_xcm::Config for Runtime { type ReachableDest = (); } +parameter_types! { + pub DeferDuration: RelayChainBlockNumber = 600; // 1 hour + pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days +} + +impl pallet_xcm_rate_limiter::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type DeferDuration = DeferDuration; + type MaxDeferDuration = MaxDeferDuration; + type RelayBlockNumberProvider = RelayChainBlockNumberProvider; + type CurrencyIdConvert = CurrencyIdConvert; + type RateLimitFor = pallet_asset_registry::XcmRateLimitsInRegistry; + type WeightInfo = (); +} + pub struct CurrencyIdConvert; use primitives::constants::chain::CORE_ASSET_ID; diff --git a/runtime/testing-hydradx/Cargo.toml b/runtime/testing-hydradx/Cargo.toml index e55f59a9c..ff25d6fc4 100644 --- a/runtime/testing-hydradx/Cargo.toml +++ b/runtime/testing-hydradx/Cargo.toml @@ -51,18 +51,18 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b pallet-uniques = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.38", default-features = false } # Warehouse dependencies -hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false} -pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } -pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "c407b7b6128b0be562068063bf65812d2e1a56b1", default-features = false } +hydradx-adapters = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +hydradx-traits = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-relaychain-info = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-transaction-multi-payment = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-asset-registry = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-collator-rewards = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-currencies = { git = "https://github.com/galacticcouncil/warehouse",rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false} +pallet-transaction-pause = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-duster = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +warehouse-liquidity-mining = { package="pallet-liquidity-mining", git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-ema-oracle = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } +pallet-otc = { git = "https://github.com/galacticcouncil/warehouse", rev = "cc5f2abd167171ea32ce5eb63203fd37c2fa6943", default-features = false } # ORML dependencies orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.38", default-features = false } From aae8b32b5d4f9c1164ab1c526151240846623d80 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 17:29:32 +0200 Subject: [PATCH 34/79] write and fix xcm rate limiter integration test (was missing in runtime) --- Cargo.lock | 100 ++++++------ integration-tests/src/cross_chain_transfer.rs | 8 +- integration-tests/src/lib.rs | 1 + integration-tests/src/polkadot_test_net.rs | 6 +- integration-tests/src/xcm_rate_limiter.rs | 152 ++++++++++++++++++ pallets/xcm-rate-limiter/src/lib.rs | 85 +++++----- runtime/hydradx/src/xcm.rs | 2 +- 7 files changed, 256 insertions(+), 98 deletions(-) create mode 100644 integration-tests/src/xcm_rate_limiter.rs diff --git a/Cargo.lock b/Cargo.lock index 1a8b48a1c..481249ca7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1525,7 +1525,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "clap 4.2.1", "parity-scale-codec", @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1563,7 +1563,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1592,7 +1592,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1615,7 +1615,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1638,7 +1638,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "frame-support", "frame-system", @@ -1728,7 +1728,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1745,7 +1745,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1774,7 +1774,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1785,7 +1785,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1823,7 +1823,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1862,7 +1862,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "futures", @@ -1875,7 +1875,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1893,7 +1893,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1918,7 +1918,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1937,7 +1937,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "array-bytes 6.0.0", "async-trait", @@ -1977,7 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2006,7 +2006,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6351,7 +6351,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "frame-benchmarking", "frame-support", @@ -7383,7 +7383,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#a3686ca27a1d18c614af65ef86298e0caf5ecfca" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14774,124 +14774,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#cca2bfa2f80c431b5557d35d8b9912f2fb631537" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" diff --git a/integration-tests/src/cross_chain_transfer.rs b/integration-tests/src/cross_chain_transfer.rs index bad017583..f4e4905a0 100644 --- a/integration-tests/src/cross_chain_transfer.rs +++ b/integration-tests/src/cross_chain_transfer.rs @@ -111,7 +111,7 @@ fn hydra_should_receive_asset_when_transferred_from_acala() { Hydra::execute_with(|| { assert_ok!(hydradx_runtime::AssetRegistry::set_location( hydradx_runtime::RuntimeOrigin::root(), - 1, + ACA, hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) )); }); @@ -145,11 +145,11 @@ fn hydra_should_receive_asset_when_transferred_from_acala() { let fee = 400641025641; Hydra::execute_with(|| { assert_eq!( - hydradx_runtime::Tokens::free_balance(1, &AccountId::from(BOB)), - 1_030 * UNITS - fee + hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), + 30 * UNITS - fee ); assert_eq!( - hydradx_runtime::Tokens::free_balance(1, &hydradx_runtime::Treasury::account_id()), + hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()), fee // fees should go to treasury ); }); diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index 80e7709cd..a18bf7b30 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -9,4 +9,5 @@ mod omnipool_liquidity_mining; mod oracle; mod otc; mod polkadot_test_net; +mod xcm_rate_limiter; mod vesting; diff --git a/integration-tests/src/polkadot_test_net.rs b/integration-tests/src/polkadot_test_net.rs index 0e8917d9f..7509d4a22 100644 --- a/integration-tests/src/polkadot_test_net.rs +++ b/integration-tests/src/polkadot_test_net.rs @@ -37,6 +37,7 @@ pub const DAI: AssetId = 2; pub const DOT: AssetId = 3; pub const ETH: AssetId = 4; pub const BTC: AssetId = 5; +pub const ACA: AssetId = 6; decl_test_relay_chain! { pub struct PolkadotRelay { @@ -186,6 +187,7 @@ pub fn hydra_ext() -> sp_io::TestExternalities { (b"DOT".to_vec(), 1_000u128, Some(DOT)), (b"ETH".to_vec(), 1_000u128, Some(ETH)), (b"BTC".to_vec(), 1_000u128, Some(BTC)), + (b"ACA".to_vec(), 1_000u128, Some(ACA)), ], native_asset_name: b"HDX".to_vec(), native_existential_deposit: existential_deposit, @@ -228,7 +230,7 @@ pub fn hydra_ext() -> sp_io::TestExternalities { .unwrap(); pallet_transaction_multi_payment::GenesisConfig:: { - currencies: vec![(1, Price::from(1)), (DAI, Price::from(1))], + currencies: vec![(LRNA, Price::from(1)), (DAI, Price::from(1)), (ACA, Price::from(1))], account_currencies: vec![], } .assimilate_storage(&mut t) @@ -352,7 +354,7 @@ fn last_hydra_events(n: usize) -> Vec { } pub fn expect_hydra_events(e: Vec) { - assert_eq!(last_hydra_events(e.len()), e); + pretty_assertions::assert_eq!(last_hydra_events(e.len()), e); } pub fn set_relaychain_block_number(number: BlockNumber) { diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs new file mode 100644 index 000000000..cffa0cda7 --- /dev/null +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -0,0 +1,152 @@ +#![cfg(test)] + +use crate::polkadot_test_net::*; + +use common_runtime::Weight; +use frame_support::traits::tokens::fungibles::Mutate; +use frame_support::{ + assert_ok, + traits::{OnFinalize, OnInitialize}, +}; +use hydradx_runtime::{EmaOracle, RuntimeOrigin}; +use orml_traits::currency::MultiCurrency; +use pallet_asset_registry::AssetType; +use pallet_ema_oracle::OracleError; +use polkadot_primitives::v2::BlockNumber; +use polkadot_xcm::prelude::*; +use sp_runtime::{FixedU128, Permill}; +use xcm_emulator::TestExt; + +#[test] +fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { + // Arrange + TestNet::reset(); + + Hydra::execute_with(|| { + assert_ok!(hydradx_runtime::AssetRegistry::set_location( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) + )); + + // set an xcm rate limit + assert_ok!(hydradx_runtime::AssetRegistry::update( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + b"ACA".to_vec(), + AssetType::Token, + None, + Some(50 * UNITS), + )); + + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + }); + + let amount = 100 * UNITS; + Acala::execute_with(|| { + // Act + assert_ok!(hydradx_runtime::XTokens::transfer( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + 0, + amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(HYDRA_PARA_ID), + Junction::AccountId32 { id: BOB, network: None } + ) + ) + .into() + ), + WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) + )); + + // Assert + assert_eq!( + hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + 100 * UNITS + ); + }); + + Hydra::execute_with(|| { + // expect_hydra_events(vec![ + // cumulus_pallet_xcmp_queue::Event::XcmDeferred { + // sender: ACALA_PARA_ID.into(), + // sent_at: 1, + // deferred_to: 601, + // message_hash: None, + // } + // .into(), + // pallet_relaychain_info::Event::CurrentBlockNumbers { + // parachain_block_number: 1, + // relaychain_block_number: 5, + // } + // .into(), + // ]); + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + }); +} + +#[test] +fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { + // Arrange + TestNet::reset(); + + Hydra::execute_with(|| { + assert_ok!(hydradx_runtime::AssetRegistry::set_location( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) + )); + + // set an xcm rate limit + assert_ok!(hydradx_runtime::AssetRegistry::update( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + b"ACA".to_vec(), + AssetType::Token, + None, + Some(101 * UNITS), + )); + }); + + let amount = 100 * UNITS; + Acala::execute_with(|| { + // Act + assert_ok!(hydradx_runtime::XTokens::transfer( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + 0, + amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(HYDRA_PARA_ID), + Junction::AccountId32 { id: BOB, network: None } + ) + ) + .into() + ), + WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) + )); + + // Assert + assert_eq!( + hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + 100 * UNITS + ); + }); + + let fee = 400641025641; + Hydra::execute_with(|| { + assert_eq!( + hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), + 100 * UNITS - fee + ); + assert_eq!( + hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()), + fee // fees should go to treasury + ); + }); +} diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 405be83ae..601723b7a 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -189,48 +189,51 @@ impl XcmDeferFilter for Pallet { fn deferred_by( _para: polkadot_parachain::primitives::Id, _sent_at: RelayChainBlockNumber, - xcm: &VersionedXcm, + versioned_xcm: &VersionedXcm, ) -> Option { - if let V3(xcm) = xcm { - if let Some(instruction) = xcm.first() { - for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { - let accumulated_liquidity = AccumulatedAmounts::::get(location); - - let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; - let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; - let defer_duration = T::DeferDuration::get(); - - let current_time = T::RelayBlockNumberProvider::current_block_number(); - let time_difference = current_time.saturating_sub(accumulated_liquidity.last_updated); - - let new_accumulated_amount = calculate_new_accumulated_amount( - defer_duration.saturated_into(), - limit_per_duration, - amount, - accumulated_liquidity.amount, - time_difference.saturated_into(), - ); - - let deferred_by = calculate_deferred_duration( - defer_duration.saturated_into(), - limit_per_duration, - new_accumulated_amount, - ); - - AccumulatedAmounts::::insert( - location, - AccumulatedAmount { - amount: new_accumulated_amount, - last_updated: current_time, - }, - ); - - if deferred_by > 0 { - return Some(deferred_by.min(T::MaxDeferDuration::get().saturated_into())); - } else { - return None; - } - } + use xcm::IntoVersion; + let maybe_xcm = versioned_xcm.clone().into_version(3); + // TODO: defer when unable to interpret? + let Ok(V3(xcm)) = maybe_xcm else { return None }; + // SAFETY NOTE: It is fine to only look at the first instruction because that is how assets will arrive on chain. + // This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. + let Some(instruction) = xcm.first() else { return None }; + for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { + let accumulated_liquidity = AccumulatedAmounts::::get(location); + + let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; + let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; + let defer_duration = T::DeferDuration::get(); + + let current_time = T::RelayBlockNumberProvider::current_block_number(); + let time_difference = current_time.saturating_sub(accumulated_liquidity.last_updated); + + let new_accumulated_amount = calculate_new_accumulated_amount( + defer_duration.saturated_into(), + limit_per_duration, + amount, + accumulated_liquidity.amount, + time_difference.saturated_into(), + ); + + let deferred_by = calculate_deferred_duration( + defer_duration.saturated_into(), + limit_per_duration, + new_accumulated_amount, + ); + + AccumulatedAmounts::::insert( + location, + AccumulatedAmount { + amount: new_accumulated_amount, + last_updated: current_time, + }, + ); + + if deferred_by > 0 { + return Some(deferred_by.min(T::MaxDeferDuration::get().saturated_into())); + } else { + return None; } } diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index c29caeb28..558bc1f60 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -143,7 +143,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ExecuteDeferredOrigin = EnsureRoot; type MaxDeferredMessages = ConstU32<100>; type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; - type XcmDeferFilter = (); + type XcmDeferFilter = XcmRateLimiter; } impl cumulus_pallet_dmp_queue::Config for Runtime { From 78e528da48b94ac4a1d30d9a7c1e238fff28edae Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 17:29:49 +0200 Subject: [PATCH 35/79] formatting --- integration-tests/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index a18bf7b30..2bc16ca14 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -9,5 +9,5 @@ mod omnipool_liquidity_mining; mod oracle; mod otc; mod polkadot_test_net; -mod xcm_rate_limiter; mod vesting; +mod xcm_rate_limiter; From de3a5994f03fb1741a92f1938b0e82078779e1f2 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 17:33:09 +0200 Subject: [PATCH 36/79] update teleport test for rate limiter --- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 33 ++++--------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index b3c0b2535..867e106e1 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -26,43 +26,24 @@ use sp_runtime::SaturatedConversion; use xcm::lts::prelude::*; use xcm::VersionedXcm; -/* #[test] -#[ignore] -fn deferred_by_should_track_incoming_deposited_asset_liquidity() { - ExtBuilder::default().build().execute_with(|| { - //Arrange - let versioned_xcm = create_versioned_reserve_asset_deposited(MultiLocation::here(), 5); - let para_id = 999.into(); - - //Act - XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); - - //Assert - let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); - assert_eq!(volume, 5); - }); -} -*/ - -/* -#[test] -#[ignore] fn deferred_by_should_track_incoming_teleported_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { //Arrange - let versioned_xcm = create_versioned_receive_teleported_asset(MultiLocation::here(), 5); + let versioned_xcm = create_versioned_receive_teleported_asset(MultiLocation::here(), 2000 * ONE); let para_id = 999.into(); //Act - XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); //Assert - let volume = XcmRateLimiter::accumulated_amount(MultiLocation::here()); - assert_eq!(volume, 5); + let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_amount.amount, 2000 * ONE); + assert_eq!(accumulated_amount.last_updated, 1); + assert_eq!(deferred_block_number, Some(10)); }); } -*/ + #[test] fn deferred_by_should_defer_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { From f84f41ca0d10176ca67e51a6d2721644474459c4 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 18:00:21 +0200 Subject: [PATCH 37/79] test for v2 conversion and defer for max when not able to convert --- pallets/xcm-rate-limiter/src/lib.rs | 3 +-- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 601723b7a..761266f5e 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -193,8 +193,7 @@ impl XcmDeferFilter for Pallet { ) -> Option { use xcm::IntoVersion; let maybe_xcm = versioned_xcm.clone().into_version(3); - // TODO: defer when unable to interpret? - let Ok(V3(xcm)) = maybe_xcm else { return None }; + let Ok(V3(xcm)) = maybe_xcm else { return Some(T::MaxDeferDuration::get()) }; // SAFETY NOTE: It is fine to only look at the first instruction because that is how assets will arrive on chain. // This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. let Some(instruction) = xcm.first() else { return None }; diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 867e106e1..8ce771d2f 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -62,6 +62,24 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { }); } +#[test] +fn deferred_by_should_defer_xcm_when_v2_can_be_converted() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_xcm_v2(2000 * ONE); + let para_id = 999.into(); + + //Act + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + + //Assert + let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_amount.amount, 2000 * ONE); + assert_eq!(accumulated_amount.last_updated, 1); + assert_eq!(deferred_block_number, Some(10)); + }); +} + #[test] fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { ExtBuilder::default().build().execute_with(|| { @@ -257,3 +275,11 @@ pub fn create_versioned_receive_teleported_asset(loc: MultiLocation, amount: u12 Instruction::::ReceiveTeleportedAsset(multi_assets), ])) } + +pub fn create_versioned_xcm_v2(amount: u128) -> VersionedXcm { + use xcm::v2::prelude::*; + let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(MultiLocation::here(), amount).into()]).unwrap(); + VersionedXcm::from(Xcm::(vec![ + Instruction::::ReserveAssetDeposited(multi_assets), + ])) +} \ No newline at end of file From 3a913a47da1157a468aea17ba9ef5f85e302c5d6 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 20 Apr 2023 18:00:42 +0200 Subject: [PATCH 38/79] formatting --- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 8ce771d2f..c4195c00f 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -282,4 +282,4 @@ pub fn create_versioned_xcm_v2(amount: u128) -> VersionedXcm { VersionedXcm::from(Xcm::(vec![ Instruction::::ReserveAssetDeposited(multi_assets), ])) -} \ No newline at end of file +} From e26e4b3c6c5402157a90433788994ea2fb0fe3b0 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 12:12:05 +0200 Subject: [PATCH 39/79] check message hash --- integration-tests/src/polkadot_test_net.rs | 2 +- integration-tests/src/xcm_rate_limiter.rs | 43 +++++++++++++++------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/integration-tests/src/polkadot_test_net.rs b/integration-tests/src/polkadot_test_net.rs index 7509d4a22..703ad01e0 100644 --- a/integration-tests/src/polkadot_test_net.rs +++ b/integration-tests/src/polkadot_test_net.rs @@ -343,7 +343,7 @@ pub fn vesting_account() -> AccountId { VestingPalletId::get().into_account_truncating() } -fn last_hydra_events(n: usize) -> Vec { +pub fn last_hydra_events(n: usize) -> Vec { frame_system::Pallet::::events() .into_iter() .rev() diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index cffa0cda7..93bf270d6 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -17,6 +17,18 @@ use polkadot_xcm::prelude::*; use sp_runtime::{FixedU128, Permill}; use xcm_emulator::TestExt; +/// Returns the message hash in the `XcmpMessageSent` event at the `n`th last event (1-indexed, so if the second to last +/// event has the hash, pass `2`); +fn get_message_hash_from_event(n: usize) -> Option<[u8; 32]> { + use cumulus_pallet_xcmp_queue::Event; + use hydradx_runtime::RuntimeEvent; + let RuntimeEvent::XcmpQueue(Event::XcmpMessageSent { message_hash }) = &last_hydra_events(n)[0] else { + assert!(false, "expecting to find message sent event"); + return None + }; + message_hash.clone() +} + #[test] fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { // Arrange @@ -43,6 +55,7 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { }); let amount = 100 * UNITS; + let mut message_hash = None; Acala::execute_with(|| { // Act assert_ok!(hydradx_runtime::XTokens::transfer( @@ -62,6 +75,8 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) )); + message_hash = get_message_hash_from_event(2); + // Assert assert_eq!( hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), @@ -70,20 +85,20 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { }); Hydra::execute_with(|| { - // expect_hydra_events(vec![ - // cumulus_pallet_xcmp_queue::Event::XcmDeferred { - // sender: ACALA_PARA_ID.into(), - // sent_at: 1, - // deferred_to: 601, - // message_hash: None, - // } - // .into(), - // pallet_relaychain_info::Event::CurrentBlockNumbers { - // parachain_block_number: 1, - // relaychain_block_number: 5, - // } - // .into(), - // ]); + expect_hydra_events(vec![ + cumulus_pallet_xcmp_queue::Event::XcmDeferred { + sender: ACALA_PARA_ID.into(), + sent_at: 3, + deferred_to: 603, + message_hash, + } + .into(), + pallet_relaychain_info::Event::CurrentBlockNumbers { + parachain_block_number: 1, + relaychain_block_number: 5, + } + .into(), + ]); assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); }); } From cf1e2231d838f34910e387b221bb5e57fab2c99d Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 13:06:22 +0200 Subject: [PATCH 40/79] update cargo.lock --- Cargo.lock | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d841d715..7fdf042df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1537,7 +1537,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "clap 4.2.4", "parity-scale-codec", @@ -1552,7 +1552,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1575,7 +1575,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1604,7 +1604,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1650,7 +1650,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1673,7 +1673,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1696,7 +1696,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1724,7 +1724,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "frame-support", "frame-system", @@ -1740,7 +1740,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1786,7 +1786,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1797,7 +1797,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1813,7 +1813,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1835,7 +1835,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1851,7 +1851,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1874,7 +1874,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "futures", @@ -1887,7 +1887,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1905,7 +1905,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1930,7 +1930,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1949,7 +1949,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -1989,7 +1989,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2018,7 +2018,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6369,7 +6369,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "frame-benchmarking", "frame-support", @@ -7402,7 +7402,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14808,124 +14808,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" From 6cdabefcd769e69e9bc42ad61523df1cc03b1c0b Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 13:10:27 +0200 Subject: [PATCH 41/79] run and apply cargo fix --- integration-tests/src/xcm_rate_limiter.rs | 11 +++++------ pallets/xcm-rate-limiter/src/lib.rs | 16 ++++++++-------- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 8 ++++---- pallets/xcm-rate-limiter/src/tests/mock.rs | 8 ++++---- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 93bf270d6..8ec6e82ad 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -3,18 +3,17 @@ use crate::polkadot_test_net::*; use common_runtime::Weight; -use frame_support::traits::tokens::fungibles::Mutate; + use frame_support::{ assert_ok, - traits::{OnFinalize, OnInitialize}, }; -use hydradx_runtime::{EmaOracle, RuntimeOrigin}; + use orml_traits::currency::MultiCurrency; use pallet_asset_registry::AssetType; -use pallet_ema_oracle::OracleError; -use polkadot_primitives::v2::BlockNumber; + + use polkadot_xcm::prelude::*; -use sp_runtime::{FixedU128, Permill}; + use xcm_emulator::TestExt; /// Returns the message hash in the `XcmpMessageSent` event at the `n`th last event (1-indexed, so if the second to last diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 761266f5e..b82f1687c 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -19,20 +19,20 @@ use codec::{Decode, Encode}; use cumulus_pallet_xcmp_queue::XcmDeferFilter; -use frame_support::dispatch::Weight; -use frame_support::traits::{Contains, EnsureOrigin}; -use frame_support::{ensure, pallet_prelude::DispatchResult, traits::Get}; -use frame_system::ensure_signed_or_root; -use frame_system::pallet_prelude::OriginFor; + + +use frame_support::{traits::Get}; + + use orml_traits::GetByKey; use polkadot_parachain::primitives::RelayChainBlockNumber; use scale_info::TypeInfo; use sp_core::MaxEncodedLen; use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::Convert; -use sp_runtime::traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, Zero}; +use sp_runtime::traits::{AtLeast32BitUnsigned}; use sp_runtime::SaturatedConversion; -use sp_runtime::{ArithmeticError, DispatchError, RuntimeDebug, Saturating}; +use sp_runtime::{RuntimeDebug, Saturating}; use sp_std::vec::Vec; use xcm::lts::prelude::*; use xcm::VersionedXcm; @@ -61,7 +61,7 @@ pub mod pallet { use super::*; use codec::HasCompact; use frame_support::pallet_prelude::*; - use frame_support::traits::Contains; + use polkadot_parachain::primitives::RelayChainBlockNumber; use sp_runtime::traits::BlockNumberProvider; use xcm::lts::MultiLocation; diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index c4195c00f..51cc84617 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -19,11 +19,11 @@ use crate::tests::mock::RuntimeCall; use crate::tests::mock::*; use crate::*; use cumulus_pallet_xcmp_queue::XcmDeferFilter; -use frame_support::assert_storage_noop; + pub use pretty_assertions::{assert_eq, assert_ne}; -use sp_runtime::DispatchError::BadOrigin; -use sp_runtime::SaturatedConversion; -use xcm::lts::prelude::*; + + + use xcm::VersionedXcm; #[test] diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index f1443a721..919ed6243 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -21,13 +21,13 @@ pub use frame_support::traits::{Everything, OnFinalize}; pub use frame_support::{assert_noop, assert_ok, parameter_types}; use frame_system::EnsureRoot; -use hydra_dx_math::omnipool::types::BalanceUpdate; + use orml_traits::parameter_type_with_key; use polkadot_parachain::primitives::RelayChainBlockNumber; use sp_core::H256; use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::Convert; -use sp_runtime::traits::{ConstU128, ConstU32, ConstU64}; +use sp_runtime::traits::{ConstU128, ConstU32}; use sp_runtime::DispatchResult; use sp_runtime::FixedU128; use sp_runtime::Permill; @@ -38,7 +38,7 @@ use sp_runtime::{ }; use std::cell::RefCell; use std::collections::HashMap; -use std::marker::PhantomData; + use xcm::lts::prelude::*; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -318,7 +318,7 @@ impl + Into + Copy> Mutate for DummyNFT { use crate::Config; use hydradx_traits::Registry; -use pallet_omnipool::traits::{AssetInfo, ExternalPriceProvider, OmnipoolHooks}; +use pallet_omnipool::traits::{ExternalPriceProvider}; pub struct DummyRegistry(sp_std::marker::PhantomData); From b8b064143cb44b4c5db2cb02b2f0add077b7fad2 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 13:10:59 +0200 Subject: [PATCH 42/79] formatting --- integration-tests/src/xcm_rate_limiter.rs | 5 +---- pallets/xcm-rate-limiter/src/lib.rs | 8 +++----- pallets/xcm-rate-limiter/src/tests/defer_xcm.rs | 2 -- pallets/xcm-rate-limiter/src/tests/mock.rs | 2 +- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 8ec6e82ad..4f9f2227a 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -4,14 +4,11 @@ use crate::polkadot_test_net::*; use common_runtime::Weight; -use frame_support::{ - assert_ok, -}; +use frame_support::assert_ok; use orml_traits::currency::MultiCurrency; use pallet_asset_registry::AssetType; - use polkadot_xcm::prelude::*; use xcm_emulator::TestExt; diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index b82f1687c..d44c999b5 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -20,17 +20,15 @@ use codec::{Decode, Encode}; use cumulus_pallet_xcmp_queue::XcmDeferFilter; - -use frame_support::{traits::Get}; - +use frame_support::traits::Get; use orml_traits::GetByKey; use polkadot_parachain::primitives::RelayChainBlockNumber; use scale_info::TypeInfo; use sp_core::MaxEncodedLen; +use sp_runtime::traits::AtLeast32BitUnsigned; use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::Convert; -use sp_runtime::traits::{AtLeast32BitUnsigned}; use sp_runtime::SaturatedConversion; use sp_runtime::{RuntimeDebug, Saturating}; use sp_std::vec::Vec; @@ -61,7 +59,7 @@ pub mod pallet { use super::*; use codec::HasCompact; use frame_support::pallet_prelude::*; - + use polkadot_parachain::primitives::RelayChainBlockNumber; use sp_runtime::traits::BlockNumberProvider; use xcm::lts::MultiLocation; diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 51cc84617..b1db08df7 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -22,8 +22,6 @@ use cumulus_pallet_xcmp_queue::XcmDeferFilter; pub use pretty_assertions::{assert_eq, assert_ne}; - - use xcm::VersionedXcm; #[test] diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 919ed6243..900506dcd 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -318,7 +318,7 @@ impl + Into + Copy> Mutate for DummyNFT { use crate::Config; use hydradx_traits::Registry; -use pallet_omnipool::traits::{ExternalPriceProvider}; +use pallet_omnipool::traits::ExternalPriceProvider; pub struct DummyRegistry(sp_std::marker::PhantomData); From fb67a9128091a8cc24aca889ed3383cf5b47bd57 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 13:12:48 +0200 Subject: [PATCH 43/79] add missing parameter --- runtime/hydradx/src/benchmarking/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/hydradx/src/benchmarking/mod.rs b/runtime/hydradx/src/benchmarking/mod.rs index c5d507fe7..9332a498e 100644 --- a/runtime/hydradx/src/benchmarking/mod.rs +++ b/runtime/hydradx/src/benchmarking/mod.rs @@ -33,6 +33,7 @@ pub fn update_asset(asset_id: AssetId, name: Vec, deposit: Balance) -> Resul name, pallet_asset_registry::AssetType::::Token, Some(deposit), + None, ) .map_err(|_| ()) } From 9db7c29d32fbf24bb8b19323a1c1faca72eba9f7 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 13:16:08 +0200 Subject: [PATCH 44/79] more formatting and similar fixes --- pallets/xcm-rate-limiter/src/benchmarking.rs | 5 ++--- pallets/xcm-rate-limiter/src/lib.rs | 11 ++++------- pallets/xcm-rate-limiter/src/tests/mock.rs | 8 -------- runtime/hydradx/src/benchmarking/mod.rs | 1 + 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/pallets/xcm-rate-limiter/src/benchmarking.rs b/pallets/xcm-rate-limiter/src/benchmarking.rs index 033619c5b..3ebd85ef0 100644 --- a/pallets/xcm-rate-limiter/src/benchmarking.rs +++ b/pallets/xcm-rate-limiter/src/benchmarking.rs @@ -19,9 +19,8 @@ use super::*; -use frame_benchmarking::{account, benchmarks}; -use frame_support::traits::Hooks; -use frame_system::RawOrigin; +use frame_benchmarking::benchmarks; + use sp_std::prelude::*; benchmarks! { diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index d44c999b5..cf7643827 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -29,8 +29,8 @@ use sp_core::MaxEncodedLen; use sp_runtime::traits::AtLeast32BitUnsigned; use sp_runtime::traits::BlockNumberProvider; use sp_runtime::traits::Convert; +use sp_runtime::RuntimeDebug; use sp_runtime::SaturatedConversion; -use sp_runtime::{RuntimeDebug, Saturating}; use sp_std::vec::Vec; use xcm::lts::prelude::*; use xcm::VersionedXcm; @@ -115,7 +115,6 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, MultiLocation, AccumulatedAmount, ValueQuery>; #[pallet::event] - #[pallet::generate_deposit(pub(crate) fn deposit_event)] pub enum Event {} #[pallet::error] @@ -173,11 +172,9 @@ impl Pallet { use Instruction::*; match instruction { // NOTE: This does not address the native asset "coming back" from other chains. - ReserveAssetDeposited(multi_assets) | ReceiveTeleportedAsset(multi_assets) => multi_assets - .inner() - .iter() - .flat_map(|asset| get_loc_and_amount(asset)) - .collect(), + ReserveAssetDeposited(multi_assets) | ReceiveTeleportedAsset(multi_assets) => { + multi_assets.inner().iter().flat_map(get_loc_and_amount).collect() + } _ => Vec::new(), } } diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 900506dcd..ec8e04f27 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -51,10 +51,6 @@ pub type Balance = u128; pub const ALICE: u64 = 1; pub const WHITELISTED_ACCCOUNT: u64 = 2; -pub const LP1: u64 = 1; -pub const LP2: u64 = 2; -pub const TRADER: u64 = 4; - pub const HDX: AssetId = 100; pub const DOT: AssetId = 200; pub const DAI: AssetId = 2; @@ -63,13 +59,9 @@ pub const ACA: AssetId = 4; pub const ONE: Balance = 1_000_000_000_000; -pub const INITIAL_LIQUIDITY: Balance = 1_000_000; pub const REGISTERED_ASSET: AssetId = 1000; pub const NATIVE_AMOUNT: Balance = 10_000 * ONE; -pub const FIVE_PERCENT: (u32, u32) = (500, 10_000); -pub const TEN_PERCENT: (u32, u32) = (1_000, 10_000); - thread_local! { pub static POSITIONS: RefCell> = RefCell::new(HashMap::default()); pub static REGISTERED_ASSETS: RefCell> = RefCell::new(HashMap::default()); diff --git a/runtime/hydradx/src/benchmarking/mod.rs b/runtime/hydradx/src/benchmarking/mod.rs index 9332a498e..a2f003d15 100644 --- a/runtime/hydradx/src/benchmarking/mod.rs +++ b/runtime/hydradx/src/benchmarking/mod.rs @@ -21,6 +21,7 @@ pub fn register_asset(name: Vec, deposit: Balance) -> Result { pallet_asset_registry::AssetType::::Token, deposit, None, + None, ) .map_err(|_| ()) } From 72eb5914804c1b89a3c52f80fa86ce49f9d25b4d Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 8 May 2023 13:21:31 +0200 Subject: [PATCH 45/79] make clippy even happier --- Cargo.lock | 100 ++++++++++----------- integration-tests/src/xcm_rate_limiter.rs | 5 +- pallets/xcm-rate-limiter/src/tests/mock.rs | 34 ------- 3 files changed, 52 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7fdf042df..7d841d715 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1537,7 +1537,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "clap 4.2.4", "parity-scale-codec", @@ -1552,7 +1552,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1575,7 +1575,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1604,7 +1604,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1650,7 +1650,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1673,7 +1673,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1696,7 +1696,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1724,7 +1724,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "frame-support", "frame-system", @@ -1740,7 +1740,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1786,7 +1786,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1797,7 +1797,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1813,7 +1813,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1835,7 +1835,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1851,7 +1851,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1874,7 +1874,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "futures", @@ -1887,7 +1887,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1905,7 +1905,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1930,7 +1930,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1949,7 +1949,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -1989,7 +1989,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2018,7 +2018,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6369,7 +6369,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "frame-benchmarking", "frame-support", @@ -7402,7 +7402,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -14808,124 +14808,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 4f9f2227a..80a6a6b8d 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -19,10 +19,9 @@ fn get_message_hash_from_event(n: usize) -> Option<[u8; 32]> { use cumulus_pallet_xcmp_queue::Event; use hydradx_runtime::RuntimeEvent; let RuntimeEvent::XcmpQueue(Event::XcmpMessageSent { message_hash }) = &last_hydra_events(n)[0] else { - assert!(false, "expecting to find message sent event"); - return None + panic!("expecting to find message sent event"); }; - message_hash.clone() + *message_hash } #[test] diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index ec8e04f27..50bd6a4b1 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -48,7 +48,6 @@ pub type AccountId = u64; pub type AssetId = u32; pub type Balance = u128; -pub const ALICE: u64 = 1; pub const WHITELISTED_ACCCOUNT: u64 = 2; pub const HDX: AssetId = 100; @@ -408,35 +407,6 @@ impl Default for ExtBuilder { } impl ExtBuilder { - pub fn with_endowed_accounts(mut self, accounts: Vec<(u64, AssetId, Balance)>) -> Self { - self.endowed_accounts = accounts; - self - } - pub fn add_endowed_accounts(mut self, account: (u64, AssetId, Balance)) -> Self { - self.endowed_accounts.push(account); - self - } - pub fn with_registered_asset(mut self, asset: AssetId) -> Self { - self.registered_assets.push(asset); - self - } - - pub fn with_initial_pool(mut self, stable_price: FixedU128, native_price: FixedU128) -> Self { - self.init_pool = Some((stable_price, native_price)); - self - } - - pub fn with_token( - mut self, - asset_id: AssetId, - price: FixedU128, - position_owner: AccountId, - amount: Balance, - ) -> Self { - self.pool_tokens.push((asset_id, price, position_owner, amount)); - self - } - pub fn build(self) -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); @@ -527,10 +497,6 @@ impl ExtBuilder { } } -pub fn expect_events(e: Vec) { - test_utils::expect_events::(e); -} - pub struct WithdrawFeePriceOracle; impl ExternalPriceProvider for WithdrawFeePriceOracle { From e410fb4f7055109f5010ab50c70eda5da252bc03 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 1 Jun 2023 17:54:33 +0200 Subject: [PATCH 46/79] formatting --- integration-tests/src/polkadot_test_net.rs | 4 ++-- runtime/hydradx/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-tests/src/polkadot_test_net.rs b/integration-tests/src/polkadot_test_net.rs index 48fc9b863..08788f644 100644 --- a/integration-tests/src/polkadot_test_net.rs +++ b/integration-tests/src/polkadot_test_net.rs @@ -237,8 +237,8 @@ pub fn hydra_ext() -> sp_io::TestExternalities { .unwrap(); pallet_transaction_multi_payment::GenesisConfig:: { - currencies: vec![( - LRNA, Price::from(1)), + currencies: vec![ + (LRNA, Price::from(1)), (DAI, Price::from(1)), (ACA, Price::from(1)), (BTC, Price::from_inner(134_000_000)), diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 7600d2b9d..0ba312dda 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -1101,7 +1101,7 @@ construct_runtime!( OmnipoolLiquidityMining: pallet_omnipool_liquidity_mining = 63, OTC: pallet_otc = 64, CircuitBreaker: pallet_circuit_breaker = 65, - // DCA = 66 + // DCA = 66 Router: pallet_route_executor = 67, XcmRateLimiter: pallet_xcm_rate_limiter = 68, From c4985fdbd18caf3adea4397a16be819dd5cf5402 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 1 Jun 2023 18:01:12 +0200 Subject: [PATCH 47/79] bump crate versions --- Cargo.lock | 6 +++--- integration-tests/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- runtime/testing-hydradx/Cargo.toml | 2 +- runtime/testing-hydradx/src/lib.rs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6428694d1..98eb65768 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3838,7 +3838,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "155.0.0" +version = "156.0.0" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", @@ -10160,7 +10160,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.7.9" +version = "1.7.10" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", @@ -13075,7 +13075,7 @@ dependencies = [ [[package]] name = "testing-hydradx-runtime" -version = "155.0.0" +version = "156.0.0" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 19d406ee6..5ac14e0f2 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.7.9" +version = "1.7.10" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 10fa76c7b..b9aa10843 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "155.0.0" +version = "156.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 0ba312dda..ae0611b0f 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -107,7 +107,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 155, + spec_version: 156, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/testing-hydradx/Cargo.toml b/runtime/testing-hydradx/Cargo.toml index ac63c4f1e..40b189787 100644 --- a/runtime/testing-hydradx/Cargo.toml +++ b/runtime/testing-hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "testing-hydradx-runtime" -version = "155.0.0" +version = "156.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/testing-hydradx/src/lib.rs b/runtime/testing-hydradx/src/lib.rs index cfd7d9ff4..50d85e451 100644 --- a/runtime/testing-hydradx/src/lib.rs +++ b/runtime/testing-hydradx/src/lib.rs @@ -114,7 +114,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testing-hydradx"), impl_name: create_runtime_str!("testing-hydradx"), authoring_version: 1, - spec_version: 155, + spec_version: 156, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From e4d3d3bfa5e3332357db451de0271a686fb7792a Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 11:53:29 +0200 Subject: [PATCH 48/79] activate std for runtime deps in integration tests --- integration-tests/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 5ac14e0f2..1621456e4 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -175,4 +175,7 @@ std = [ "pallet-authorship/std", "hydradx-traits/std", "pallet-relaychain-info/std", + "common-runtime/std", + "polkadot-runtime/std", + "hydradx-runtime/std", ] From 90f8fc4dfb203d3171b803d452338a7204af3747 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 11:53:44 +0200 Subject: [PATCH 49/79] update cargo.lock --- Cargo.lock | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98eb65768..abb7b9ba0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "clap 4.3.0", "parity-scale-codec", @@ -1634,7 +1634,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1657,7 +1657,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1709,7 +1709,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1755,7 +1755,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1806,7 +1806,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "frame-support", "frame-system", @@ -1822,7 +1822,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1868,7 +1868,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1879,7 +1879,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1917,7 +1917,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1956,7 +1956,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "futures", @@ -1969,7 +1969,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1987,7 +1987,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2012,7 +2012,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2031,7 +2031,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2071,7 +2071,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6505,7 +6505,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "frame-benchmarking", "frame-support", @@ -7742,7 +7742,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -15220,124 +15220,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#9145c8ae175e7cccb41473adb6c1cf6f9cac2f42" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" From 45f35b628adcb73043034e6edbed2870e3fa77a7 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 12:18:40 +0200 Subject: [PATCH 50/79] adjust integation test to new relay block number source --- integration-tests/src/xcm_rate_limiter.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 80a6a6b8d..e798af01c 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -3,14 +3,10 @@ use crate::polkadot_test_net::*; use common_runtime::Weight; - use frame_support::assert_ok; - use orml_traits::currency::MultiCurrency; use pallet_asset_registry::AssetType; - use polkadot_xcm::prelude::*; - use xcm_emulator::TestExt; /// Returns the message hash in the `XcmpMessageSent` event at the `n`th last event (1-indexed, so if the second to last @@ -84,7 +80,7 @@ fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { cumulus_pallet_xcmp_queue::Event::XcmDeferred { sender: ACALA_PARA_ID.into(), sent_at: 3, - deferred_to: 603, + deferred_to: 604, // received at 4 plus 600 blocks of deferral message_hash, } .into(), From 41d6f3c6ddbadf69ec274d2c2a609f8a6b1622ee Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 13:21:55 +0200 Subject: [PATCH 51/79] extract rate_limiter math to math package --- math/Cargo.toml | 2 + math/src/lib.rs | 1 + math/src/rate_limiter/math.rs | 39 +++++++ math/src/rate_limiter/mod.rs | 6 + math/src/rate_limiter/tests/invariants.rs | 37 ++++++ math/src/rate_limiter/tests/mod.rs | 107 ++++++++++++++++++ pallets/xcm-rate-limiter/Cargo.toml | 12 +- pallets/xcm-rate-limiter/src/lib.rs | 33 +----- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 97 ---------------- primitives/Cargo.toml | 1 + 10 files changed, 200 insertions(+), 135 deletions(-) create mode 100644 math/src/rate_limiter/math.rs create mode 100644 math/src/rate_limiter/mod.rs create mode 100644 math/src/rate_limiter/tests/invariants.rs create mode 100644 math/src/rate_limiter/tests/mod.rs diff --git a/math/Cargo.toml b/math/Cargo.toml index bd5f93434..3a21be1a6 100644 --- a/math/Cargo.toml +++ b/math/Cargo.toml @@ -22,6 +22,8 @@ sp-std = { workspace = true } serde = { version = "1.0.136", optional = true } [dev-dependencies] +# primitives = { workspace = true } + approx = "0.5.1" criterion = "0.4.0" proptest = "1.0.0" diff --git a/math/src/lib.rs b/math/src/lib.rs index 6d532264e..209e5bdff 100644 --- a/math/src/lib.rs +++ b/math/src/lib.rs @@ -23,6 +23,7 @@ pub mod lbp; pub mod liquidity_mining; pub mod omnipool; pub mod omnipool_subpools; +pub mod rate_limiter; pub mod ratio; pub mod stableswap; pub mod support; diff --git a/math/src/rate_limiter/math.rs b/math/src/rate_limiter/math.rs new file mode 100644 index 000000000..3e98db1d9 --- /dev/null +++ b/math/src/rate_limiter/math.rs @@ -0,0 +1,39 @@ +use sp_arithmetic::traits::SaturatedConversion; + +use crate::types::Balance; + +pub fn calculate_deferred_duration(global_duration: u32, rate_limit: Balance, total_accumulated: Balance) -> u32 { + let global_duration: u128 = global_duration.max(1).saturated_into(); + // duration * (incoming + decayed - rate_limit) + let deferred_duration = + global_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); + + deferred_duration.saturated_into() +} + +pub fn calculate_new_accumulated_amount( + global_duration: u32, + rate_limit: Balance, + incoming_amount: Balance, + accumulated_amount: Balance, + blocks_since_last_update: u32, +) -> Balance { + incoming_amount.saturating_add(decay_accumulated_amount( + global_duration, + rate_limit, + accumulated_amount, + blocks_since_last_update, + )) +} + +pub fn decay_accumulated_amount( + global_duration: u32, + rate_limit: Balance, + accumulated_amount: Balance, + blocks_since_last_update: u32, +) -> Balance { + let global_duration: u128 = global_duration.max(1).saturated_into(); + // acc - rate_limit * blocks / duration + accumulated_amount + .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / global_duration) +} diff --git a/math/src/rate_limiter/mod.rs b/math/src/rate_limiter/mod.rs new file mode 100644 index 000000000..9d2ba2aa4 --- /dev/null +++ b/math/src/rate_limiter/mod.rs @@ -0,0 +1,6 @@ +pub mod math; + +#[cfg(test)] +mod tests; + +pub use math::*; diff --git a/math/src/rate_limiter/tests/invariants.rs b/math/src/rate_limiter/tests/invariants.rs new file mode 100644 index 000000000..bc5148276 --- /dev/null +++ b/math/src/rate_limiter/tests/invariants.rs @@ -0,0 +1,37 @@ +use crate::rate_limiter::*; +use crate::types::Balance; + +use proptest::prelude::*; + +prop_compose! { + fn limit_and_exceeding_accumulated()(r in any::())( + rate_limit in Just(r), + accumulated in r..Balance::MAX, + ) -> (Balance, Balance) { + (rate_limit, accumulated) + } +} + +proptest! { + #[test] + fn deferred_duration_should_be_greater_zero_when_limit_exceeded( + global_duration in any::(), + (rate_limit, total_accumulated) in limit_and_exceeding_accumulated(), + ) { + let deferred = calculate_deferred_duration(global_duration, rate_limit, total_accumulated); + prop_assert_ne!(deferred, 0); + } +} + +proptest! { + #[test] + fn decayed_amount_should_be_less_than_initial_accumulated_amount( + global_duration in any::(), + (rate_limit, accumulated_amount) in (any::(),any::()), + blocks_since_last_update in any::(), + ) { + let decayed = decay_accumulated_amount( + global_duration, rate_limit, accumulated_amount, blocks_since_last_update); + prop_assert!(decayed <= accumulated_amount); + } +} diff --git a/math/src/rate_limiter/tests/mod.rs b/math/src/rate_limiter/tests/mod.rs new file mode 100644 index 000000000..bbd0e3807 --- /dev/null +++ b/math/src/rate_limiter/tests/mod.rs @@ -0,0 +1,107 @@ +use super::*; + +mod invariants; + +pub const ONE: u128 = 1_000_000_000_000; + +#[test] +fn decay_accumulated_amount_works() { + assert_eq!(decay_accumulated_amount(600, 100 * ONE, 50 * ONE, 150), 25 * ONE); +} + +#[test] +fn deferred_duration_should_be_calculated_based_on_limit_and_incoming_amounts() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 1500 * ONE; + let accumulated_amount = 400 * ONE; + let total_accumulated_amount = accumulated_amount + incoming_amount; + let duration = calculate_deferred_duration(global_duration, rate_limit, total_accumulated_amount); + + assert_eq!(duration, 9); +} + +#[test] +fn deferred_duration_should_return_zero_when_limit_not_reached() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 900 * ONE; + let accumulated_amount = 0; + let total_accumulated_amount = accumulated_amount + incoming_amount; + + let duration = calculate_deferred_duration(global_duration, rate_limit, total_accumulated_amount); + + assert_eq!(duration, 0); +} + +#[test] +fn accumulated_amount_for_deferred_duration_should_decay() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 1100 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 12; + let accumulated_amount = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(accumulated_amount, 1100 * ONE); +} + +#[test] +fn defer_duration_should_incorporate_decay_amounts_and_incoming() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 1100 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 6; + let accumulated_amount = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(accumulated_amount, 1700 * ONE); +} + +#[test] +fn long_time_since_update_should_reset_rate_limit() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 700 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 20; + let accumulated_amount = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(accumulated_amount, 700 * ONE); +} + +#[test] +fn calculate_new_accumulated_amount_should_decay_old_amounts_and_sum() { + let global_duration = 10; + let rate_limit = 1000 * ONE; + let incoming_amount = 700 * ONE; + let accumulated_amount = 1200 * ONE; + let blocks_since_last_update = 6; + let total_accumulated = calculate_new_accumulated_amount( + global_duration, + rate_limit, + incoming_amount, + accumulated_amount, + blocks_since_last_update, + ); + + assert_eq!(total_accumulated, 700 * ONE + 600 * ONE); +} diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index bc8021694..10323d6ae 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -16,6 +16,11 @@ serde = { features = ["derive"], optional = true, version = "1.0.136" } codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.4.0" } scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } +# Hydradx +hydradx-traits = { workspace = true } +hydra-dx-math = { workspace = true } +pallet-omnipool = { workspace = true } + # Substrate dependencies frame-benchmarking = { workspace = true, optional = true} frame-support = { workspace = true } @@ -33,18 +38,12 @@ polkadot-parachain = { workspace = true } # Cumulus cumulus-pallet-xcmp-queue = { workspace = true } -pallet-omnipool = { workspace = true } - -# Warehouse -hydradx-traits = { workspace = true } - # orml orml-traits = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, features = ["std"] } orml-tokens = { workspace = true, features = ["std"] } -hydra-dx-math = { workspace = true, features = ["std"] } test-utils = { workspace = true } pretty_assertions = "1.2.1" test-case = "3.0.0" @@ -62,6 +61,7 @@ std = [ 'scale-info/std', 'cumulus-pallet-xcmp-queue/std', 'orml-traits/std', + 'hydra-dx-math/std', ] runtime-benchmarks = [ "frame-benchmarking", diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index cf7643827..1a836e76d 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -21,6 +21,7 @@ use codec::{Decode, Encode}; use cumulus_pallet_xcmp_queue::XcmDeferFilter; use frame_support::traits::Get; +use hydra_dx_math::rate_limiter::{calculate_deferred_duration, calculate_new_accumulated_amount}; use orml_traits::GetByKey; use polkadot_parachain::primitives::RelayChainBlockNumber; @@ -135,38 +136,6 @@ fn get_loc_and_amount(m: &MultiAsset) -> Option<(MultiLocation, u128)> { } } -// TODO: pull out into hdx-math + add property based tests -pub fn calculate_deferred_duration(global_duration: u32, rate_limit: u128, total_accumulated: u128) -> u32 { - let global_duration: u128 = global_duration.max(1).saturated_into(); - // duration * (incoming + decayed - rate_limit) - let deferred_duration = - global_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); - - deferred_duration.saturated_into() -} - -pub fn calculate_new_accumulated_amount( - global_duration: u32, - rate_limit: u128, - incoming_amount: u128, - accumulated_amount: u128, - blocks_since_last_update: u32, -) -> u128 { - incoming_amount.saturating_add(decay( - global_duration, - rate_limit, - accumulated_amount, - blocks_since_last_update, - )) -} - -pub fn decay(global_duration: u32, rate_limit: u128, accumulated_amount: u128, blocks_since_last_update: u32) -> u128 { - let global_duration: u128 = global_duration.max(1).saturated_into(); - // acc - rate_limit * blocks / duration - accumulated_amount - .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / global_duration) -} - impl Pallet { fn get_locations_and_amounts(instruction: &Instruction) -> Vec<(MultiLocation, u128)> { use Instruction::*; diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index b1db08df7..ec3683b1a 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -163,103 +163,6 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { }); } -#[test] -fn deferred_duration_should_be_calculated_based_on_limit_and_incoming_amounts() { - let global_duration = 10; - let rate_limit = 1000 * ONE; - let incoming_amount = 1500 * ONE; - let accumulated_amount = 400 * ONE; - let total_accumulated_amount = accumulated_amount + incoming_amount; - let duration = calculate_deferred_duration(global_duration, rate_limit, total_accumulated_amount); - - assert_eq!(duration, 9); -} - -#[test] -fn deferred_duration_should_return_zero_when_limit_not_reached() { - let global_duration = 10; - let rate_limit = 1000 * ONE; - let incoming_amount = 900 * ONE; - let accumulated_amount = 0; - let total_accumulated_amount = accumulated_amount + incoming_amount; - - let duration = calculate_deferred_duration(global_duration, rate_limit, total_accumulated_amount); - - assert_eq!(duration, 0); -} - -#[test] -fn accumulated_amount_for_deferred_duration_should_decay() { - let global_duration = 10; - let rate_limit = 1000 * ONE; - let incoming_amount = 1100 * ONE; - let accumulated_amount = 1200 * ONE; - let blocks_since_last_update = 12; - let accumulated_amount = calculate_new_accumulated_amount( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); - - assert_eq!(accumulated_amount, 1100 * ONE); -} - -#[test] -fn defer_duration_should_incorporate_decay_amounts_and_incoming() { - let global_duration = 10; - let rate_limit = 1000 * ONE; - let incoming_amount = 1100 * ONE; - let accumulated_amount = 1200 * ONE; - let blocks_since_last_update = 6; - let accumulated_amount = calculate_new_accumulated_amount( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); - - assert_eq!(accumulated_amount, 1700 * ONE); -} - -#[test] -fn long_time_since_update_should_reset_rate_limit() { - let global_duration = 10; - let rate_limit = 1000 * ONE; - let incoming_amount = 700 * ONE; - let accumulated_amount = 1200 * ONE; - let blocks_since_last_update = 20; - let accumulated_amount = calculate_new_accumulated_amount( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); - - assert_eq!(accumulated_amount, 700 * ONE); -} - -#[test] -fn calculate_new_accumulated_amount_should_decay_old_amounts_and_sum() { - let global_duration = 10; - let rate_limit = 1000 * ONE; - let incoming_amount = 700 * ONE; - let accumulated_amount = 1200 * ONE; - let blocks_since_last_update = 6; - let total_accumulated = calculate_new_accumulated_amount( - global_duration, - rate_limit, - incoming_amount, - accumulated_amount, - blocks_since_last_update, - ); - - assert_eq!(total_accumulated, 700 * ONE + 600 * ONE); -} - pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 18d78e209..9b48b7cf6 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -25,4 +25,5 @@ std = [ "codec/std", "scale-info/std", "frame-support/std", + "polkadot-primitives/std", ] From 7504d1a650956ec2bbd7e49699026e31e9728221 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 15:51:33 +0200 Subject: [PATCH 52/79] move RelayChainBlockNumberProvider and HashProvider to adapters --- Cargo.lock | 3 ++ pallets/dca/src/lib.rs | 6 +-- runtime/adapters/Cargo.toml | 5 ++ runtime/adapters/src/lib.rs | 72 +++++++++++++++++++++++++++- runtime/hydradx/src/lib.rs | 72 ++-------------------------- runtime/testing-hydradx/Cargo.toml | 4 +- runtime/testing-hydradx/src/lib.rs | 75 +++--------------------------- runtime/testing-hydradx/src/xcm.rs | 20 +++++++- 8 files changed, 110 insertions(+), 147 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4a70b3d1..5f9d7e976 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3823,6 +3823,8 @@ dependencies = [ name = "hydradx-adapters" version = "0.3.0" dependencies = [ + "cumulus-pallet-parachain-system", + "cumulus-primitives-core", "frame-support", "hydradx-traits", "lazy_static", @@ -13144,6 +13146,7 @@ dependencies = [ "pallet-uniques", "pallet-utility", "pallet-xcm", + "pallet-xcm-rate-limiter", "parachain-info", "parity-scale-codec", "polkadot-parachain", diff --git a/pallets/dca/src/lib.rs b/pallets/dca/src/lib.rs index 02cb79de4..217c28440 100644 --- a/pallets/dca/src/lib.rs +++ b/pallets/dca/src/lib.rs @@ -37,7 +37,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use cumulus_primitives_core::relay_chain::Hash; use frame_support::traits::DefensiveOption; use frame_support::{ ensure, @@ -47,6 +46,7 @@ use frame_support::{ weights::WeightToFee as FrameSupportWeight, }; use frame_system::{ensure_signed, pallet_prelude::OriginFor, Origin}; +use hydradx_adapters::RelayChainBlockHashProvider; use hydradx_traits::pools::SpotPriceProvider; use hydradx_traits::{OraclePeriod, PriceOracle}; use orml_traits::arithmetic::CheckedAdd; @@ -1001,10 +1001,6 @@ where } } -pub trait RelayChainBlockHashProvider { - fn parent_hash() -> Option; -} - pub trait RandomnessProvider { fn generator() -> Result; } diff --git a/runtime/adapters/Cargo.toml b/runtime/adapters/Cargo.toml index c44279cbd..9f49c01d0 100644 --- a/runtime/adapters/Cargo.toml +++ b/runtime/adapters/Cargo.toml @@ -25,6 +25,10 @@ polkadot-xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +# Cumulus dependencies +cumulus-pallet-parachain-system = { workspace = true } +cumulus-primitives-core = { workspace = true } + [dev-dependencies] lazy_static = { features = ["spin_no_std"], version = "1.4.0" } @@ -44,4 +48,5 @@ std = [ "sp-std/std", "xcm-builder/std", "xcm-executor/std", + "cumulus-pallet-parachain-system/std", ] diff --git a/runtime/adapters/src/lib.rs b/runtime/adapters/src/lib.rs index 760cdef3f..3b03eec18 100644 --- a/runtime/adapters/src/lib.rs +++ b/runtime/adapters/src/lib.rs @@ -17,13 +17,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +use cumulus_primitives_core::relay_chain::Hash; use frame_support::weights::{Weight, WeightToFee}; use hydradx_traits::NativePriceOracle; use pallet_transaction_multi_payment::DepositFee; use polkadot_xcm::latest::prelude::*; use sp_runtime::traits::Get; use sp_runtime::{ - traits::{AtLeast32BitUnsigned, Convert, Saturating, Zero}, + traits::{AtLeast32BitUnsigned, BlockNumberProvider, Convert, Saturating, Zero}, FixedPointNumber, FixedPointOperand, SaturatedConversion, }; use sp_std::{collections::btree_map::BTreeMap, marker::PhantomData}; @@ -219,3 +220,72 @@ impl< } } } + +// Relay chain Block number provider. +// Reason why the implementation is different for benchmarks is that it is not possible +// to set or change the block number in a benchmark using parachain system pallet. +// That's why we revert to using the system pallet in the benchmark. +pub struct RelayChainBlockNumberProvider(sp_std::marker::PhantomData); + +#[cfg(not(feature = "runtime-benchmarks"))] +impl BlockNumberProvider for RelayChainBlockNumberProvider { + type BlockNumber = T::BlockNumber; + + fn current_block_number() -> Self::BlockNumber { + let maybe_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); + + if let Some(data) = maybe_data { + data.relay_parent_number.into() + } else { + Self::BlockNumber::default() + } + } +} + +#[cfg(feature = "runtime-benchmarks")] +impl BlockNumberProvider for RelayChainBlockNumberProvider { + type BlockNumber = ::BlockNumber; + + fn current_block_number() -> Self::BlockNumber { + frame_system::Pallet::::current_block_number() + } +} + +pub trait RelayChainBlockHashProvider { + fn parent_hash() -> Option; +} +// The reason why there is difference between PROD and benchmark is that it is not possible +// to set validation data in parachain system pallet in the benchmarks. +// So for benchmarking, we mock it out and return some hardcoded parent hash +pub struct RelayChainBlockHashProviderAdapter(sp_std::marker::PhantomData); + +#[cfg(not(feature = "runtime-benchmarks"))] +impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter +where + Runtime: cumulus_pallet_parachain_system::Config, +{ + fn parent_hash() -> Option { + let validation_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); + match validation_data { + Some(data) => Some(data.parent_head.hash()), + None => None, + } + } +} + +#[cfg(feature = "runtime-benchmarks")] +impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter +where + Runtime: cumulus_pallet_parachain_system::Config, +{ + fn parent_hash() -> Option { + // We use the same hash as for integration tests + // so the integration tests don't fail when they are run with 'runtime-benchmark' feature + let hash = [ + 14, 87, 81, 192, 38, 229, 67, 178, 232, 171, 46, 176, 96, 153, 218, 161, 209, 229, 223, 71, 119, 143, 119, + 135, 250, 171, 69, 205, 241, 47, 227, 168, + ] + .into(); + Some(hash) + } +} diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index b0f655af8..a0e96882a 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -64,7 +64,6 @@ use pallet_transaction_multi_payment::{AddTxAssetOnAccount, DepositAll, RemoveTx use pallet_transaction_payment::TargetedFeeAdjustment; use primitives::{CollectionId, ItemId}; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_runtime::traits::BlockNumberProvider; use common_runtime::adapters::{EmaOraclePriceAdapter, OmnipoolHookAdapter}; pub use common_runtime::*; @@ -75,7 +74,9 @@ mod migrations; mod xcm; pub use hex_literal::hex; -use hydradx_adapters::inspect::MultiInspectAdapter; +use hydradx_adapters::{ + inspect::MultiInspectAdapter, RelayChainBlockHashProviderAdapter, RelayChainBlockNumberProvider, +}; /// Import HydraDX pallets pub use pallet_claims; pub use pallet_genesis_history; @@ -161,72 +162,6 @@ impl Contains for DustRemovalWhitelist { } } -// Relay chain Block number provider. -// Reason why the implementation is different for benchmarks is that it is not possible -// to set or change the block number in a benchmark using parachain system pallet. -// That's why we revert to using the system pallet in the benchmark. -pub struct RelayChainBlockNumberProvider(sp_std::marker::PhantomData); - -#[cfg(not(feature = "runtime-benchmarks"))] -impl BlockNumberProvider for RelayChainBlockNumberProvider { - type BlockNumber = BlockNumber; - - fn current_block_number() -> Self::BlockNumber { - let maybe_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); - - if let Some(data) = maybe_data { - data.relay_parent_number - } else { - Self::BlockNumber::default() - } - } -} - -#[cfg(feature = "runtime-benchmarks")] -impl BlockNumberProvider for RelayChainBlockNumberProvider { - type BlockNumber = ::BlockNumber; - - fn current_block_number() -> Self::BlockNumber { - frame_system::Pallet::::current_block_number() - } -} - -// The reason why there is difference between PROD and benchmark is that it is not possible -// to set validation data in parachain system pallet in the benchmarks. -// So for benchmarking, we mock it out and return some hardcoded parent hash -pub struct RelayChainBlockHashProviderAdapter(sp_std::marker::PhantomData); - -#[cfg(not(feature = "runtime-benchmarks"))] -impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter -where - Runtime: cumulus_pallet_parachain_system::Config, -{ - fn parent_hash() -> Option { - let validation_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); - match validation_data { - Some(data) => Some(data.parent_head.hash()), - None => None, - } - } -} - -#[cfg(feature = "runtime-benchmarks")] -impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter -where - Runtime: cumulus_pallet_parachain_system::Config, -{ - fn parent_hash() -> Option { - // We use the same hash as for integration tests - // so the integration tests don't fail when they are run with 'runtime-benchmark' feature - let hash = [ - 14, 87, 81, 192, 38, 229, 67, 178, 232, 171, 46, 176, 96, 153, 218, 161, 209, 229, 223, 71, 119, 143, 119, - 135, 250, 171, 69, 205, 241, 47, 227, 168, - ] - .into(); - Some(hash) - } -} - pub struct CallFilter; impl Contains for CallFilter { fn contains(call: &RuntimeCall) -> bool { @@ -951,7 +886,6 @@ impl pallet_circuit_breaker::Config for Runtime { } // constants need to be in scope to use as types -use pallet_dca::RelayChainBlockHashProvider; use pallet_ema_oracle::MAX_PERIODS; use pallet_omnipool::traits::EnsurePriceWithin; diff --git a/runtime/testing-hydradx/Cargo.toml b/runtime/testing-hydradx/Cargo.toml index d022cee7f..f18bceff7 100644 --- a/runtime/testing-hydradx/Cargo.toml +++ b/runtime/testing-hydradx/Cargo.toml @@ -64,7 +64,8 @@ pallet-transaction-pause = { workspace = true } pallet-duster = { workspace = true } warehouse-liquidity-mining = { workspace = true } pallet-otc = { workspace = true } -pallet-route-executor = {workspace = true } +pallet-route-executor = { workspace = true } +pallet-xcm-rate-limiter = { workspace = true } # ORML dependencies orml-tokens = { workspace = true } @@ -230,4 +231,5 @@ std = [ "pallet-duster/std", "warehouse-liquidity-mining/std", "pallet-omnipool-liquidity-mining/std", + "pallet-xcm-rate-limiter/std", ] diff --git a/runtime/testing-hydradx/src/lib.rs b/runtime/testing-hydradx/src/lib.rs index 8b79c91ba..0040e9469 100644 --- a/runtime/testing-hydradx/src/lib.rs +++ b/runtime/testing-hydradx/src/lib.rs @@ -57,14 +57,16 @@ use frame_support::{ }, BoundedVec, }; -use hydradx_adapters::inspect::MultiInspectAdapter; +use hydradx_adapters::{ + inspect::MultiInspectAdapter, RelayChainBlockHashProviderAdapter, RelayChainBlockNumberProvider, +}; use hydradx_traits::OraclePeriod; use orml_traits::currency::MutationHooks; use pallet_transaction_multi_payment::{AddTxAssetOnAccount, DepositAll, RemoveTxAssetOnKilled, TransferFees}; use pallet_transaction_payment::TargetedFeeAdjustment; use primitives::{CollectionId, ItemId}; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; -use sp_runtime::traits::{BlockNumberProvider, ConstU32}; +use sp_runtime::traits::ConstU32; use common_runtime::adapters::{EmaOraclePriceAdapter, OmnipoolHookAdapter}; pub use common_runtime::*; @@ -168,72 +170,6 @@ impl Contains for DustRemovalWhitelist { } } -// Relay chain Block number provider. -// Reason why the implementation is different for benchmarks is that it is not possible -// to set or change the block number in a benchmark using parachain system pallet. -// That's why we revert to using the system pallet in the benchmark. -pub struct RelayChainBlockNumberProvider(sp_std::marker::PhantomData); - -#[cfg(not(feature = "runtime-benchmarks"))] -impl BlockNumberProvider for RelayChainBlockNumberProvider { - type BlockNumber = BlockNumber; - - fn current_block_number() -> Self::BlockNumber { - let maybe_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); - - if let Some(data) = maybe_data { - data.relay_parent_number - } else { - Self::BlockNumber::default() - } - } -} - -#[cfg(feature = "runtime-benchmarks")] -impl BlockNumberProvider for RelayChainBlockNumberProvider { - type BlockNumber = ::BlockNumber; - - fn current_block_number() -> Self::BlockNumber { - frame_system::Pallet::::current_block_number() - } -} - -// The reason why there is difference between PROD and benchmark is that it is not possible -// to set validation data in parachain system pallet in the benchmarks. -// So for benchmarking, we mock it out and return some hardcoded parent hash -pub struct RelayChainBlockHashProviderAdapter(sp_std::marker::PhantomData); - -#[cfg(not(feature = "runtime-benchmarks"))] -impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter -where - Runtime: cumulus_pallet_parachain_system::Config, -{ - fn parent_hash() -> Option { - let validation_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); - match validation_data { - Some(data) => Some(data.parent_head.hash()), - None => None, - } - } -} - -#[cfg(feature = "runtime-benchmarks")] -impl RelayChainBlockHashProvider for RelayChainBlockHashProviderAdapter -where - Runtime: cumulus_pallet_parachain_system::Config, -{ - fn parent_hash() -> Option { - // We use the same hash as for integration tests - // so the integration tests don't fail when they are run with 'runtime-benchmark' feature - let hash = [ - 14, 87, 81, 192, 38, 229, 67, 178, 232, 171, 46, 176, 96, 153, 218, 161, 209, 229, 223, 71, 119, 143, 119, - 135, 250, 171, 69, 205, 241, 47, 227, 168, - ] - .into(); - Some(hash) - } -} - parameter_types! { pub const Version: RuntimeVersion = VERSION; /// Block weights base values and limits. @@ -948,7 +884,6 @@ impl pallet_circuit_breaker::Config for Runtime { } // constants need to be in scope to use as types -use pallet_dca::RelayChainBlockHashProvider; use pallet_ema_oracle::MAX_PERIODS; use pallet_omnipool::traits::EnsurePriceWithin; @@ -1098,7 +1033,9 @@ construct_runtime!( OmnipoolLiquidityMining: pallet_omnipool_liquidity_mining = 63, OTC: pallet_otc = 64, CircuitBreaker: pallet_circuit_breaker = 65, + // DCA = 66 Router: pallet_route_executor = 67, + XcmRateLimiter: pallet_xcm_rate_limiter = 68, // ORML related modules Tokens: orml_tokens = 77, diff --git a/runtime/testing-hydradx/src/xcm.rs b/runtime/testing-hydradx/src/xcm.rs index 89286a626..e3b183de9 100644 --- a/runtime/testing-hydradx/src/xcm.rs +++ b/runtime/testing-hydradx/src/xcm.rs @@ -9,7 +9,7 @@ use hydradx_adapters::{MultiCurrencyTrader, ToFeeReceiver}; use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key}; pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; +use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; use polkadot_xcm::v3::prelude::*; use polkadot_xcm::v3::Weight as XcmWeight; use primitives::Price; @@ -135,7 +135,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ExecuteDeferredOrigin = EnsureRoot; type MaxDeferredMessages = ConstU32<100>; type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; - type XcmDeferFilter = (); + type XcmDeferFilter = XcmRateLimiter; } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -206,6 +206,22 @@ impl pallet_xcm::Config for Runtime { type ReachableDest = (); } +parameter_types! { + pub DeferDuration: RelayChainBlockNumber = 600; // 1 hour + pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days +} + +impl pallet_xcm_rate_limiter::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type AssetId = AssetId; + type DeferDuration = DeferDuration; + type MaxDeferDuration = MaxDeferDuration; + type RelayBlockNumberProvider = RelayChainBlockNumberProvider; + type CurrencyIdConvert = CurrencyIdConvert; + type RateLimitFor = pallet_asset_registry::XcmRateLimitsInRegistry; + type WeightInfo = (); +} + pub struct CurrencyIdConvert; use primitives::constants::chain::CORE_ASSET_ID; From 0c9f2027494ab303aadfac1823008538efb0728a Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 15:58:04 +0200 Subject: [PATCH 53/79] add frame_system dep --- Cargo.lock | 1 + runtime/adapters/Cargo.toml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 5f9d7e976..f09604bbf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3826,6 +3826,7 @@ dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", "frame-support", + "frame-system", "hydradx-traits", "lazy_static", "log", diff --git a/runtime/adapters/Cargo.toml b/runtime/adapters/Cargo.toml index 9f49c01d0..0d6fc14d9 100644 --- a/runtime/adapters/Cargo.toml +++ b/runtime/adapters/Cargo.toml @@ -17,6 +17,7 @@ pallet-transaction-multi-payment = { workspace = true } # Substrate dependencies frame-support = { workspace = true } +frame-system = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } @@ -41,6 +42,7 @@ runtime-benchmarks = [ std = [ "codec/std", "frame-support/std", + "frame-system/std", "hydradx-traits/std", "pallet-transaction-multi-payment/std", "polkadot-xcm/std", From a24fa51712f1479c64a833adfc3316e551a81e70 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 5 Jun 2023 17:35:17 +0200 Subject: [PATCH 54/79] use RelayChainBlockNumber type in adapter --- Cargo.lock | 1 + runtime/adapters/Cargo.toml | 2 ++ runtime/adapters/src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f09604bbf..7cd1f529b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3832,6 +3832,7 @@ dependencies = [ "log", "pallet-transaction-multi-payment", "parity-scale-codec", + "polkadot-parachain", "sp-runtime", "sp-std", "xcm", diff --git a/runtime/adapters/Cargo.toml b/runtime/adapters/Cargo.toml index 0d6fc14d9..e22b06a1c 100644 --- a/runtime/adapters/Cargo.toml +++ b/runtime/adapters/Cargo.toml @@ -22,6 +22,7 @@ sp-runtime = { workspace = true } sp-std = { workspace = true } # Polkadot dependencies +polkadot-parachain = { workspace = true } polkadot-xcm = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } @@ -51,4 +52,5 @@ std = [ "xcm-builder/std", "xcm-executor/std", "cumulus-pallet-parachain-system/std", + "polkadot-parachain/std", ] diff --git a/runtime/adapters/src/lib.rs b/runtime/adapters/src/lib.rs index 3b03eec18..c500714d8 100644 --- a/runtime/adapters/src/lib.rs +++ b/runtime/adapters/src/lib.rs @@ -229,13 +229,13 @@ pub struct RelayChainBlockNumberProvider(sp_std::marker::PhantomData); #[cfg(not(feature = "runtime-benchmarks"))] impl BlockNumberProvider for RelayChainBlockNumberProvider { - type BlockNumber = T::BlockNumber; + type BlockNumber = polkadot_parachain::primitives::RelayChainBlockNumber; fn current_block_number() -> Self::BlockNumber { let maybe_data = cumulus_pallet_parachain_system::Pallet::::validation_data(); if let Some(data) = maybe_data { - data.relay_parent_number.into() + data.relay_parent_number } else { Self::BlockNumber::default() } From 8efe496b3d021c3df3c031a39ea35b966800343b Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 11:20:42 +0200 Subject: [PATCH 55/79] use default weight in mock --- pallets/xcm-rate-limiter/src/tests/mock.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 50bd6a4b1..105549209 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -510,6 +510,6 @@ impl ExternalPriceProvider for WithdrawFeePriceOracle { } fn get_price_weight() -> Weight { - todo!() + Weight::default() } } From 3790fe0c97a9e6b5fd73109cb5d40ec65ffd431c Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 11:23:04 +0200 Subject: [PATCH 56/79] update cumulus to fixed benchmark version of xcmp queue --- Cargo.lock | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7cd1f529b..0777cfcb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1619,7 +1619,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "clap 4.3.0", "parity-scale-codec", @@ -1634,7 +1634,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1657,7 +1657,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1686,7 +1686,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1709,7 +1709,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1755,7 +1755,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1778,7 +1778,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1806,7 +1806,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "frame-support", "frame-system", @@ -1822,7 +1822,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1839,7 +1839,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1868,7 +1868,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1879,7 +1879,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1895,7 +1895,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1917,7 +1917,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1933,7 +1933,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1956,7 +1956,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "futures", @@ -1969,7 +1969,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1987,7 +1987,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2012,7 +2012,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2031,7 +2031,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2071,7 +2071,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2100,7 +2100,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6509,7 +6509,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "frame-benchmarking", "frame-support", @@ -7746,7 +7746,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -15225,124 +15225,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#d3e3da30e9e46abbe5e964c8ebe4f5437ea2f928" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" From a5d7811e069547a0c43ff3c5b9f5fe618bff3d0f Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 11:32:57 +0200 Subject: [PATCH 57/79] bump crate versions --- Cargo.lock | 8 ++++---- math/Cargo.toml | 2 +- pallets/otc/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- runtime/adapters/Cargo.toml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 596fba52d..fb20f0ad0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3724,7 +3724,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" -version = "7.1.0" +version = "7.2.0" dependencies = [ "approx", "criterion", @@ -3822,7 +3822,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" -version = "0.3.0" +version = "0.3.1" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -7148,7 +7148,7 @@ dependencies = [ [[package]] name = "pallet-otc" -version = "1.0.1" +version = "1.0.2" dependencies = [ "frame-benchmarking", "frame-support", @@ -9389,7 +9389,7 @@ dependencies = [ [[package]] name = "primitives" -version = "5.7.2" +version = "5.7.3" dependencies = [ "frame-support", "hex-literal 0.3.4", diff --git a/math/Cargo.toml b/math/Cargo.toml index 3a21be1a6..6e6f2eb3e 100644 --- a/math/Cargo.toml +++ b/math/Cargo.toml @@ -6,7 +6,7 @@ license = 'Apache-2.0' name = "hydra-dx-math" description = "A collection of utilities to make performing liquidity pool calculations more convenient." repository = 'https://github.com/galacticcouncil/hydradx-math' -version = "7.1.0" +version = "7.2.0" [dependencies] primitive-types = {default-features = false, version = '0.12.0'} diff --git a/pallets/otc/Cargo.toml b/pallets/otc/Cargo.toml index 4b02a166b..b90a3443f 100644 --- a/pallets/otc/Cargo.toml +++ b/pallets/otc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-otc' -version = '1.0.1' +version = "1.0.2" description = 'A pallet for trustless over-the-counter trading' authors = ['GalacticCouncil'] edition = '2021' diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 9b48b7cf6..5be818789 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "5.7.2" +version = "5.7.3" authors = ["GalacticCouncil"] edition = "2021" repository = "https://github.com/galacticcouncil/HydraDX-node" diff --git a/runtime/adapters/Cargo.toml b/runtime/adapters/Cargo.toml index e22b06a1c..22fbeaefa 100644 --- a/runtime/adapters/Cargo.toml +++ b/runtime/adapters/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-adapters" -version = "0.3.0" +version = "0.3.1" description = "Structs and other generic types for building runtimes." authors = ["GalacticCouncil"] edition = "2021" From 5dcf30183d32bd25e4a16164243debc15412d061 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 11:34:24 +0200 Subject: [PATCH 58/79] bump runtime version --- Cargo.lock | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb20f0ad0..da27cd6fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3843,7 +3843,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "158.0.0" +version = "159.0.0" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 5a6f10a5f..f0d568f2a 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "158.0.0" +version = "159.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 26ae4d7c2..0070b156c 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -111,7 +111,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 158, + spec_version: 159, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 06213a2b19da3a36509d0ff86fdb96726b49a384 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 11:39:58 +0200 Subject: [PATCH 59/79] bump more crates --- Cargo.lock | 4 ++-- integration-tests/Cargo.toml | 2 +- pallets/dca/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da27cd6fe..700a2f107 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6581,7 +6581,7 @@ dependencies = [ [[package]] name = "pallet-dca" -version = "1.1.0" +version = "1.1.1" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -10147,7 +10147,7 @@ dependencies = [ [[package]] name = "runtime-integration-tests" -version = "1.7.11" +version = "1.7.12" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 23adf339c..c49cafefb 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "runtime-integration-tests" -version = "1.7.11" +version = "1.7.12" description = "Integration tests" authors = ["GalacticCouncil"] edition = "2021" diff --git a/pallets/dca/Cargo.toml b/pallets/dca/Cargo.toml index 1f323cc8f..0b15abcfa 100644 --- a/pallets/dca/Cargo.toml +++ b/pallets/dca/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-dca' -version = '1.1.0' +version = "1.1.1" description = 'A pallet to manage DCA scheduling' authors = ['GalacticCouncil'] edition = '2021' From eb3db7718179aa68dea915e5e63ff8ab043032dd Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 12:35:41 +0200 Subject: [PATCH 60/79] add doc comments and another prop test --- math/src/rate_limiter/math.rs | 24 +++++++++++-------- math/src/rate_limiter/tests/invariants.rs | 28 +++++++++++++++++++---- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/math/src/rate_limiter/math.rs b/math/src/rate_limiter/math.rs index 3e98db1d9..21995e39d 100644 --- a/math/src/rate_limiter/math.rs +++ b/math/src/rate_limiter/math.rs @@ -2,38 +2,44 @@ use sp_arithmetic::traits::SaturatedConversion; use crate::types::Balance; -pub fn calculate_deferred_duration(global_duration: u32, rate_limit: Balance, total_accumulated: Balance) -> u32 { - let global_duration: u128 = global_duration.max(1).saturated_into(); - // duration * (incoming + decayed - rate_limit) +/// Calculate how long to defer something based on ratio between `rate_limit` and `total_accumulated`. +/// Will return 0 if `total_accumulated` is less than `rate_limit`. +/// 2x `rate_limit` accumulated tokens will be deferred by `defer_duration`. +pub fn calculate_deferred_duration(defer_duration: u32, rate_limit: Balance, total_accumulated: Balance) -> u32 { + let defer_duration: u128 = defer_duration.max(1).saturated_into(); + // duration * (accumulated - rate_limit) / rate_limit let deferred_duration = - global_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); + defer_duration.saturating_mul(total_accumulated.saturating_sub(rate_limit)) / rate_limit.max(1); deferred_duration.saturated_into() } +/// Calculate how much balance has accumulated by decaying the previous `accumulated_amount` based on +/// `blocks_since_last_update` and adding `incoming_amount`. pub fn calculate_new_accumulated_amount( - global_duration: u32, + defer_duration: u32, rate_limit: Balance, incoming_amount: Balance, accumulated_amount: Balance, blocks_since_last_update: u32, ) -> Balance { incoming_amount.saturating_add(decay_accumulated_amount( - global_duration, + defer_duration, rate_limit, accumulated_amount, blocks_since_last_update, )) } +/// Calculate how much the `accumulated_amount` has decayed based on `blocks_since_last_update` and `rate_limit`. pub fn decay_accumulated_amount( - global_duration: u32, + defer_duration: u32, rate_limit: Balance, accumulated_amount: Balance, blocks_since_last_update: u32, ) -> Balance { - let global_duration: u128 = global_duration.max(1).saturated_into(); + let defer_duration: u128 = defer_duration.max(1).saturated_into(); // acc - rate_limit * blocks / duration accumulated_amount - .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / global_duration) + .saturating_sub(rate_limit.saturating_mul(blocks_since_last_update.saturated_into()) / defer_duration) } diff --git a/math/src/rate_limiter/tests/invariants.rs b/math/src/rate_limiter/tests/invariants.rs index bc5148276..010b9aa41 100644 --- a/math/src/rate_limiter/tests/invariants.rs +++ b/math/src/rate_limiter/tests/invariants.rs @@ -12,26 +12,46 @@ prop_compose! { } } +prop_compose! { + fn limit_and_twice_accumulated()(r in 0..(Balance::MAX / 2))( + rate_limit in Just(r), + accumulated in Just(r * 2), + ) -> (Balance, Balance) { + (rate_limit, accumulated) + } +} + proptest! { #[test] fn deferred_duration_should_be_greater_zero_when_limit_exceeded( - global_duration in any::(), + defer_duration in any::(), (rate_limit, total_accumulated) in limit_and_exceeding_accumulated(), ) { - let deferred = calculate_deferred_duration(global_duration, rate_limit, total_accumulated); + let deferred = calculate_deferred_duration(defer_duration, rate_limit, total_accumulated); prop_assert_ne!(deferred, 0); } } +proptest! { + #[test] + fn returned_value_should_be_defer_duration_when_total_accumulated_is_twice_the_rate_limit( + defer_duration in any::(), + (rate_limit, total_accumulated) in limit_and_twice_accumulated(), + ) { + let deferred = calculate_deferred_duration(defer_duration, rate_limit, total_accumulated); + prop_assert_ne!(deferred, defer_duration); + } +} + proptest! { #[test] fn decayed_amount_should_be_less_than_initial_accumulated_amount( - global_duration in any::(), + defer_duration in any::(), (rate_limit, accumulated_amount) in (any::(),any::()), blocks_since_last_update in any::(), ) { let decayed = decay_accumulated_amount( - global_duration, rate_limit, accumulated_amount, blocks_since_last_update); + defer_duration, rate_limit, accumulated_amount, blocks_since_last_update); prop_assert!(decayed <= accumulated_amount); } } From 9522d1c0437360a66e7176ef94d623f8109f425e Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 12:43:21 +0200 Subject: [PATCH 61/79] update xcmp_queue to new version with weights and add benchmarked weights --- Cargo.lock | 100 +++++++++++------------ runtime/common/src/weights/xcmp_queue.rs | 34 ++++++-- 2 files changed, 79 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 700a2f107..8900829e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1621,7 +1621,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "clap 4.3.0", "parity-scale-codec", @@ -1636,7 +1636,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1659,7 +1659,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1688,7 +1688,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1711,7 +1711,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1780,7 +1780,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "frame-support", "frame-system", @@ -1824,7 +1824,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1841,7 +1841,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1870,7 +1870,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1881,7 +1881,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1897,7 +1897,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1919,7 +1919,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1958,7 +1958,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "futures", @@ -1971,7 +1971,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1989,7 +1989,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2014,7 +2014,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2033,7 +2033,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2073,7 +2073,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2102,7 +2102,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6510,7 +6510,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "frame-benchmarking", "frame-support", @@ -7729,7 +7729,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -15108,124 +15108,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#95c9e5f278276b56ee67316136672a17b0757350" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" diff --git a/runtime/common/src/weights/xcmp_queue.rs b/runtime/common/src/weights/xcmp_queue.rs index 222ee1831..c3b6d587f 100644 --- a/runtime/common/src/weights/xcmp_queue.rs +++ b/runtime/common/src/weights/xcmp_queue.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for cumulus_pallet_xcmp_queue //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-06-05, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2023-06-14, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -55,16 +55,40 @@ impl WeightInfo for HydraWeight { // Storage: XcmpQueue QueueConfig (r:1 w:1) // Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_u32() -> Weight { - // Minimum execution time: 4_125 nanoseconds. - Weight::from_ref_time(4_297_000 as u64) + // Minimum execution time: 4_088 nanoseconds. + Weight::from_ref_time(4_368_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) // Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) fn set_config_with_weight() -> Weight { - // Minimum execution time: 4_225 nanoseconds. - Weight::from_ref_time(4_429_000 as u64) + // Minimum execution time: 4_111 nanoseconds. + Weight::from_ref_time(4_326_000 as u64) + .saturating_add(T::DbWeight::get().reads(1 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } + // Storage: XcmpQueue QueueConfig (r:1 w:0) + // Proof Skipped: XcmpQueue QueueConfig (max_values: Some(1), max_size: None, mode: Measured) + // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) + // Storage: XcmpQueue CounterForOverweight (r:1 w:1) + // Proof: XcmpQueue CounterForOverweight (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: XcmpQueue OverweightCount (r:1 w:1) + // Proof Skipped: XcmpQueue OverweightCount (max_values: Some(1), max_size: None, mode: Measured) + // Storage: XcmpQueue Overweight (r:100 w:100) + // Proof Skipped: XcmpQueue Overweight (max_values: None, max_size: None, mode: Measured) + fn service_deferred() -> Weight { + // Minimum execution time: 90_934_683 nanoseconds. + Weight::from_ref_time(91_491_151_000 as u64) + .saturating_add(T::DbWeight::get().reads(104 as u64)) + .saturating_add(T::DbWeight::get().writes(103 as u64)) + } + // Storage: XcmpQueue DeferredXcmMessages (r:1 w:1) + // Proof Skipped: XcmpQueue DeferredXcmMessages (max_values: None, max_size: None, mode: Measured) + fn discard_deferred() -> Weight { + // Minimum execution time: 62_131_073 nanoseconds. + Weight::from_ref_time(63_092_826_000 as u64) .saturating_add(T::DbWeight::get().reads(1 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } From 0b0cad915f4fd32839be1ccd11860961370c69af Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 12:53:02 +0200 Subject: [PATCH 62/79] update xcmp queue --- Cargo.lock | 102 ++++++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8900829e3..0d4418290 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1621,7 +1621,7 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "clap 4.3.0", "parity-scale-codec", @@ -1636,7 +1636,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1659,7 +1659,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1688,7 +1688,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1711,7 +1711,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1734,7 +1734,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1780,7 +1780,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "frame-support", "frame-system", @@ -1824,7 +1824,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1841,7 +1841,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1870,7 +1870,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1881,7 +1881,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1896,8 +1896,8 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" -version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +version = "0.2.0" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1919,7 +1919,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1958,7 +1958,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "futures", @@ -1971,7 +1971,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1989,7 +1989,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2014,7 +2014,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2033,7 +2033,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2073,7 +2073,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2102,7 +2102,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -6510,7 +6510,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "frame-benchmarking", "frame-support", @@ -7729,7 +7729,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -15108,124 +15108,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#280323deee80c837ab15b82e35f14ae3acdedd94" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" From f29655da3cf36ebdafb8167df5455fc3b8965e65 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 14:33:17 +0200 Subject: [PATCH 63/79] bump common runtime --- Cargo.lock | 2 +- runtime/common/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0d4418290..8cf81130a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1196,7 +1196,7 @@ dependencies = [ [[package]] name = "common-runtime" -version = "102.3.12" +version = "102.3.13" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 063fbdbf9..64c3814bb 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "common-runtime" -version = "102.3.12" +version = "102.3.13" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" From e4be8cd6c1a93b5d5d08103455b9c8deca0465e7 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 14 Jun 2023 15:19:53 +0200 Subject: [PATCH 64/79] return approximate weight consumed by deferred_by --- Cargo.lock | 541 +++++++++--------- pallets/xcm-rate-limiter/src/benchmarking.rs | 36 -- pallets/xcm-rate-limiter/src/lib.rs | 43 +- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 18 +- 4 files changed, 305 insertions(+), 333 deletions(-) delete mode 100644 pallets/xcm-rate-limiter/src/benchmarking.rs diff --git a/Cargo.lock b/Cargo.lock index 8cf81130a..ec8a0b126 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,7 +153,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -165,7 +165,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -181,9 +181,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -194,6 +194,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4436e0292ab1bb631b42973c61205e704475fe8126af845c8d923c0996328127" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -314,9 +320,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "8868f09ff8cea88b079da74ae569d9b8c62a23c68c746240b704ee6f7525c89c" [[package]] name = "asn1-rs" @@ -331,7 +337,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -347,7 +353,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -411,9 +417,9 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.19", + "rustix 0.37.20", "slab", - "socket2", + "socket2 0.4.9", "waker-fn", ] @@ -434,7 +440,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -490,7 +496,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide 0.6.2", - "object 0.30.3", + "object 0.30.4", "rustc-demangle", ] @@ -520,9 +526,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f1e31e207a6b8fb791a38ea3105e6cb541f55e4d029902d3039a4ad07cc4105" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" @@ -680,7 +686,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.3", "constant_time_eq", ] @@ -691,18 +697,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.3", "constant_time_eq", ] [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.3", "cc", "cfg-if", "constant_time_eq", @@ -973,13 +979,13 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "time 0.1.45", "wasm-bindgen", @@ -1093,20 +1099,20 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.0" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" dependencies = [ "clap_builder", - "clap_derive 4.3.0", + "clap_derive 4.3.2", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.0" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" dependencies = [ "anstream", "anstyle", @@ -1130,14 +1136,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -1185,9 +1191,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "comfy-table" -version = "6.1.4" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d" +checksum = "7e959d788268e3bf9d35ace83e81b124190378e4c91c9067524675e33394b8ba" dependencies = [ "strum", "strum_macros", @@ -1267,9 +1273,9 @@ checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "convert_case" @@ -1345,7 +1351,7 @@ version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.3", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", @@ -1511,14 +1517,14 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset 0.9.0", "scopeguard", ] @@ -1534,9 +1540,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1621,9 +1627,9 @@ dependencies = [ [[package]] name = "cumulus-client-cli" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ - "clap 4.3.0", + "clap 4.3.3", "parity-scale-codec", "sc-chain-spec", "sc-cli", @@ -1636,7 +1642,7 @@ dependencies = [ [[package]] name = "cumulus-client-collator" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-client-consensus-common", "cumulus-client-network", @@ -1659,7 +1665,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-aura" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1688,7 +1694,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-common" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-client-pov-recovery", @@ -1711,7 +1717,7 @@ dependencies = [ [[package]] name = "cumulus-client-consensus-relay-chain" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-client-consensus-common", @@ -1734,7 +1740,7 @@ dependencies = [ [[package]] name = "cumulus-client-network" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-relay-chain-interface", @@ -1757,7 +1763,7 @@ dependencies = [ [[package]] name = "cumulus-client-pov-recovery" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "cumulus-relay-chain-interface", @@ -1780,7 +1786,7 @@ dependencies = [ [[package]] name = "cumulus-client-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-client-cli", "cumulus-client-collator", @@ -1808,7 +1814,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-aura-ext" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "frame-support", "frame-system", @@ -1824,7 +1830,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-dmp-queue" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1841,7 +1847,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "bytes", "cumulus-pallet-parachain-system-proc-macro", @@ -1870,7 +1876,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-parachain-system-proc-macro" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1881,7 +1887,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcm" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1897,7 +1903,7 @@ dependencies = [ [[package]] name = "cumulus-pallet-xcmp-queue" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -1919,7 +1925,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-core" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "parity-scale-codec", "polkadot-core-primitives", @@ -1935,7 +1941,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-parachain-inherent" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -1958,7 +1964,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-timestamp" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "futures", @@ -1971,7 +1977,7 @@ dependencies = [ [[package]] name = "cumulus-primitives-utility" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -1989,7 +1995,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-inprocess-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2014,7 +2020,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2033,7 +2039,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-minimal-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "array-bytes 6.1.0", "async-trait", @@ -2073,7 +2079,7 @@ dependencies = [ [[package]] name = "cumulus-relay-chain-rpc-interface" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "async-trait", "cumulus-primitives-core", @@ -2102,7 +2108,7 @@ dependencies = [ [[package]] name = "cumulus-test-relay-sproof-builder" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "parity-scale-codec", @@ -2154,9 +2160,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +checksum = "109308c20e8445959c2792e81871054c6a17e6976489a93d2769641a2ba5839c" dependencies = [ "cc", "cxxbridge-flags", @@ -2166,9 +2172,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +checksum = "daf4c6755cdf10798b97510e0e2b3edb9573032bd9379de8fffa59d68165494f" dependencies = [ "cc", "codespan-reporting", @@ -2176,24 +2182,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] name = "cxxbridge-flags" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" +checksum = "882074421238e84fe3b4c65d0081de34e5b323bf64555d3e61991f76eb64a7bb" [[package]] name = "cxxbridge-macro" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +checksum = "4a076022ece33e7686fb76513518e219cca4fce5750a8ae6d1ce6c0f48fd1af9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -2452,7 +2458,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -2606,7 +2612,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -2617,7 +2623,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -2906,9 +2912,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -2952,7 +2958,7 @@ dependencies = [ "Inflector", "array-bytes 4.2.0", "chrono", - "clap 4.3.0", + "clap 4.3.3", "comfy-table", "frame-benchmarking", "frame-support", @@ -3281,7 +3287,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -3382,9 +3388,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -3747,7 +3753,7 @@ dependencies = [ name = "hydradx" version = "10.0.0" dependencies = [ - "clap 4.3.0", + "clap 4.3.3", "common-runtime", "cumulus-client-cli", "cumulus-client-collator", @@ -3970,7 +3976,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.9", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -3994,9 +4000,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -4034,9 +4040,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -4171,9 +4177,9 @@ checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -4188,13 +4194,13 @@ checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" [[package]] name = "ipconfig" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2", + "socket2 0.5.3", "widestring", - "winapi", + "windows-sys 0.48.0", "winreg", ] @@ -4211,8 +4217,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", - "io-lifetimes 1.0.10", - "rustix 0.37.19", + "io-lifetimes 1.0.11", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -4242,9 +4248,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -4305,7 +4311,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" dependencies = [ "anyhow", - "arrayvec 0.7.2", + "arrayvec 0.7.3", "async-trait", "beef", "futures-channel", @@ -4334,7 +4340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" dependencies = [ "anyhow", - "arrayvec 0.7.2", + "arrayvec 0.7.3", "async-lock", "async-trait", "beef", @@ -4662,9 +4668,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libloading" @@ -4697,7 +4703,7 @@ dependencies = [ "bytes", "futures", "futures-timer", - "getrandom 0.2.9", + "getrandom 0.2.10", "instant", "libp2p-core 0.38.0", "libp2p-dns", @@ -4843,7 +4849,7 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2766dcd2be8c87d5e1f35487deb22d765f49c6ae1251b3633efe3b25698bd3d2" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.3", "asynchronous-codec", "bytes", "either", @@ -4879,7 +4885,7 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2", + "socket2 0.4.9", "tokio", "trust-dns-proto", "void", @@ -5040,7 +5046,7 @@ dependencies = [ "libc", "libp2p-core 0.38.0", "log", - "socket2", + "socket2 0.4.9", "tokio", ] @@ -5263,9 +5269,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -5273,12 +5279,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "lru" @@ -5388,7 +5391,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.19", + "rustix 0.37.20", ] [[package]] @@ -5420,9 +5423,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -5492,14 +5495,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -5858,7 +5860,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.3", "itoa", ] @@ -5918,9 +5920,9 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] @@ -5945,9 +5947,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "oorandom" @@ -6179,9 +6181,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.5.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "output_vt100" @@ -6510,7 +6512,7 @@ dependencies = [ [[package]] name = "pallet-collator-selection" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "frame-benchmarking", "frame-support", @@ -7729,7 +7731,7 @@ dependencies = [ [[package]] name = "parachain-info" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" dependencies = [ "cumulus-primitives-core", "frame-support", @@ -7764,7 +7766,7 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.3", "bitvec", "byte-slice-cast", "bytes", @@ -7821,7 +7823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -7840,15 +7842,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -7901,9 +7903,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" @@ -7935,7 +7937,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -7986,7 +7988,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -8147,7 +8149,7 @@ name = "polkadot-cli" version = "0.9.38" source = "git+https://github.com/galacticcouncil/polkadot?branch=fix-xcm-executor-atomicity-9-38#a225599ab533bb5f7913429690e5c12ee3cff5ba" dependencies = [ - "clap 4.3.0", + "clap 4.3.3", "frame-benchmarking-cli", "futures", "log", @@ -9452,9 +9454,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -9498,16 +9500,15 @@ dependencies = [ [[package]] name = "proptest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", "bitflags", "byteorder", "lazy_static", "num-traits", - "quick-error 2.0.1", "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift", @@ -9599,12 +9600,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quick-protobuf" version = "0.8.1" @@ -9645,9 +9640,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -9717,7 +9712,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -9802,7 +9797,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.21", + "time 0.3.22", "x509-parser 0.13.2", "yasna", ] @@ -9815,7 +9810,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.21", + "time 0.3.22", "yasna", ] @@ -9843,7 +9838,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] @@ -9878,7 +9873,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -9895,11 +9890,11 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.2" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1a59b5d8e97dee33696bf13c5ba8ab85341c002922fba050069326b9c498974" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ - "aho-corasick 1.0.1", + "aho-corasick 1.0.2", "memchr", "regex-syntax 0.7.2", ] @@ -9932,7 +9927,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname", - "quick-error 1.2.3", + "quick-error", ] [[package]] @@ -10290,13 +10285,13 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno 0.3.1", - "io-lifetimes 1.0.10", + "io-lifetimes 1.0.11", "libc", "linux-raw-sys 0.3.8", "windows-sys 0.48.0", @@ -10345,7 +10340,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.21.1", + "base64 0.21.2", ] [[package]] @@ -10361,7 +10356,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" dependencies = [ "fnv", - "quick-error 1.2.3", + "quick-error", "tempfile", "wait-timeout", ] @@ -10502,7 +10497,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#bc dependencies = [ "array-bytes 4.2.0", "chrono", - "clap 4.3.0", + "clap 4.3.3", "fdlimit", "futures", "libp2p", @@ -11295,7 +11290,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#bcff60a227d455d95b4712b6cb356ce56b1ff672" dependencies = [ - "clap 4.3.0", + "clap 4.3.3", "futures", "log", "nix 0.26.2", @@ -11684,22 +11679,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -11910,6 +11905,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "soketto" version = "0.7.1" @@ -12913,9 +12918,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.16" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -12969,15 +12974,16 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.19", - "windows-sys 0.45.0", + "rustix 0.37.20", + "windows-sys 0.48.0", ] [[package]] @@ -13083,7 +13089,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -13158,9 +13164,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa", "serde", @@ -13229,9 +13235,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -13241,7 +13247,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite 0.2.9", "signal-hook-registry", - "socket2", + "socket2 0.4.9", "tokio-macros", "windows-sys 0.48.0", ] @@ -13254,7 +13260,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -13312,9 +13318,9 @@ checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" [[package]] name = "toml_edit" -version = "0.19.9" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ "indexmap", "toml_datetime", @@ -13383,7 +13389,7 @@ checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -13536,7 +13542,7 @@ dependencies = [ "lazy_static", "rand 0.8.5", "smallvec", - "socket2", + "socket2 0.4.9", "thiserror", "tinyvec", "tokio", @@ -13575,7 +13581,7 @@ name = "try-runtime-cli" version = "0.10.0-dev" source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.38#bcff60a227d455d95b4712b6cb356ce56b1ff672" dependencies = [ - "clap 4.3.0", + "clap 4.3.3", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -13685,9 +13691,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -13750,12 +13756,12 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.3.0", + "idna 0.4.0", "percent-encoding", ] @@ -13767,11 +13773,11 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -13862,9 +13868,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -13872,24 +13878,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -13899,9 +13905,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -13909,22 +13915,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-instrument" @@ -14205,9 +14211,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -14268,7 +14274,7 @@ dependencies = [ "sha2 0.10.6", "stun", "thiserror", - "time 0.3.21", + "time 0.3.22", "tokio", "turn", "url", @@ -14370,7 +14376,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" dependencies = [ "log", - "socket2", + "socket2 0.4.9", "thiserror", "tokio", "webrtc-util", @@ -14569,9 +14575,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.5.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" @@ -14623,7 +14629,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] @@ -14654,37 +14660,13 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -14857,11 +14839,12 @@ dependencies = [ [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -14911,7 +14894,7 @@ dependencies = [ "ring", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -14929,7 +14912,7 @@ dependencies = [ "oid-registry 0.6.1", "rusticata-macros", "thiserror", - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -15052,7 +15035,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.21", + "time 0.3.22", ] [[package]] @@ -15072,7 +15055,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -15108,124 +15091,124 @@ dependencies = [ [[patch.unused]] name = "asset-test-utils" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "bridge-hub-kusama-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "bridge-hub-polkadot-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "bridge-hub-rococo-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "collectives-polkadot-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "contracts-rococo-runtime" version = "0.2.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-pallet-session-benchmarking" version = "3.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-pallet-solo-to-para" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-ping" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-test-client" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-test-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "cumulus-test-service" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "pallet-template" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "parachain-template-node" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "parachain-template-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "parachains-common" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "penpal-runtime" version = "0.9.27" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "polkadot-parachain-bin" version = "0.9.380" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "rococo-parachain-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "seedling-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "shell-runtime" version = "0.1.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "statemine-runtime" version = "2.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "statemint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" [[patch.unused]] name = "westmint-runtime" version = "1.0.0" -source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#20d9613a4071c760a2d36400448abf4b0b9c303c" +source = "git+https://github.com/galacticcouncil/cumulus.git?branch=feat/xcmp-defer-xcm-v9-38#460647cc2ec988ee04370c1cdd9fd518ed4868eb" diff --git a/pallets/xcm-rate-limiter/src/benchmarking.rs b/pallets/xcm-rate-limiter/src/benchmarking.rs deleted file mode 100644 index 3ebd85ef0..000000000 --- a/pallets/xcm-rate-limiter/src/benchmarking.rs +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of Basilisk-node. - -// Copyright (C) 2022 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. - -#![cfg(feature = "runtime-benchmarks")] - -use super::*; - -use frame_benchmarking::benchmarks; - -use sp_std::prelude::*; - -benchmarks! { - - asd { - - }: { - } - verify { - } - - impl_benchmark_test_suite!(Pallet, crate::tests::mock::ExtBuilder::default().build(), crate::tests::mock::Test); -} diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 1a836e76d..664f2665a 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -15,11 +15,30 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! # XCM Rate Limiter Pallet +//! +//! ## Overview +//! +//! This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff +//! they exceed the rate limit configured in `RateLimitFor`. +//! +//! ### Integration +//! +//! +//! +//! ### Concepts +//! +//! +//! ### Implementation +//! +//! + #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; use cumulus_pallet_xcmp_queue::XcmDeferFilter; +use frame_support::pallet_prelude::Weight; use frame_support::traits::Get; use hydra_dx_math::rate_limiter::{calculate_deferred_duration, calculate_new_accumulated_amount}; @@ -39,9 +58,6 @@ use xcm::VersionedXcm::V3; pub mod weights; -#[cfg(any(feature = "runtime-benchmarks", test))] -mod benchmarking; - #[cfg(test)] mod tests; @@ -154,13 +170,13 @@ impl XcmDeferFilter for Pallet { _para: polkadot_parachain::primitives::Id, _sent_at: RelayChainBlockNumber, versioned_xcm: &VersionedXcm, - ) -> Option { + ) -> (Weight, Option) { use xcm::IntoVersion; let maybe_xcm = versioned_xcm.clone().into_version(3); - let Ok(V3(xcm)) = maybe_xcm else { return Some(T::MaxDeferDuration::get()) }; + let Ok(V3(xcm)) = maybe_xcm else { return (Weight::default(), Some(T::MaxDeferDuration::get())) }; // SAFETY NOTE: It is fine to only look at the first instruction because that is how assets will arrive on chain. // This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. - let Some(instruction) = xcm.first() else { return None }; + let Some(instruction) = xcm.first() else { return (Weight::default(), None) }; for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { let accumulated_liquidity = AccumulatedAmounts::::get(location); @@ -169,6 +185,12 @@ impl XcmDeferFilter for Pallet { let defer_duration = T::DeferDuration::get(); let current_time = T::RelayBlockNumberProvider::current_block_number(); + // let's assume one read for `RateLimitFor` as well as a read and write for `AccumulatedAmounts` updates. + let weight = if current_time == accumulated_liquidity.last_updated { + T::DbWeight::get().reads(1) + } else { + T::DbWeight::get().reads_writes(2, 1) + }; let time_difference = current_time.saturating_sub(accumulated_liquidity.last_updated); let new_accumulated_amount = calculate_new_accumulated_amount( @@ -194,12 +216,15 @@ impl XcmDeferFilter for Pallet { ); if deferred_by > 0 { - return Some(deferred_by.min(T::MaxDeferDuration::get().saturated_into())); + return ( + weight, + Some(deferred_by.min(T::MaxDeferDuration::get().saturated_into())), + ); } else { - return None; + return (weight, None); } } - None + (Weight::default(), None) } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index ec3683b1a..425139873 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -32,7 +32,7 @@ fn deferred_by_should_track_incoming_teleported_asset_liquidity() { let para_id = 999.into(); //Act - let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; //Assert let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); @@ -50,7 +50,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded() { let para_id = 999.into(); //Act - let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; //Assert let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); @@ -68,7 +68,7 @@ fn deferred_by_should_defer_xcm_when_v2_can_be_converted() { let para_id = 999.into(); //Act - let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; //Assert let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); @@ -86,7 +86,7 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { let para_id = 999.into(); //Act - let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; //Assert let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); @@ -104,7 +104,7 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { let para_id = 999.into(); //Act - let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; // Transaction should be deferred by 10 blocks because it exceeds the limit by 1000 (1x the limit) let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); @@ -113,7 +113,7 @@ fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { assert_eq!(first_deferred_block_number, Some(10)); // Second transaction should be put behind the first one by 20 blocks (2x the limit) - let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; let accumulated_amount = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(accumulated_amount.amount, 4000 * ONE); assert_eq!(accumulated_amount.last_updated, 1); @@ -129,7 +129,7 @@ fn deferred_by_should_defer_by_max_duration_when_it_is_reached() { let para_id = 999.into(); //Act - let deferred_by = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).unwrap(); + let deferred_by = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1.unwrap(); let max_defer: u32 = ::MaxDeferDuration::get(); //Assert assert_eq!(deferred_by, max_defer); @@ -144,7 +144,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { let para_id = 999.into(); //Act - let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let first_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; //Assert let accumulated_liquidity = XcmRateLimiter::accumulated_amount(MultiLocation::here()); @@ -155,7 +155,7 @@ fn deferred_by_should_defer_successive_xcm_when_time_passes() { System::set_block_number(6); - let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm); + let second_deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; let accumulated_liquidity = XcmRateLimiter::accumulated_amount(MultiLocation::here()); assert_eq!(accumulated_liquidity.amount, 3500 * ONE); assert_eq!(accumulated_liquidity.last_updated, 6); From 6697241b835a0dc9f52d0ca0e2dc2e985d47ef5d Mon Sep 17 00:00:00 2001 From: dmoka Date: Wed, 14 Jun 2023 16:01:34 +0200 Subject: [PATCH 65/79] add readme --- pallets/xcm-rate-limiter/README.md | 36 +++++++++++++++++++++++++++-- pallets/xcm-rate-limiter/src/lib.rs | 28 ++++++++++++++++++---- 2 files changed, 57 insertions(+), 7 deletions(-) diff --git a/pallets/xcm-rate-limiter/README.md b/pallets/xcm-rate-limiter/README.md index 89ea88d35..eb45c7c09 100644 --- a/pallets/xcm-rate-limiter/README.md +++ b/pallets/xcm-rate-limiter/README.md @@ -1,3 +1,35 @@ -### XCM Rate Limiter +# pallet-xcm-rate-limiter -TODO: Add readme \ No newline at end of file +## XCM Rate Limiter Pallet + +### Overview + +This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff +they exceed the rate limit configured in `RateLimitFor`. + +#### Integration + +The `RateLimitFor` associated type is supposed to be provided by the `AssetRegistry`, +but could work with any other implementation. + +This pallet does not provide any extrinsics of its own, +but it is meant to provide the implementation of `XcmDeferFilter` for the `XcmpQueue`. + +#### Implementation + +The duration for deferring an XCM is calculated based on: +- the incoming amount +- the rate limit of the asset +- the configured `DeferDuration` +- the amounts of tokens accumulated over time but decayed based on time and rate limit + +The tokens are deferred once the rate limit is exceeded, with 2 times the rate limit corresponding to deferred duration. +For example, if the rate limit is 1000 tokens per 10 blocks, then 1500 tokens will be deferred by 5 blocks. + +THe accumulated amounts decay linearly at the rate limit. For example: With rate limit 1000 tokens per 10 blocks, +the accumulated amount will be reduced by 100 tokens per block. + +The filter works with XCM v3 and so assumes that other versions can be converted to it. + +The filter processes only the first instruction of the XCM message, because that is how assets will arrive on chain. +This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. \ No newline at end of file diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index 664f2665a..a0d511f8c 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -15,22 +15,39 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # XCM Rate Limiter Pallet +//! ## XCM Rate Limiter Pallet //! -//! ## Overview +//! ### Overview //! //! This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff //! they exceed the rate limit configured in `RateLimitFor`. //! -//! ### Integration +//! #### Integration //! +//! The `RateLimitFor` associated type is supposed to be provided by the `AssetRegistry`, +//! but could work with any other implementation. //! +//! This pallet does not provide any extrinsics of its own, +//! but it is meant to provide the implementation of `XcmDeferFilter` for the `XcmpQueue`. //! -//! ### Concepts +//! #### Implementation //! +//! The duration for deferring an XCM is calculated based on: +//! - the incoming amount +//! - the rate limit of the asset +//! - the configured `DeferDuration` +//! - the amounts of tokens accumulated over time but decayed based on time and rate limit //! -//! ### Implementation +//! The tokens are deferred once the rate limit is exceeded, with 2 times the rate limit corresponding to deferred duration. +//! For example, if the rate limit is 1000 tokens per 10 blocks, then 1500 tokens will be deferred by 5 blocks. //! +//! THe accumulated amounts decay linearly at the rate limit. For example: With rate limit 1000 tokens per 10 blocks, +//! the accumulated amount will be reduced by 100 tokens per block. +//! +//! The filter works with XCM v3 and so assumes that other versions can be converted to it. +//! +//! The filter processes only the first instruction of the XCM message, because that is how assets will arrive on chain. +//! This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. //! #![cfg_attr(not(feature = "std"), no_std)] @@ -215,6 +232,7 @@ impl XcmDeferFilter for Pallet { }, ); + //TODO: we should not return because there might be other locations/assets in the xcm to be handled. When todo is processed, extend doc. if deferred_by > 0 { return ( weight, From 91e1ddc339da520110c2259fde2412b8bdfa94ab Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 15 Jun 2023 15:24:40 +0200 Subject: [PATCH 66/79] remove unused WeightInfo --- pallets/xcm-rate-limiter/src/lib.rs | 6 -- pallets/xcm-rate-limiter/src/tests/mock.rs | 1 - pallets/xcm-rate-limiter/src/weights.rs | 92 ---------------------- runtime/hydradx/src/xcm.rs | 1 - 4 files changed, 100 deletions(-) delete mode 100644 pallets/xcm-rate-limiter/src/weights.rs diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index a0d511f8c..b7e4cbb75 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -73,14 +73,11 @@ use xcm::lts::prelude::*; use xcm::VersionedXcm; use xcm::VersionedXcm::V3; -pub mod weights; - #[cfg(test)] mod tests; // Re-export pallet items so that they can be accessed from the crate namespace. pub use pallet::*; -pub use weights::WeightInfo; #[derive(Clone, Default, Encode, Decode, RuntimeDebug, MaxEncodedLen, TypeInfo, Eq, PartialEq)] pub struct AccumulatedAmount { @@ -133,9 +130,6 @@ pub mod pallet { /// Xcm rate limit getter for each asset type RateLimitFor: GetByKey>; - - /// Weight information for extrinsics in this pallet. - type WeightInfo: WeightInfo; } #[pallet::pallet] diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 105549209..6dce53123 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -159,7 +159,6 @@ impl pallet_xcm_rate_limiter::Config for Test { type RelayBlockNumberProvider = TreatSystemAsRelayBlockNumberProvider; type RateLimitFor = XcmRateLimitFor; type CurrencyIdConvert = ConvertIdMock; - type WeightInfo = (); } pub struct CircuitBreakerWhitelist; diff --git a/pallets/xcm-rate-limiter/src/weights.rs b/pallets/xcm-rate-limiter/src/weights.rs deleted file mode 100644 index 341b16208..000000000 --- a/pallets/xcm-rate-limiter/src/weights.rs +++ /dev/null @@ -1,92 +0,0 @@ -// This file is part of HydraDX. - -// Copyright (C) 2020-2021 Intergalactic, Limited (GIB). -// 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. - -//! Autogenerated weights for pallet_circuit_breaker -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-10-26, STEPS: 5, REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 1024 - -// Executed Command: -// target/release/hydradx -// benchmark -// pallet -// --pallet=pallet-circuit-breaker -// --chain=local -// --steps=5 -// --repeat=20 -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output -// weights.rs -// --template -// .maintain/pallet-weight-template.hbs -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{ - traits::Get, - weights::{constants::RocksDbWeight, Weight}, -}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_omnipool. -pub trait WeightInfo { - fn on_finalize(m: u32, n: u32) -> Weight; - fn on_finalize_single() -> Weight; - fn on_finalize_empty() -> Weight; - fn set_trade_volume_limit() -> Weight; - fn set_add_liquidity_limit() -> Weight; - fn set_remove_liquidity_limit() -> Weight; - fn ensure_pool_state_change_limit() -> Weight; - fn ensure_add_liquidity_limit() -> Weight; - fn ensure_remove_liquidity_limit() -> Weight; -} - -// For backwards compatibility and tests -impl WeightInfo for () { - fn on_finalize(_m: u32, _n: u32) -> Weight { - Weight::zero() - } - fn on_finalize_single() -> Weight { - Weight::zero() - } - fn on_finalize_empty() -> Weight { - Weight::zero() - } - fn set_trade_volume_limit() -> Weight { - Weight::zero() - } - fn set_add_liquidity_limit() -> Weight { - Weight::zero() - } - fn set_remove_liquidity_limit() -> Weight { - Weight::zero() - } - fn ensure_pool_state_change_limit() -> Weight { - Weight::zero() - } - fn ensure_add_liquidity_limit() -> Weight { - Weight::zero() - } - fn ensure_remove_liquidity_limit() -> Weight { - Weight::zero() - } -} diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 531ded403..2bc7a3bdb 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -220,7 +220,6 @@ impl pallet_xcm_rate_limiter::Config for Runtime { type RelayBlockNumberProvider = RelayChainBlockNumberProvider; type CurrencyIdConvert = CurrencyIdConvert; type RateLimitFor = pallet_asset_registry::XcmRateLimitsInRegistry; - type WeightInfo = (); } pub struct CurrencyIdConvert; From b4b86a98cc3e4b31f9a7af63db5d5981e559ae6d Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 15 Jun 2023 16:06:16 +0200 Subject: [PATCH 67/79] remove unused dep --- math/Cargo.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/math/Cargo.toml b/math/Cargo.toml index 6e6f2eb3e..c0c270065 100644 --- a/math/Cargo.toml +++ b/math/Cargo.toml @@ -22,8 +22,6 @@ sp-std = { workspace = true } serde = { version = "1.0.136", optional = true } [dev-dependencies] -# primitives = { workspace = true } - approx = "0.5.1" criterion = "0.4.0" proptest = "1.0.0" From 88ad1360cd1c5d5569dd586d3bc5c36aa299a426 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 15 Jun 2023 16:07:26 +0200 Subject: [PATCH 68/79] track all assets in incoming instructions and defer based on max defer duration calculated --- pallets/xcm-rate-limiter/README.md | 42 ++++++---- pallets/xcm-rate-limiter/src/lib.rs | 76 +++++++++++-------- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 36 +++++++++ pallets/xcm-rate-limiter/src/tests/mock.rs | 13 +++- 4 files changed, 118 insertions(+), 49 deletions(-) diff --git a/pallets/xcm-rate-limiter/README.md b/pallets/xcm-rate-limiter/README.md index eb45c7c09..a2d5265f1 100644 --- a/pallets/xcm-rate-limiter/README.md +++ b/pallets/xcm-rate-limiter/README.md @@ -1,35 +1,49 @@ # pallet-xcm-rate-limiter -## XCM Rate Limiter Pallet +### XCM Rate Limiter Pallet -### Overview +#### Overview -This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff -they exceed the rate limit configured in `RateLimitFor`. +This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff they exceed +the rate limit configured in `RateLimitFor`. #### Integration -The `RateLimitFor` associated type is supposed to be provided by the `AssetRegistry`, -but could work with any other implementation. +The `RateLimitFor` associated type is supposed to be provided by the `AssetRegistry`, but could work with any other +implementation. -This pallet does not provide any extrinsics of its own, -but it is meant to provide the implementation of `XcmDeferFilter` for the `XcmpQueue`. +This pallet does not provide any extrinsics of its own, but it is meant to provide the implementation of +`XcmDeferFilter` for the `XcmpQueue`. #### Implementation -The duration for deferring an XCM is calculated based on: +The defer duration for an XCM is the maximum of the individual durations for its included assets. + +The duration for deferring an asset is calculated based on: - the incoming amount - the rate limit of the asset - the configured `DeferDuration` - the amounts of tokens accumulated over time but decayed based on time and rate limit -The tokens are deferred once the rate limit is exceeded, with 2 times the rate limit corresponding to deferred duration. -For example, if the rate limit is 1000 tokens per 10 blocks, then 1500 tokens will be deferred by 5 blocks. +The tokens are deferred once the rate limit is exceeded, with 2 times the rate limit corresponding to deferred +duration. For example, if the rate limit is 1000 tokens per 10 blocks, then 1500 tokens will be deferred by 5 +blocks. -THe accumulated amounts decay linearly at the rate limit. For example: With rate limit 1000 tokens per 10 blocks, +The accumulated amounts decay linearly at the rate limit. For example: With rate limit 1000 tokens per 10 blocks, the accumulated amount will be reduced by 100 tokens per block. The filter works with XCM v3 and so assumes that other versions can be converted to it. -The filter processes only the first instruction of the XCM message, because that is how assets will arrive on chain. -This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. \ No newline at end of file +The filter processes only the first instruction of the XCM message, because that is how assets will arrive on chain. +This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. + +#### Limitations + +- The filter assumes that it is fine to ignore (neither track nor limit) tokens that don't have a defined local id + or don't have a configured rate limit. +- It counts accumulated amounts via `MultiLocation`s of incoming messages without reanchoring or canonicalizing. +- It only tracks and limits incoming tokens, not outgoing. +- Only tracks and limits `ReserveAssetDeposited` and `ReceiveTeleportedAsset`, meaning that core asset tokens + "returning" from other chains are not tracked or limited. + +License: Apache-2.0 diff --git a/pallets/xcm-rate-limiter/src/lib.rs b/pallets/xcm-rate-limiter/src/lib.rs index b7e4cbb75..ec0fb0331 100644 --- a/pallets/xcm-rate-limiter/src/lib.rs +++ b/pallets/xcm-rate-limiter/src/lib.rs @@ -19,29 +19,32 @@ //! //! ### Overview //! -//! This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff -//! they exceed the rate limit configured in `RateLimitFor`. +//! This pallet provides an implementation of `XcmDeferFilter` that tracks incoming tokens and defers iff they exceed +//! the rate limit configured in `RateLimitFor`. //! -//! #### Integration +//! ### Integration //! -//! The `RateLimitFor` associated type is supposed to be provided by the `AssetRegistry`, -//! but could work with any other implementation. +//! The `RateLimitFor` associated type is supposed to be provided by the `AssetRegistry`, but could work with any other +//! implementation. //! -//! This pallet does not provide any extrinsics of its own, -//! but it is meant to provide the implementation of `XcmDeferFilter` for the `XcmpQueue`. +//! This pallet does not provide any extrinsics of its own, but it is meant to provide the implementation of +//! `XcmDeferFilter` for the `XcmpQueue`. //! -//! #### Implementation +//! ### Implementation //! -//! The duration for deferring an XCM is calculated based on: +//! The defer duration for an XCM is the maximum of the individual durations for its included assets. +//! +//! The duration for deferring an asset is calculated based on: //! - the incoming amount //! - the rate limit of the asset //! - the configured `DeferDuration` //! - the amounts of tokens accumulated over time but decayed based on time and rate limit //! -//! The tokens are deferred once the rate limit is exceeded, with 2 times the rate limit corresponding to deferred duration. -//! For example, if the rate limit is 1000 tokens per 10 blocks, then 1500 tokens will be deferred by 5 blocks. +//! The tokens are deferred once the rate limit is exceeded, with 2 times the rate limit corresponding to deferred +//! duration. For example, if the rate limit is 1000 tokens per 10 blocks, then 1500 tokens will be deferred by 5 +//! blocks. //! -//! THe accumulated amounts decay linearly at the rate limit. For example: With rate limit 1000 tokens per 10 blocks, +//! The accumulated amounts decay linearly at the rate limit. For example: With rate limit 1000 tokens per 10 blocks, //! the accumulated amount will be reduced by 100 tokens per block. //! //! The filter works with XCM v3 and so assumes that other versions can be converted to it. @@ -49,6 +52,14 @@ //! The filter processes only the first instruction of the XCM message, because that is how assets will arrive on chain. //! This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. //! +//! ### Limitations +//! +//! - The filter assumes that it is fine to ignore (neither track nor limit) tokens that don't have a defined local id +//! or don't have a configured rate limit. +//! - It counts accumulated amounts via `MultiLocation`s of incoming messages without reanchoring or canonicalizing. +//! - It only tracks and limits incoming tokens, not outgoing. +//! - Only tracks and limits `ReserveAssetDeposited` and `ReceiveTeleportedAsset`, meaning that core asset tokens +//! "returning" from other chains are not tracked or limited. #![cfg_attr(not(feature = "std"), no_std)] @@ -188,12 +199,22 @@ impl XcmDeferFilter for Pallet { // SAFETY NOTE: It is fine to only look at the first instruction because that is how assets will arrive on chain. // This is guaranteed by `AllowTopLevelExecution` which is standard in the ecosystem. let Some(instruction) = xcm.first() else { return (Weight::default(), None) }; + let mut total_weight = Weight::default(); + let mut total_deferred_by: RelayChainBlockNumber = 0; for (location, amount) in Pallet::::get_locations_and_amounts(instruction) { let accumulated_liquidity = AccumulatedAmounts::::get(location); - let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { continue }; - let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { continue }; - let defer_duration = T::DeferDuration::get(); + // We assume that it's fine to not track assets whose id cannot be determined... + let Some(asset_id) = T::CurrencyIdConvert::convert(location) else { + total_weight.saturating_accrue(T::DbWeight::get().reads(1)); + continue + }; + // ... or that don't have a rate limit configured. + let Some(limit_per_duration) = T::RateLimitFor::get(&asset_id) else { + total_weight.saturating_accrue(T::DbWeight::get().reads(2)); + continue + }; + let defer_duration: u32 = T::DeferDuration::get(); let current_time = T::RelayBlockNumberProvider::current_block_number(); // let's assume one read for `RateLimitFor` as well as a read and write for `AccumulatedAmounts` updates. @@ -205,18 +226,14 @@ impl XcmDeferFilter for Pallet { let time_difference = current_time.saturating_sub(accumulated_liquidity.last_updated); let new_accumulated_amount = calculate_new_accumulated_amount( - defer_duration.saturated_into(), + defer_duration, limit_per_duration, amount, accumulated_liquidity.amount, time_difference.saturated_into(), ); - let deferred_by = calculate_deferred_duration( - defer_duration.saturated_into(), - limit_per_duration, - new_accumulated_amount, - ); + let deferred_by = calculate_deferred_duration(defer_duration, limit_per_duration, new_accumulated_amount); AccumulatedAmounts::::insert( location, @@ -226,17 +243,14 @@ impl XcmDeferFilter for Pallet { }, ); - //TODO: we should not return because there might be other locations/assets in the xcm to be handled. When todo is processed, extend doc. - if deferred_by > 0 { - return ( - weight, - Some(deferred_by.min(T::MaxDeferDuration::get().saturated_into())), - ); - } else { - return (weight, None); - } + total_deferred_by = deferred_by.max(total_deferred_by); + total_weight.saturating_accrue(weight); } - (Weight::default(), None) + if total_deferred_by > 0 { + (total_weight, Some(total_deferred_by.min(T::MaxDeferDuration::get()))) + } else { + (total_weight, None) + } } } diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 425139873..9ac282a36 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -96,6 +96,31 @@ fn deferred_by_should_defer_xcm_when_limit_exceeded_double_limit() { }); } +#[test] +fn deferred_by_should_defer_by_max_of_all_assets_in_xcm() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let other_asset_loc = MultiLocation::new(1, GeneralIndex(42)); + let assets = vec![(MultiLocation::here(), 2000 * ONE), (other_asset_loc, 3000 * ONE)]; + let versioned_xcm = create_multi_reserve_asset_deposited(assets); + let para_id = 999.into(); + + //Act + let deferred_block_number = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; + + //Assert + let accumulated_here = XcmRateLimiter::accumulated_amount(MultiLocation::here()); + assert_eq!(accumulated_here.amount, 2000 * ONE); + assert_eq!(accumulated_here.last_updated, 1); + + let accumulated_other = XcmRateLimiter::accumulated_amount(other_asset_loc); + assert_eq!(accumulated_other.amount, 3000 * ONE); + assert_eq!(accumulated_other.last_updated, 1); + + assert_eq!(deferred_block_number, Some(20)); + }); +} + #[test] fn deferred_by_should_defer_successive_xcm_when_limit_exceeded() { ExtBuilder::default().build().execute_with(|| { @@ -170,6 +195,17 @@ pub fn create_versioned_reserve_asset_deposited(loc: MultiLocation, amount: u128 ])) } +pub fn create_multi_reserve_asset_deposited(locs_and_amounts: Vec<(MultiLocation, u128)>) -> VersionedXcm { + let locs_and_amounts = locs_and_amounts + .into_iter() + .map(|(loc, amount)| (loc, amount).into()) + .collect(); + let multi_assets = MultiAssets::from_sorted_and_deduplicated(locs_and_amounts).unwrap(); + VersionedXcm::from(Xcm::(vec![ + Instruction::::ReserveAssetDeposited(multi_assets), + ])) +} + pub fn create_versioned_receive_teleported_asset(loc: MultiLocation, amount: u128) -> VersionedXcm { let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); VersionedXcm::from(Xcm::(vec![ diff --git a/pallets/xcm-rate-limiter/src/tests/mock.rs b/pallets/xcm-rate-limiter/src/tests/mock.rs index 6dce53123..370af80db 100644 --- a/pallets/xcm-rate-limiter/src/tests/mock.rs +++ b/pallets/xcm-rate-limiter/src/tests/mock.rs @@ -132,10 +132,14 @@ parameter_types! { pub struct ConvertIdMock; impl Convert> for ConvertIdMock { fn convert(location: MultiLocation) -> Option { - if location == MultiLocation::here() { - Some(HDX) - } else { - None + use sp_runtime::SaturatedConversion; + match location { + loc if loc == MultiLocation::here() => Some(HDX), + MultiLocation { + parents: _, + interior: Junctions::X1(GeneralIndex(i)), + } => Some(i.saturated_into()), + _ => None, } } } @@ -194,6 +198,7 @@ parameter_type_with_key! { DAI => Some(1000 * ONE), LRNA => Some(1000 * ONE), ACA => Some(1000 * ONE), + 42 => Some(1000 * ONE), _ => None } }; From fe4f8a0d92a6f3930d9b82cc0c34d6602c601d50 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 15 Jun 2023 16:12:21 +0200 Subject: [PATCH 69/79] address review comments --- integration-tests/src/xcm_rate_limiter.rs | 4 ++-- pallets/otc/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index e798af01c..dc8db4afb 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -140,7 +140,7 @@ fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { // Assert assert_eq!( hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), - 100 * UNITS + ALICE_INITIAL_NATIVE_BALANCE_ON_OTHER_PARACHAIN - amount ); }); @@ -148,7 +148,7 @@ fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { Hydra::execute_with(|| { assert_eq!( hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), - 100 * UNITS - fee + amount - fee ); assert_eq!( hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()), diff --git a/pallets/otc/Cargo.toml b/pallets/otc/Cargo.toml index b90a3443f..37ef5ef91 100644 --- a/pallets/otc/Cargo.toml +++ b/pallets/otc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-otc' -version = "1.0.2" +version = '1.0.2' description = 'A pallet for trustless over-the-counter trading' authors = ['GalacticCouncil'] edition = '2021' From e58df7a8cc5254cd0a4cfe49daae88e77ea86a86 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Thu, 15 Jun 2023 16:19:37 +0200 Subject: [PATCH 70/79] add test for withdraw to make sure it's not tracked --- .../xcm-rate-limiter/src/tests/defer_xcm.rs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs index 9ac282a36..da2a18bb5 100644 --- a/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs +++ b/pallets/xcm-rate-limiter/src/tests/defer_xcm.rs @@ -24,6 +24,25 @@ pub use pretty_assertions::{assert_eq, assert_ne}; use xcm::VersionedXcm; +#[test] +fn deferred_by_should_not_track_or_limit_irrelevant_asset_xcms() { + ExtBuilder::default().build().execute_with(|| { + //Arrange + let versioned_xcm = create_versioned_withdraw_asset(MultiLocation::here(), 2000 * ONE); + let para_id = 999.into(); + + //Act + let deferred = XcmRateLimiter::deferred_by(para_id, 10, &versioned_xcm).1; + + //Assert + assert_eq!( + XcmRateLimiter::accumulated_amount(MultiLocation::here()), + AccumulatedAmount::default() + ); + assert_eq!(deferred, None); + }); +} + #[test] fn deferred_by_should_track_incoming_teleported_asset_liquidity() { ExtBuilder::default().build().execute_with(|| { @@ -213,6 +232,13 @@ pub fn create_versioned_receive_teleported_asset(loc: MultiLocation, amount: u12 ])) } +pub fn create_versioned_withdraw_asset(loc: MultiLocation, amount: u128) -> VersionedXcm { + let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(loc, amount).into()]).unwrap(); + VersionedXcm::from(Xcm::(vec![Instruction::::WithdrawAsset( + multi_assets, + )])) +} + pub fn create_versioned_xcm_v2(amount: u128) -> VersionedXcm { use xcm::v2::prelude::*; let multi_assets = MultiAssets::from_sorted_and_deduplicated(vec![(MultiLocation::here(), amount).into()]).unwrap(); From a9fcbb8e8632e41e96c91c92932db9783b3f3cc8 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 19 Jun 2023 14:49:03 +0200 Subject: [PATCH 71/79] bump crate versions --- Cargo.lock | 6 +++--- pallets/dca/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad4462021..60c0b37f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3849,7 +3849,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "160.0.0" +version = "161.0.0" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", @@ -6583,7 +6583,7 @@ dependencies = [ [[package]] name = "pallet-dca" -version = "1.1.4" +version = "1.1.5" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -9371,7 +9371,7 @@ dependencies = [ [[package]] name = "primitives" -version = "5.7.3" +version = "5.7.4" dependencies = [ "frame-support", "hex-literal 0.3.4", diff --git a/pallets/dca/Cargo.toml b/pallets/dca/Cargo.toml index 14120b73e..234dc94ae 100644 --- a/pallets/dca/Cargo.toml +++ b/pallets/dca/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-dca' -version = '1.1.4' +version = "1.1.5" description = 'A pallet to manage DCA scheduling' authors = ['GalacticCouncil'] edition = '2021' diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 5be818789..daea049d7 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "5.7.3" +version = "5.7.4" authors = ["GalacticCouncil"] edition = "2021" repository = "https://github.com/galacticcouncil/HydraDX-node" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index 3d50a1d93..af7e103ec 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "160.0.0" +version = "161.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 1239050a0..ff147f11d 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -111,7 +111,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 160, + spec_version: 161, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From c68f14361e30a1dee00ca3d1fe7b3ad9cd2a90db Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 26 Jun 2023 10:34:55 +0200 Subject: [PATCH 72/79] reset otc version --- pallets/otc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pallets/otc/Cargo.toml b/pallets/otc/Cargo.toml index 37ef5ef91..4b02a166b 100644 --- a/pallets/otc/Cargo.toml +++ b/pallets/otc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-otc' -version = '1.0.2' +version = '1.0.1' description = 'A pallet for trustless over-the-counter trading' authors = ['GalacticCouncil'] edition = '2021' From c402513712277bbcd3b2a778a857948cea8575d0 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 26 Jun 2023 10:40:15 +0200 Subject: [PATCH 73/79] update cargo.lock --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 60c0b37f9..148386d11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7130,7 +7130,7 @@ dependencies = [ [[package]] name = "pallet-otc" -version = "1.0.2" +version = "1.0.1" dependencies = [ "frame-benchmarking", "frame-support", From 30f171faeafddc04bb1ed3b36d552de1ba85e455 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 26 Jun 2023 11:12:19 +0200 Subject: [PATCH 74/79] add test for executing deferred messages --- integration-tests/src/xcm_rate_limiter.rs | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 4d496fe58..371dbb80e 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -156,3 +156,97 @@ fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { ); }); } + +#[test] +fn deferred_messages_should_be_executable_by_root() { + // Arrange + TestNet::reset(); + + Hydra::execute_with(|| { + assert_ok!(hydradx_runtime::AssetRegistry::set_location( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) + )); + + // set an xcm rate limit + assert_ok!(hydradx_runtime::AssetRegistry::update( + hydradx_runtime::RuntimeOrigin::root(), + ACA, + b"ACA".to_vec(), + AssetType::Token, + None, + Some(50 * UNITS), + )); + + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + }); + + let amount = 100 * UNITS; + let mut message_hash = None; + let max_weight = Weight::from_ref_time(399_600_000_000); + Acala::execute_with(|| { + // Act + assert_ok!(hydradx_runtime::XTokens::transfer( + hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), + 0, + amount, + Box::new( + MultiLocation::new( + 1, + X2( + Junction::Parachain(HYDRA_PARA_ID), + Junction::AccountId32 { id: BOB, network: None } + ) + ) + .into() + ), + WeightLimit::Limited(max_weight), + )); + + message_hash = get_message_hash_from_event(2); + + // Assert + assert_eq!( + hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), + ALICE_INITIAL_NATIVE_BALANCE - amount + ); + }); + + Hydra::execute_with(|| { + expect_hydra_events(vec![ + cumulus_pallet_xcmp_queue::Event::XcmDeferred { + sender: ACALA_PARA_ID.into(), + sent_at: 3, + deferred_to: 604, // received at 4 plus 600 blocks of deferral + message_hash, + } + .into(), + pallet_relaychain_info::Event::CurrentBlockNumbers { + parachain_block_number: 1, + relaychain_block_number: 5, + } + .into(), + ]); + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + + set_relaychain_block_number(604); + + assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); + assert_ok!(hydradx_runtime::XcmpQueue::service_deferred( + hydradx_runtime::RuntimeOrigin::root(), + max_weight, + ACALA_PARA_ID.into(), + )); + + let fee = 400641025641; + assert_eq!( + hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), + amount - fee + ); + assert_eq!( + hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()), + fee // fees should go to treasury + ); + }); +} From 6efd823c66c90f201be1e368b2fdfe9192d139c5 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Mon, 26 Jun 2023 11:25:48 +0200 Subject: [PATCH 75/79] query fee from treasurey account instead of hard-coding --- integration-tests/src/xcm_rate_limiter.rs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs index 371dbb80e..4945464f1 100644 --- a/integration-tests/src/xcm_rate_limiter.rs +++ b/integration-tests/src/xcm_rate_limiter.rs @@ -144,16 +144,12 @@ fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { ); }); - let fee = 400641025641; Hydra::execute_with(|| { + let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); assert_eq!( hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), amount - fee ); - assert_eq!( - hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()), - fee // fees should go to treasury - ); }); } @@ -239,14 +235,10 @@ fn deferred_messages_should_be_executable_by_root() { ACALA_PARA_ID.into(), )); - let fee = 400641025641; + let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); assert_eq!( hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), amount - fee ); - assert_eq!( - hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()), - fee // fees should go to treasury - ); }); } From 4d2f1ab118eacc523c2d29477e4145f39c872083 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 28 Jun 2023 16:08:53 +0200 Subject: [PATCH 76/79] bump crate versions --- Cargo.lock | 4 ++-- math/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a2b0c88f..6e862856a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3730,7 +3730,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" -version = "7.2.0" +version = "7.2.1" dependencies = [ "approx", "criterion", @@ -3849,7 +3849,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "162.0.0" +version = "163.0.0" dependencies = [ "common-runtime", "cumulus-pallet-aura-ext", diff --git a/math/Cargo.toml b/math/Cargo.toml index c0c270065..22ada2a0d 100644 --- a/math/Cargo.toml +++ b/math/Cargo.toml @@ -6,7 +6,7 @@ license = 'Apache-2.0' name = "hydra-dx-math" description = "A collection of utilities to make performing liquidity pool calculations more convenient." repository = 'https://github.com/galacticcouncil/hydradx-math' -version = "7.2.0" +version = "7.2.1" [dependencies] primitive-types = {default-features = false, version = '0.12.0'} diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index e7690010d..44c900679 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "162.0.0" +version = "163.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index a020697b4..66e7f4cfd 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -111,7 +111,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 162, + spec_version: 163, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 1119b137f2caed0a6ab82b4562fd092d5fe6c8e1 Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 12 Jul 2023 12:15:34 +0200 Subject: [PATCH 77/79] remove xcm rate limiter from runtime --- integration-tests/src/lib.rs | 1 - integration-tests/src/xcm_rate_limiter.rs | 244 ---------------------- runtime/hydradx/src/lib.rs | 3 +- runtime/hydradx/src/xcm.rs | 20 +- 4 files changed, 3 insertions(+), 265 deletions(-) delete mode 100644 integration-tests/src/xcm_rate_limiter.rs diff --git a/integration-tests/src/lib.rs b/integration-tests/src/lib.rs index 26c348863..f47137d32 100644 --- a/integration-tests/src/lib.rs +++ b/integration-tests/src/lib.rs @@ -13,7 +13,6 @@ mod otc; mod polkadot_test_net; mod transact_call_filter; mod vesting; -mod xcm_rate_limiter; #[macro_export] macro_rules! assert_balance { diff --git a/integration-tests/src/xcm_rate_limiter.rs b/integration-tests/src/xcm_rate_limiter.rs deleted file mode 100644 index 4945464f1..000000000 --- a/integration-tests/src/xcm_rate_limiter.rs +++ /dev/null @@ -1,244 +0,0 @@ -#![cfg(test)] - -use crate::polkadot_test_net::*; - -use common_runtime::Weight; -use frame_support::assert_ok; -use orml_traits::currency::MultiCurrency; -use pallet_asset_registry::AssetType; -use polkadot_xcm::prelude::*; -use xcm_emulator::TestExt; - -/// Returns the message hash in the `XcmpMessageSent` event at the `n`th last event (1-indexed, so if the second to last -/// event has the hash, pass `2`); -fn get_message_hash_from_event(n: usize) -> Option<[u8; 32]> { - use cumulus_pallet_xcmp_queue::Event; - use hydradx_runtime::RuntimeEvent; - let RuntimeEvent::XcmpQueue(Event::XcmpMessageSent { message_hash }) = &last_hydra_events(n)[0] else { - panic!("expecting to find message sent event"); - }; - *message_hash -} - -#[test] -fn xcm_rate_limiter_should_limit_aca_when_limit_is_exceeded() { - // Arrange - TestNet::reset(); - - Hydra::execute_with(|| { - assert_ok!(hydradx_runtime::AssetRegistry::set_location( - hydradx_runtime::RuntimeOrigin::root(), - ACA, - hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) - )); - - // set an xcm rate limit - assert_ok!(hydradx_runtime::AssetRegistry::update( - hydradx_runtime::RuntimeOrigin::root(), - ACA, - b"ACA".to_vec(), - AssetType::Token, - None, - Some(50 * UNITS), - )); - - assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - }); - - let amount = 100 * UNITS; - let mut message_hash = None; - Acala::execute_with(|| { - // Act - assert_ok!(hydradx_runtime::XTokens::transfer( - hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), - 0, - amount, - Box::new( - MultiLocation::new( - 1, - X2( - Junction::Parachain(HYDRA_PARA_ID), - Junction::AccountId32 { id: BOB, network: None } - ) - ) - .into() - ), - WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) - )); - - message_hash = get_message_hash_from_event(2); - - // Assert - assert_eq!( - hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), - ALICE_INITIAL_NATIVE_BALANCE - amount - ); - }); - - Hydra::execute_with(|| { - expect_hydra_events(vec![ - cumulus_pallet_xcmp_queue::Event::XcmDeferred { - sender: ACALA_PARA_ID.into(), - sent_at: 3, - deferred_to: 604, // received at 4 plus 600 blocks of deferral - message_hash, - } - .into(), - pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 1, - relaychain_block_number: 5, - } - .into(), - ]); - assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - }); -} - -#[test] -fn xcm_rate_limiter_should_not_limit_aca_when_limit_is_not_exceeded() { - // Arrange - TestNet::reset(); - - Hydra::execute_with(|| { - assert_ok!(hydradx_runtime::AssetRegistry::set_location( - hydradx_runtime::RuntimeOrigin::root(), - ACA, - hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) - )); - - // set an xcm rate limit - assert_ok!(hydradx_runtime::AssetRegistry::update( - hydradx_runtime::RuntimeOrigin::root(), - ACA, - b"ACA".to_vec(), - AssetType::Token, - None, - Some(101 * UNITS), - )); - }); - - let amount = 100 * UNITS; - Acala::execute_with(|| { - // Act - assert_ok!(hydradx_runtime::XTokens::transfer( - hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), - 0, - amount, - Box::new( - MultiLocation::new( - 1, - X2( - Junction::Parachain(HYDRA_PARA_ID), - Junction::AccountId32 { id: BOB, network: None } - ) - ) - .into() - ), - WeightLimit::Limited(Weight::from_ref_time(399_600_000_000)) - )); - - // Assert - assert_eq!( - hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), - ALICE_INITIAL_NATIVE_BALANCE - amount - ); - }); - - Hydra::execute_with(|| { - let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); - assert_eq!( - hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), - amount - fee - ); - }); -} - -#[test] -fn deferred_messages_should_be_executable_by_root() { - // Arrange - TestNet::reset(); - - Hydra::execute_with(|| { - assert_ok!(hydradx_runtime::AssetRegistry::set_location( - hydradx_runtime::RuntimeOrigin::root(), - ACA, - hydradx_runtime::AssetLocation(MultiLocation::new(1, X2(Parachain(ACALA_PARA_ID), GeneralIndex(0)))) - )); - - // set an xcm rate limit - assert_ok!(hydradx_runtime::AssetRegistry::update( - hydradx_runtime::RuntimeOrigin::root(), - ACA, - b"ACA".to_vec(), - AssetType::Token, - None, - Some(50 * UNITS), - )); - - assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - }); - - let amount = 100 * UNITS; - let mut message_hash = None; - let max_weight = Weight::from_ref_time(399_600_000_000); - Acala::execute_with(|| { - // Act - assert_ok!(hydradx_runtime::XTokens::transfer( - hydradx_runtime::RuntimeOrigin::signed(ALICE.into()), - 0, - amount, - Box::new( - MultiLocation::new( - 1, - X2( - Junction::Parachain(HYDRA_PARA_ID), - Junction::AccountId32 { id: BOB, network: None } - ) - ) - .into() - ), - WeightLimit::Limited(max_weight), - )); - - message_hash = get_message_hash_from_event(2); - - // Assert - assert_eq!( - hydradx_runtime::Balances::free_balance(&AccountId::from(ALICE)), - ALICE_INITIAL_NATIVE_BALANCE - amount - ); - }); - - Hydra::execute_with(|| { - expect_hydra_events(vec![ - cumulus_pallet_xcmp_queue::Event::XcmDeferred { - sender: ACALA_PARA_ID.into(), - sent_at: 3, - deferred_to: 604, // received at 4 plus 600 blocks of deferral - message_hash, - } - .into(), - pallet_relaychain_info::Event::CurrentBlockNumbers { - parachain_block_number: 1, - relaychain_block_number: 5, - } - .into(), - ]); - assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - - set_relaychain_block_number(604); - - assert_eq!(hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), 0); - assert_ok!(hydradx_runtime::XcmpQueue::service_deferred( - hydradx_runtime::RuntimeOrigin::root(), - max_weight, - ACALA_PARA_ID.into(), - )); - - let fee = hydradx_runtime::Tokens::free_balance(ACA, &hydradx_runtime::Treasury::account_id()); - assert_eq!( - hydradx_runtime::Tokens::free_balance(ACA, &AccountId::from(BOB)), - amount - fee - ); - }); -} diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index 66e7f4cfd..0efef4a9c 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -1052,9 +1052,8 @@ construct_runtime!( OmnipoolLiquidityMining: pallet_omnipool_liquidity_mining = 63, OTC: pallet_otc = 64, CircuitBreaker: pallet_circuit_breaker = 65, - // DCA = 66 + Router: pallet_route_executor = 67, - XcmRateLimiter: pallet_xcm_rate_limiter = 68, // ORML related modules Tokens: orml_tokens = 77, diff --git a/runtime/hydradx/src/xcm.rs b/runtime/hydradx/src/xcm.rs index 0797efc5b..a63f0a1f0 100644 --- a/runtime/hydradx/src/xcm.rs +++ b/runtime/hydradx/src/xcm.rs @@ -10,7 +10,7 @@ use hydradx_adapters::{MultiCurrencyTrader, ToFeeReceiver}; use orml_traits::{location::AbsoluteReserveProvider, parameter_type_with_key}; pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::{RelayChainBlockNumber, Sibling}; +use polkadot_parachain::primitives::Sibling; use polkadot_xcm::v3::prelude::*; use polkadot_xcm::v3::Weight as XcmWeight; use primitives::Price; @@ -136,7 +136,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime { type ExecuteDeferredOrigin = EnsureRoot; type MaxDeferredMessages = ConstU32<100>; type RelayChainBlockNumberProvider = RelayChainBlockNumberProvider; - type XcmDeferFilter = XcmRateLimiter; + type XcmDeferFilter = (); } impl cumulus_pallet_dmp_queue::Config for Runtime { @@ -206,22 +206,6 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; } - -parameter_types! { - pub DeferDuration: RelayChainBlockNumber = 600; // 1 hour - pub MaxDeferDuration: RelayChainBlockNumber = 600 * 24 * 10; // 10 days -} - -impl pallet_xcm_rate_limiter::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AssetId = AssetId; - type DeferDuration = DeferDuration; - type MaxDeferDuration = MaxDeferDuration; - type RelayBlockNumberProvider = RelayChainBlockNumberProvider; - type CurrencyIdConvert = CurrencyIdConvert; - type RateLimitFor = pallet_asset_registry::XcmRateLimitsInRegistry; -} - pub struct CurrencyIdConvert; use primitives::constants::chain::CORE_ASSET_ID; From 7eb04cd6ca13c858c6b47b396cd057c405503a2c Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 12 Jul 2023 12:27:34 +0200 Subject: [PATCH 78/79] correct rate limiter Cargo.toml --- pallets/xcm-rate-limiter/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pallets/xcm-rate-limiter/Cargo.toml b/pallets/xcm-rate-limiter/Cargo.toml index 10323d6ae..7ac968e5b 100644 --- a/pallets/xcm-rate-limiter/Cargo.toml +++ b/pallets/xcm-rate-limiter/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" homepage = 'https://github.com/galacticcouncil/hydradx-node' repository = 'https://github.com/galacticcouncil/hydradx-node' -description = "Circuit breakers for AMMs" +description = "Rate limiter for tokens arriving via XCM" [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -19,7 +19,6 @@ scale-info = { version = "2.3.1", default-features = false, features = ["derive" # Hydradx hydradx-traits = { workspace = true } hydra-dx-math = { workspace = true } -pallet-omnipool = { workspace = true } # Substrate dependencies frame-benchmarking = { workspace = true, optional = true} @@ -43,6 +42,7 @@ orml-traits = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, features = ["std"] } +pallet-omnipool = { workspace = true, features = ["std"] } orml-tokens = { workspace = true, features = ["std"] } test-utils = { workspace = true } pretty_assertions = "1.2.1" From 38958214930d3156bbaa973c5ace67e823cbdaeb Mon Sep 17 00:00:00 2001 From: Alexander Popiak Date: Wed, 12 Jul 2023 18:59:00 +0200 Subject: [PATCH 79/79] bump crate versions --- Cargo.lock | 10 +++++----- math/Cargo.toml | 2 +- pallets/dca/Cargo.toml | 2 +- primitives/Cargo.toml | 2 +- runtime/adapters/Cargo.toml | 2 +- runtime/hydradx/Cargo.toml | 2 +- runtime/hydradx/src/lib.rs | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04db82c11..46cbcaac6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3686,7 +3686,7 @@ dependencies = [ [[package]] name = "hydra-dx-math" -version = "7.4.2" +version = "7.4.3" dependencies = [ "approx", "criterion", @@ -3783,7 +3783,7 @@ dependencies = [ [[package]] name = "hydradx-adapters" -version = "0.4.0" +version = "0.4.1" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -3815,7 +3815,7 @@ dependencies = [ [[package]] name = "hydradx-runtime" -version = "166.0.0" +version = "167.0.0" dependencies = [ "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", @@ -6561,7 +6561,7 @@ dependencies = [ [[package]] name = "pallet-dca" -version = "1.1.6" +version = "1.1.7" dependencies = [ "cumulus-pallet-parachain-system", "cumulus-primitives-core", @@ -9350,7 +9350,7 @@ dependencies = [ [[package]] name = "primitives" -version = "5.8.1" +version = "5.8.2" dependencies = [ "frame-support", "hex-literal 0.3.4", diff --git a/math/Cargo.toml b/math/Cargo.toml index 47191d1c9..c6005ee41 100644 --- a/math/Cargo.toml +++ b/math/Cargo.toml @@ -6,7 +6,7 @@ license = 'Apache-2.0' name = "hydra-dx-math" description = "A collection of utilities to make performing liquidity pool calculations more convenient." repository = 'https://github.com/galacticcouncil/hydradx-math' -version = "7.4.2" +version = "7.4.3" [dependencies] primitive-types = {default-features = false, version = '0.12.0'} diff --git a/pallets/dca/Cargo.toml b/pallets/dca/Cargo.toml index 4db1fa6c3..f22fd3df7 100644 --- a/pallets/dca/Cargo.toml +++ b/pallets/dca/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'pallet-dca' -version = '1.1.6' +version = "1.1.7" description = 'A pallet to manage DCA scheduling' authors = ['GalacticCouncil'] edition = '2021' diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index f8a3c1622..a42eb1efc 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "primitives" -version = "5.8.1" +version = "5.8.2" authors = ["GalacticCouncil"] edition = "2021" repository = "https://github.com/galacticcouncil/HydraDX-node" diff --git a/runtime/adapters/Cargo.toml b/runtime/adapters/Cargo.toml index c5e1cbe5b..6c0e162d0 100644 --- a/runtime/adapters/Cargo.toml +++ b/runtime/adapters/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-adapters" -version = "0.4.0" +version = "0.4.1" description = "Structs and other generic types for building runtimes." authors = ["GalacticCouncil"] edition = "2021" diff --git a/runtime/hydradx/Cargo.toml b/runtime/hydradx/Cargo.toml index ba21c3895..8aff00d07 100644 --- a/runtime/hydradx/Cargo.toml +++ b/runtime/hydradx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hydradx-runtime" -version = "166.0.0" +version = "167.0.0" authors = ["GalacticCouncil"] edition = "2021" license = "Apache 2.0" diff --git a/runtime/hydradx/src/lib.rs b/runtime/hydradx/src/lib.rs index b1e1fce05..8bcf9a6e3 100644 --- a/runtime/hydradx/src/lib.rs +++ b/runtime/hydradx/src/lib.rs @@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("hydradx"), impl_name: create_runtime_str!("hydradx"), authoring_version: 1, - spec_version: 166, + spec_version: 167, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,